mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Check Grails SDK in background thread, not in the AWT.
+review CR-IU @gromopert
This commit is contained in:
+35
-30
@@ -27,38 +27,43 @@ public class MvcProjectWithoutLibraryNotificator implements StartupActivity, Dum
|
||||
|
||||
@Override
|
||||
public void runActivity(@NotNull final Project project) {
|
||||
AccessToken accessToken = ApplicationManager.getApplication().acquireReadActionLock();
|
||||
ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
AccessToken accessToken = ApplicationManager.getApplication().acquireReadActionLock();
|
||||
|
||||
try {
|
||||
if (JavaPsiFacade.getInstance(project).findClass(CommonClassNames.JAVA_LANG_OBJECT, GlobalSearchScope.allScope(project)) == null) {
|
||||
return; // If indexes is corrupted JavaPsiFacade.findClass() can't find classes during StartupActivity (may be it's a bug).
|
||||
// So we can't determine whether exists Grails library or not.
|
||||
try {
|
||||
if (JavaPsiFacade.getInstance(project).findClass(CommonClassNames.JAVA_LANG_OBJECT, GlobalSearchScope.allScope(project)) == null) {
|
||||
return; // If indexes is corrupted JavaPsiFacade.findClass() can't find classes during StartupActivity (may be it's a bug).
|
||||
// So we can't determine whether exists Grails library or not.
|
||||
}
|
||||
|
||||
Pair<Module, MvcFramework> pair = findModuleWithoutLibrary(project);
|
||||
|
||||
if (pair != null) {
|
||||
final MvcFramework framework = pair.second;
|
||||
final Module module = pair.first;
|
||||
|
||||
new Notification(framework.getFrameworkName() + ".Configure",
|
||||
framework.getFrameworkName() + " SDK not found.",
|
||||
"<html><body>Module '" +
|
||||
module.getName() +
|
||||
"' has no " +
|
||||
framework.getFrameworkName() +
|
||||
" SDK. <a href='create'>Configure SDK</a></body></html>", NotificationType.INFORMATION,
|
||||
new NotificationListener.Adapter() {
|
||||
@Override
|
||||
protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent e) {
|
||||
MvcConfigureNotification.configure(framework, module);
|
||||
}
|
||||
}).notify(project);
|
||||
}
|
||||
}
|
||||
finally {
|
||||
accessToken.finish();
|
||||
}
|
||||
}
|
||||
|
||||
Pair<Module, MvcFramework> pair = findModuleWithoutLibrary(project);
|
||||
|
||||
if (pair != null) {
|
||||
final MvcFramework framework = pair.second;
|
||||
final Module module = pair.first;
|
||||
|
||||
new Notification(framework.getFrameworkName() + ".Configure",
|
||||
framework.getFrameworkName() + " SDK not found.",
|
||||
"<html><body>Module '" +
|
||||
module.getName() +
|
||||
"' has no " +
|
||||
framework.getFrameworkName() +
|
||||
" SDK. <a href='create'>Configure SDK</a></body></html>", NotificationType.INFORMATION,
|
||||
new NotificationListener.Adapter() {
|
||||
@Override
|
||||
protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent e) {
|
||||
MvcConfigureNotification.configure(framework, module);
|
||||
}
|
||||
}).notify(project);
|
||||
}
|
||||
}
|
||||
finally {
|
||||
accessToken.finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
Reference in New Issue
Block a user