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);
}
});
}
}
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);
}
}
}
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);
}
});
}
}
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());
}
}
}
});
}
});
}
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);
}
});
}
Aggregations