Search in sources :

Example 11 with DumbAwareRunnable

use of com.intellij.openapi.project.DumbAwareRunnable in project intellij-community by JetBrains.

the class PlatformProjectViewOpener method configureProject.

@Override
public void configureProject(final Project project, @NotNull final VirtualFile baseDir, Ref<Module> moduleRef) {
    ToolWindowManagerEx manager = (ToolWindowManagerEx) ToolWindowManager.getInstance(project);
    ToolWindow toolWindow = manager.getToolWindow(ToolWindowId.PROJECT_VIEW);
    if (toolWindow == null) {
        manager.addToolWindowManagerListener(new MyListener(manager, project));
    } else {
        StartupManager.getInstance(project).runWhenProjectIsInitialized(new DumbAwareRunnable() {

            @Override
            public void run() {
                activateProjectToolWindow(project, toolWindow);
            }
        });
    }
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) DumbAwareRunnable(com.intellij.openapi.project.DumbAwareRunnable) ToolWindowManagerEx(com.intellij.openapi.wm.ex.ToolWindowManagerEx)

Example 12 with DumbAwareRunnable

use of com.intellij.openapi.project.DumbAwareRunnable in project intellij-community by JetBrains.

the class NotificationsManagerImpl method doNotify.

private static void doNotify(@NotNull final Notification notification, @Nullable NotificationDisplayType displayType, @Nullable final Project project) {
    final NotificationsConfigurationImpl configuration = NotificationsConfigurationImpl.getInstanceImpl();
    if (!configuration.isRegistered(notification.getGroupId())) {
        configuration.register(notification.getGroupId(), displayType == null ? NotificationDisplayType.BALLOON : displayType);
    }
    final NotificationSettings settings = NotificationsConfigurationImpl.getSettings(notification.getGroupId());
    boolean shouldLog = settings.isShouldLog();
    boolean displayable = settings.getDisplayType() != NotificationDisplayType.NONE;
    boolean willBeShown = displayable && NotificationsConfigurationImpl.getInstanceImpl().SHOW_BALLOONS;
    if (!shouldLog && !willBeShown) {
        notification.expire();
    }
    if (NotificationsConfigurationImpl.getInstanceImpl().SHOW_BALLOONS) {
        final Runnable runnable = new DumbAwareRunnable() {

            @Override
            public void run() {
                showNotification(notification, project);
            }
        };
        if (project == null) {
            UIUtil.invokeLaterIfNeeded(runnable);
        } else if (!project.isDisposed()) {
            StartupManager.getInstance(project).runWhenProjectIsInitialized(runnable);
        }
    }
}
Also used : DumbAwareRunnable(com.intellij.openapi.project.DumbAwareRunnable) DumbAwareRunnable(com.intellij.openapi.project.DumbAwareRunnable)

Example 13 with DumbAwareRunnable

use of com.intellij.openapi.project.DumbAwareRunnable in project intellij-community by JetBrains.

the class ExternalDependenciesManagerImpl method loadState.

@Override
public void loadState(ExternalDependenciesState state) {
    ArrayList<ProjectExternalDependency> oldDependencies = new ArrayList<>(myDependencies);
    myDependencies.clear();
    for (DependencyOnPluginState dependency : state.myDependencies) {
        myDependencies.add(new DependencyOnPlugin(dependency.myId, dependency.myMinVersion, dependency.myMaxVersion, dependency.myChannel));
    }
    if (!oldDependencies.equals(myDependencies) && !myDependencies.isEmpty()) {
        StartupManager.getInstance(myProject).runWhenProjectIsInitialized(new DumbAwareRunnable() {

            @Override
            public void run() {
                CheckRequiredPluginsActivity.runCheck(myProject);
            }
        });
    }
}
Also used : ArrayList(java.util.ArrayList) ProjectExternalDependency(com.intellij.externalDependencies.ProjectExternalDependency) DumbAwareRunnable(com.intellij.openapi.project.DumbAwareRunnable) DependencyOnPlugin(com.intellij.externalDependencies.DependencyOnPlugin)

Example 14 with DumbAwareRunnable

use of com.intellij.openapi.project.DumbAwareRunnable in project intellij-community by JetBrains.

the class MvcModuleStructureSynchronizer method updateProjectViewVisibility.

