mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Bug fix: Balloon 'Grails library isn't configured' shown every sturtup if indexes are corrupted.
This commit is contained in:
@@ -361,6 +361,8 @@
|
||||
|
||||
<generation.topLevelFactory language="Groovy" implementationClass="org.jetbrains.plugins.groovy.lang.psi.impl.GroovyFactoryProvider" />
|
||||
|
||||
<postStartupActivity implementation="org.jetbrains.plugins.groovy.mvc.MvcProjectWithoutLibraryNotificator" />
|
||||
|
||||
<!-- control flow -->
|
||||
<intentionAction>
|
||||
<bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
|
||||
|
||||
-2
@@ -189,8 +189,6 @@ public class MvcModuleStructureSynchronizer extends AbstractProjectComponent {
|
||||
queue(SyncAction.EnsureRunConfigurationExists, myProject);
|
||||
queue(SyncAction.UpgradeFramework, myProject);
|
||||
queue(SyncAction.CreateAppStructureIfNeeded, myProject);
|
||||
|
||||
MvcProjectWithoutLibraryNotificator.projectOpened(myProject);
|
||||
}
|
||||
|
||||
private void queue(SyncAction action, Object on) {
|
||||
|
||||
+30
-34
@@ -5,12 +5,13 @@ import com.intellij.notification.NotificationListener;
|
||||
import com.intellij.notification.NotificationType;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleManager;
|
||||
import com.intellij.openapi.project.DumbAwareRunnable;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ProjectManagerAdapter;
|
||||
import com.intellij.openapi.startup.StartupManager;
|
||||
import com.intellij.openapi.startup.StartupActivity;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.CommonClassNames;
|
||||
import com.intellij.psi.JavaPsiFacade;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -19,41 +20,36 @@ import javax.swing.event.HyperlinkEvent;
|
||||
/**
|
||||
* @author Sergey Evdokimov
|
||||
*/
|
||||
public class MvcProjectWithoutLibraryNotificator {
|
||||
public class MvcProjectWithoutLibraryNotificator implements StartupActivity {
|
||||
|
||||
private MvcProjectWithoutLibraryNotificator() {
|
||||
@Override
|
||||
public void runActivity(final Project project) {
|
||||
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 determinate whether exists Grails library or not.
|
||||
}
|
||||
|
||||
}
|
||||
Pair<Module, MvcFramework> pair = findModuleWithoutLibrary(project);
|
||||
|
||||
public static void projectOpened(final Project project) {
|
||||
StartupManager.getInstance(project).runWhenProjectIsInitialized(new DumbAwareRunnable() {
|
||||
if (pair != null) {
|
||||
final MvcFramework framework = pair.second;
|
||||
final Module module = pair.first;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
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() {
|
||||
@Override
|
||||
public void hyperlinkUpdate(@NotNull Notification notification,
|
||||
@NotNull HyperlinkEvent event) {
|
||||
MvcConfigureNotification.configure(framework, module);
|
||||
}
|
||||
}).notify(project);
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
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() {
|
||||
@Override
|
||||
public void hyperlinkUpdate(@NotNull Notification notification,
|
||||
@NotNull HyperlinkEvent event) {
|
||||
MvcConfigureNotification.configure(framework, module);
|
||||
}
|
||||
}).notify(project);
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
Reference in New Issue
Block a user