private void updateProjectViewVisibility() {
    if (ApplicationManager.getApplication().isUnitTestMode())
        return;
    StartupManager.getInstance(myProject).runWhenProjectIsInitialized(new DumbAwareRunnable() {

        @Override
        public void run() {
            ApplicationManager.getApplication().invokeLater(() -> {
                if (myProject.isDisposed())
                    return;
                for (ToolWindowEP ep : ToolWindowEP.EP_NAME.getExtensions()) {
                    if (MvcToolWindowDescriptor.class.isAssignableFrom(ep.getFactoryClass())) {
                        MvcToolWindowDescriptor descriptor = (MvcToolWindowDescriptor) ep.getToolWindowFactory();
                        String id = descriptor.getToolWindowId();
                        boolean shouldShow = descriptor.value(myProject);
                        ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(myProject);
                        ToolWindow toolWindow = toolWindowManager.getToolWindow(id);
                        if (shouldShow && toolWindow == null) {
                            toolWindow = toolWindowManager.registerToolWindow(id, true, ToolWindowAnchor.LEFT, myProject, true);
                            toolWindow.setIcon(descriptor.getFramework().getToolWindowIcon());
                            descriptor.createToolWindowContent(myProject, toolWindow);
                        } else if (!shouldShow && toolWindow != null) {
                            toolWindowManager.unregisterToolWindow(id);
                            Disposer.dispose(toolWindow.getContentManager());
                        }
                    }
                }
            });
        }
    });
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) MvcToolWindowDescriptor(org.jetbrains.plugins.groovy.mvc.projectView.MvcToolWindowDescriptor) ToolWindowManager(com.intellij.openapi.wm.ToolWindowManager) ToolWindowEP(com.intellij.openapi.wm.ToolWindowEP) DumbAwareRunnable(com.intellij.openapi.project.DumbAwareRunnable)

Example 15 with DumbAwareRunnable

use of com.intellij.openapi.project.DumbAwareRunnable in project intellij-community by JetBrains.

the class MavenModuleBuilder method setupRootModel.

public void setupRootModel(ModifiableRootModel rootModel) throws ConfigurationException {
    final Project project = rootModel.getProject();
    final VirtualFile root = createAndGetContentEntry();
    rootModel.addContentEntry(root);
    // todo this should be moved to generic ModuleBuilder
    if (myJdk != null) {
        rootModel.setSdk(myJdk);
    } else {
        rootModel.inheritSdk();
    }
    MavenUtil.runWhenInitialized(project, new DumbAwareRunnable() {

        public void run() {
            if (myEnvironmentForm != null) {
                myEnvironmentForm.setData(MavenProjectsManager.getInstance(project).getGeneralSettings());
            }
            new MavenModuleBuilderHelper(myProjectId, myAggregatorProject, myParentProject, myInheritGroupId, myInheritVersion, myArchetype, myPropertiesToCreateByArtifact, "Create new Maven module").configure(project, root, false);
        }
    });
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Project(com.intellij.openapi.project.Project) MavenProject(org.jetbrains.idea.maven.project.MavenProject) DumbAwareRunnable(com.intellij.openapi.project.DumbAwareRunnable)

Aggregations

DumbAwareRunnable (com.intellij.openapi.project.DumbAwareRunnable)16 ToolWindow (com.intellij.openapi.wm.ToolWindow)3 Notification (com.intellij.notification.Notification)2 NotificationListener (com.intellij.notification.NotificationListener)2 Application (com.intellij.openapi.application.Application)2 Project (com.intellij.openapi.project.Project)2 FileStatusListener (com.intellij.openapi.vcs.FileStatusListener)2 DependencyOnPlugin (com.intellij.externalDependencies.DependencyOnPlugin)1 ProjectExternalDependency (com.intellij.externalDependencies.ProjectExternalDependency)1 UISettings (com.intellij.ide.ui.UISettings)1 Editor (com.intellij.openapi.editor.Editor)1 EditorColorsListener (com.intellij.openapi.editor.colors.EditorColorsListener)1 EditorColorsScheme (com.intellij.openapi.editor.colors.EditorColorsScheme)1 AbstractExternalSystemSettings (com.intellij.openapi.externalSystem.settings.AbstractExternalSystemSettings)1 ExternalSystemSettingsListenerAdapter (com.intellij.openapi.externalSystem.settings.ExternalSystemSettingsListenerAdapter)1 LibraryEx (com.intellij.openapi.roots.impl.libraries.LibraryEx)1 Library (com.intellij.openapi.roots.libraries.Library)1 Balloon (com.intellij.openapi.ui.popup.Balloon)1 JBPopupAdapter (com.intellij.openapi.ui.popup.JBPopupAdapter)1 LightweightWindowEvent (com.intellij.openapi.ui.popup.LightweightWindowEvent)1