com.intellij.openapi.project.DumbAwareRunnable Java Examples
The following examples show how to use
com.intellij.openapi.project.DumbAwareRunnable.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FileStatusManagerImpl.java From consulo with Apache License 2.0 | 6 votes |
@Override public void fileStatusesChanged() { if (myProject.isDisposed()) { return; } if (!ApplicationManager.getApplication().isDispatchThread()) { ApplicationManager.getApplication().invokeLater(new DumbAwareRunnable() { @Override public void run() { fileStatusesChanged(); } }, ModalityState.NON_MODAL); return; } myCachedStatuses.clear(); myWhetherExactlyParentToChanged.clear(); for (FileStatusListener listener : myListeners) { listener.fileStatusesChanged(); } }
Example #2
Source File: FavoritesManager.java From consulo with Apache License 2.0 | 6 votes |
@Override public void projectOpened() { if (!ApplicationManager.getApplication().isUnitTestMode()) { StartupManager.getInstance(myProject).registerPostStartupActivity(new DumbAwareRunnable() { @Override public void run() { final FavoritesListProvider[] providers = Extensions.getExtensions(EP_NAME, myProject); for (FavoritesListProvider provider : providers) { myProviders.put(provider.getListName(myProject), provider); } final MyRootsChangeAdapter myPsiTreeChangeAdapter = new MyRootsChangeAdapter(); PsiManager.getInstance(myProject).addPsiTreeChangeListener(myPsiTreeChangeAdapter, myProject); if (myName2FavoritesRoots.isEmpty()) { myDescriptions.put(myProject.getName(), "auto-added"); createNewList(myProject.getName()); } } }); } }
Example #3
Source File: BookmarkManager.java From consulo with Apache License 2.0 | 6 votes |
@Override public void loadState(final Element state) { StartupManager.getInstance(myProject).runWhenProjectIsInitialized(new DumbAwareRunnable() { @Override public void run() { BookmarksListener publisher = myBus.syncPublisher(BookmarksListener.TOPIC); for (Bookmark bookmark : myBookmarks) { bookmark.release(); publisher.bookmarkRemoved(bookmark); } myBookmarks.clear(); readExternal(state); } }); }
Example #4
Source File: ChangeListManagerImpl.java From consulo with Apache License 2.0 | 6 votes |
@Override public void projectOpened() { initializeForNewProject(); final ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(myProject); if (ApplicationManager.getApplication().isUnitTestMode()) { myUpdater.initialized(); myProject.getMessageBus().connect().subscribe(VCS_CONFIGURATION_CHANGED, myVcsListener); } else { ((ProjectLevelVcsManagerImpl)vcsManager).addInitializationRequest(VcsInitObject.CHANGE_LIST_MANAGER, (DumbAwareRunnable)() -> { myUpdater.initialized(); broadcastStateAfterLoad(); myProject.getMessageBus().connect().subscribe(VCS_CONFIGURATION_CHANGED, myVcsListener); }); myConflictTracker.startTracking(); } }
Example #5
Source File: RestoreUpdateTree.java From consulo with Apache License 2.0 | 6 votes |
@Override public void projectOpened() { StartupManager.getInstance(myProject).registerPostStartupActivity(new DumbAwareRunnable() { @Override public void run() { if (myUpdateInfo != null && !myUpdateInfo.isEmpty() && ProjectReloadState.getInstance(myProject).isAfterAutomaticReload()) { ActionInfo actionInfo = myUpdateInfo.getActionInfo(); if (actionInfo != null) { ProjectLevelVcsManagerEx.getInstanceEx(myProject).showUpdateProjectInfo(myUpdateInfo.getFileInformation(), VcsBundle.message("action.display.name.update"), actionInfo, false); CommittedChangesCache.getInstance(myProject).refreshIncomingChangesAsync(); } myUpdateInfo = null; } else { myUpdateInfo = null; } } }); }
Example #6
Source File: XLineBreakpointManager.java From consulo with Apache License 2.0 | 6 votes |
public void updateBreakpointsUI() { if (myProject.isDefault()) return; DumbAwareRunnable runnable = () -> { for (XLineBreakpointImpl breakpoint : myBreakpoints.keySet()) { breakpoint.updateUI(); } }; if (ApplicationManager.getApplication().isUnitTestMode() || myStartupManager.startupActivityPassed()) { runnable.run(); } else { myStartupManager.registerPostStartupActivity(runnable); } }
Example #7
Source File: NotificationsManagerImpl.java From consulo with Apache License 2.0 | 6 votes |
private static void doNotify(@Nonnull 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 DumbAwareRunnable runnable = () -> showNotification(notification, project); if (project == null) { UIUtil.invokeLaterIfNeeded(runnable); } else if (!project.isDisposed()) { StartupManager.getInstance(project).runWhenProjectIsInitialized(runnable); } } }
Example #8
Source File: CrudUtils.java From crud-intellij-plugin with Apache License 2.0 | 6 votes |
public static void doOptimize(Project project) { DumbService.getInstance(project).runWhenSmart((DumbAwareRunnable) () -> new WriteCommandAction(project) { @Override protected void run(@NotNull Result result) { for (VirtualFile virtualFile : virtualFiles) { try { PsiJavaFile javaFile = (PsiJavaFile) PsiManager.getInstance(project).findFile(virtualFile); if (javaFile != null) { CodeStyleManager.getInstance(project).reformat(javaFile); JavaCodeStyleManager.getInstance(project).optimizeImports(javaFile); JavaCodeStyleManager.getInstance(project).shortenClassReferences(javaFile); } } catch (Exception e) { e.printStackTrace(); } } virtualFiles.clear(); } }.execute()); }
Example #9
Source File: ProjectImpl.java From consulo with Apache License 2.0 | 6 votes |
@Override public void setProjectName(@Nonnull String projectName) { String name = getName(); if (!projectName.equals(name)) { myName = projectName; StartupManager.getInstance(this).runWhenProjectIsInitialized(new DumbAwareRunnable() { @Override public void run() { if (isDisposed()) return; JFrame frame = WindowManager.getInstance().getFrame(ProjectImpl.this); String title = FrameTitleBuilder.getInstance().getProjectTitle(ProjectImpl.this); if (frame != null && title != null) { frame.setTitle(title); } } }); } }
Example #10
Source File: RPiJavaModuleBuilder.java From embeddedlinux-jvmdebugger-intellij with Apache License 2.0 | 6 votes |
/** * Runs a new thread to create the required files * * @param rootModel * @param project */ private void createProjectFiles(@NotNull final ModifiableRootModel rootModel,@NotNull final Project project) { ProjectUtils.runWhenInitialized(project, new DumbAwareRunnable() { public void run() { String srcPath = project.getBasePath() + File.separator + "src"; addJarFiles(rootModel.getModule()); String[] directoriesToMake = packageName.split(Pattern.quote(".")); for (String directory : directoriesToMake) { try { VfsUtil.createDirectories(srcPath + FileUtilities.SEPARATOR + directory); } catch (IOException e) { } srcPath += FileUtilities.SEPARATOR + directory; } Template.builder().name(getMainClassTemplateName()) .classContext(this.getClass()) .outputFile(srcPath + FileUtilities.SEPARATOR + "Main.java") .data(new HashMap<String, Object>() {{ put("packagename", packageName); }}).build() .toFile(); ProjectUtils.addProjectConfiguration(rootModel.getModule(), packageName + ".Main", getPresentableName()); } }); }
Example #11
Source File: ConsoleLogProjectTracker.java From aem-ide-tooling-4-intellij with Apache License 2.0 | 6 votes |
private void doPrintNotification(@NotNull final Notification notification, @NotNull final ConsoleLogConsole console) { StartupManager.getInstance(myProject).runWhenProjectIsInitialized(new DumbAwareRunnable() { @Override public void run() { if(!ShutDownTracker.isShutdownHookRunning() && !myProject.isDisposed()) { runReadAction( new Runnable() { @Override public void run() { console.doPrintNotification(notification); } } ); } } }); }
Example #12
Source File: SlingMavenModuleBuilder.java From aem-ide-tooling-4-intellij with Apache License 2.0 | 6 votes |
public void setupRootModel(ModifiableRootModel rootModel) { 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, archetypeTemplate.getMavenArchetype(), myPropertiesToCreateByArtifact, "Create new Sling Maven module").configure(project, root, false); } } ); }
Example #13
Source File: MuleMavenModuleBuilder.java From mule-intellij-plugins with Apache License 2.0 | 6 votes |
@Override public void setupRootModel(ModifiableRootModel rootModel) throws ConfigurationException { super.setupRootModel(rootModel); addListener(new ModuleBuilderListener() { @Override public void moduleCreated(@NotNull Module module) { setMuleFramework(module); } }); setMuleFacet(rootModel.getModule()); final Project project = rootModel.getProject(); final VirtualFile root = createAndGetContentEntry(); rootModel.addContentEntry(root); //Check if this is a module and has parent final MavenId parentId = (this.getParentProject() != null ? this.getParentProject().getMavenId() : null); MavenUtil.runWhenInitialized(project, (DumbAwareRunnable) () -> { new MuleMavenProjectBuilderHelper().configure(project, getProjectId(), muleVersion, root, parentId); }); }
Example #14
Source File: TestProjectViewPSIPane.java From consulo with Apache License 2.0 | 5 votes |
public void projectOpened() { final Runnable runnable = new DumbAwareRunnable() { @Override public void run() { final ProjectView projectView = ProjectView.getInstance(myProject); projectView.addProjectPane(TestProjectViewPSIPane.this); } }; StartupManager.getInstance(myProject).registerPostStartupActivity(runnable); }
Example #15
Source File: WelcomeFrameManager.java From consulo with Apache License 2.0 | 5 votes |
public void showIfNoProjectOpened() { myApplication.invokeLater((DumbAwareRunnable)() -> { WindowManagerEx windowManager = (WindowManagerEx)WindowManager.getInstance(); windowManager.disposeRootFrame(); IdeFrame[] frames = windowManager.getAllProjectFrames(); if (frames.length == 0) { showFrame(); } }, ModalityState.NON_MODAL); }
Example #16
Source File: Debounced.java From idea-gitignore with MIT License | 5 votes |
/** Wrapper run() method to invoke {@link #timer} properly. */ public final void run(@Nullable final T argument) { if (timer != null) { timer.cancel(false); } timer = JobScheduler.getScheduler().schedule( (DumbAwareRunnable) () -> task(argument), delay, TimeUnit.MILLISECONDS ); }
Example #17
Source File: FileStatusManagerImpl.java From consulo with Apache License 2.0 | 5 votes |
@Inject public FileStatusManagerImpl(Project project, StartupManager startupManager, @SuppressWarnings("UnusedParameters") DirectoryIndex makeSureIndexIsInitializedFirst) { myProject = project; project.getMessageBus().connect().subscribe(EditorColorsManager.TOPIC, new EditorColorsListener() { @Override public void globalSchemeChange(EditorColorsScheme scheme) { fileStatusesChanged(); } }); if (project.isDefault()) return; startupManager.registerPreStartupActivity(() -> { DocumentAdapter documentListener = new DocumentAdapter() { @Override public void documentChanged(DocumentEvent event) { if (event.getOldLength() == 0 && event.getNewLength() == 0) return; VirtualFile file = FileDocumentManager.getInstance().getFile(event.getDocument()); if (file != null) { refreshFileStatusFromDocument(file, event.getDocument()); } } }; final EditorFactory factory = EditorFactory.getInstance(); if (factory != null) { factory.getEventMulticaster().addDocumentListener(documentListener, myProject); } }); startupManager.registerPostStartupActivity(new DumbAwareRunnable() { @Override public void run() { fileStatusesChanged(); } }); }
Example #18
Source File: MuleDomainMavenModuleBuilder.java From mule-intellij-plugins with Apache License 2.0 | 5 votes |
@Override public void setupRootModel(ModifiableRootModel rootModel) throws ConfigurationException { super.setupRootModel(rootModel); setMuleFacet(rootModel.getModule()); final Project project = rootModel.getProject(); final VirtualFile root = createAndGetContentEntry(); rootModel.addContentEntry(root); MavenUtil.runWhenInitialized(project, (DumbAwareRunnable) () -> new MuleDomainMavenProjectBuilderHelper().configure(project, getProjectId(), muleVersion, root)); }
Example #19
Source File: FileStatusManagerImpl.java From consulo with Apache License 2.0 | 5 votes |
@Override public void fileStatusChanged(final VirtualFile file) { final Application application = ApplicationManager.getApplication(); if (!application.isDispatchThread() && !application.isUnitTestMode()) { ApplicationManager.getApplication().invokeLater(new DumbAwareRunnable() { @Override public void run() { fileStatusChanged(file); } }); return; } if (file == null || !file.isValid()) return; FileStatus cachedStatus = getCachedStatus(file); if (cachedStatus == FileStatusNull.INSTANCE) { return; } if (cachedStatus == null) { cacheChangedFileStatus(file, FileStatusNull.INSTANCE); return; } FileStatus newStatus = calcStatus(file); if (cachedStatus == newStatus) return; cacheChangedFileStatus(file, newStatus); for (FileStatusListener listener : myListeners) { listener.fileStatusChanged(file); } }
Example #20
Source File: LightToolWindowManager.java From consulo with Apache License 2.0 | 5 votes |
@Override public void projectOpened() { UIAccess lastUIAccess = Application.get().getLastUIAccess(); lastUIAccess.giveAndWaitIfNeed(this::initToolWindow); StartupManager.getInstance(myProject).runWhenProjectIsInitialized(new DumbAwareRunnable() { public void run() { if (getEditorMode() == null) { initListeners(); bindToDesigner(getActiveDesigner()); } } }); }
Example #21
Source File: EventLog.java From consulo with Apache License 2.0 | 5 votes |
private void doPrintNotification(@Nonnull final Notification notification, @Nonnull final EventLogConsole console) { StartupManager.getInstance(myProject).runWhenProjectIsInitialized(new DumbAwareRunnable() { @Override public void run() { if (!ShutDownTracker.isShutdownHookRunning() && !myProject.isDisposed()) { ApplicationManager.getApplication().runReadAction(new Runnable() { @Override public void run() { console.doPrintNotification(notification); } }); } } }); }
Example #22
Source File: NewMappings.java From consulo with Apache License 2.0 | 5 votes |
public NewMappings(Project project, ProjectLevelVcsManagerImpl vcsManager, FileStatusManager fileStatusManager) { myProject = project; myVcsManager = vcsManager; myFileStatusManager = fileStatusManager; myLock = new Object(); myVcsToPaths = MultiMap.createOrderedSet(); myFileWatchRequestsManager = new FileWatchRequestsManager(myProject, this); myDefaultVcsRootPolicy = DefaultVcsRootPolicy.getInstance(project); myActiveVcses = new AbstractVcs[0]; if (!myProject.isDefault()) { VcsDirectoryMapping mapping = new VcsDirectoryMapping("", ""); myVcsToPaths.putValue("", mapping); mySortedMappings = new VcsDirectoryMapping[]{mapping}; } else { mySortedMappings = VcsDirectoryMapping.EMPTY_ARRAY; } myActivated = false; vcsManager.addInitializationRequest(VcsInitObject.MAPPINGS, (DumbAwareRunnable)() -> { if (!myProject.isDisposed()) { activateActiveVcses(); } }); }
Example #23
Source File: VcsInitialization.java From consulo with Apache License 2.0 | 5 votes |
VcsInitialization(@Nonnull final Project project) { myProject = project; if (project.isDefault()) return; StartupManager.getInstance(project).registerPostStartupActivity((DumbAwareRunnable)() -> { if (project.isDisposed()) return; myFuture = ((ProgressManagerImpl)ProgressManager.getInstance()).runProcessWithProgressAsynchronously( new Task.Backgroundable(myProject, "VCS Initialization") { @Override public void run(@Nonnull ProgressIndicator indicator) { execute(indicator); } }, myIndicator, null); }); }
Example #24
Source File: NewFileAction.java From crud-intellij-plugin with Apache License 2.0 | 4 votes |
@Override public void actionPerformed(AnActionEvent e) { Project project = e.getProject(); VirtualFile virtualFile = e.getData(DataKeys.VIRTUAL_FILE); if (!virtualFile.isDirectory()) { virtualFile = virtualFile.getParent(); } Module module = ModuleUtil.findModuleForFile(virtualFile, project); String moduleRootPath = ModuleRootManager.getInstance(module).getContentRoots()[0].getPath(); String actionDir = virtualFile.getPath(); String str = StringUtils.substringAfter(actionDir, moduleRootPath + "/src/main/java/"); String basePackage = StringUtils.replace(str, "/", "."); SelectionContext.clearAllSet(); SelectionContext.setPackage(basePackage); if (StringUtils.isNotBlank(basePackage)) { basePackage += "."; } SelectionContext.setControllerPackage(basePackage + "controller"); SelectionContext.setServicePackage(basePackage + "service"); SelectionContext.setDaoPackage(basePackage + "dao"); SelectionContext.setModelPackage(basePackage + "model"); SelectionContext.setMapperDir(moduleRootPath + "/src/main/resources/mapper"); CrudActionDialog dialog = new CrudActionDialog(project, module); if (!dialog.showAndGet()) { return; } DumbService.getInstance(project).runWhenSmart((DumbAwareRunnable) () -> new WriteCommandAction(project) { @Override protected void run(@NotNull Result result) { Selection selection = SelectionContext.copyToSelection(); SelectionContext.clearAllSet(); try { PsiFileUtils.createCrud(project, selection, moduleRootPath); } catch (Exception ex) { ex.printStackTrace(); } //优化生成的所有Java类 CrudUtils.doOptimize(project); } }.execute()); }
Example #25
Source File: BraceHighlightingHandler.java From consulo with Apache License 2.0 | 4 votes |
static void lookForInjectedAndMatchBracesInOtherThread(@Nonnull final Editor editor, @Nonnull final Alarm alarm, @Nonnull final Processor<BraceHighlightingHandler> processor) { ApplicationEx application = (ApplicationEx)Application.get(); application.assertIsDispatchThread(); if (!isValidEditor(editor)) return; if (!PROCESSED_EDITORS.add(editor)) { // Skip processing if that is not really necessary. // Assuming to be in EDT here. return; } final int offset = editor.getCaretModel().getOffset(); final Project project = editor.getProject(); final PsiFile psiFile = PsiUtilBase.getPsiFileInEditor(editor, project); if (!isValidFile(psiFile)) return; application.executeOnPooledThread(() -> { if (!application.tryRunReadAction(() -> { final PsiFile injected; try { if (psiFile instanceof PsiBinaryFile || !isValidEditor(editor) || !isValidFile(psiFile)) { injected = null; } else { injected = getInjectedFileIfAny(editor, project, offset, psiFile, alarm); } } catch (RuntimeException e) { // Reset processing flag in case of unexpected exception. application.invokeLater(new DumbAwareRunnable() { @Override public void run() { PROCESSED_EDITORS.remove(editor); } }); throw e; } application.invokeLater(new DumbAwareRunnable() { @Override public void run() { try { if (isValidEditor(editor) && isValidFile(injected)) { Editor newEditor = InjectedLanguageUtil.getInjectedEditorForInjectedFile(editor, injected); BraceHighlightingHandler handler = new BraceHighlightingHandler(project, newEditor, alarm, injected); processor.process(handler); } } finally { PROCESSED_EDITORS.remove(editor); } } }, ModalityState.stateForComponent(editor.getComponent())); })) { // write action is queued in AWT. restart after it's finished application.invokeLater(() -> { PROCESSED_EDITORS.remove(editor); lookForInjectedAndMatchBracesInOtherThread(editor, alarm, processor); }, ModalityState.stateForComponent(editor.getComponent())); } }); }
Example #26
Source File: ChangesViewContentManager.java From consulo with Apache License 2.0 | 4 votes |
@Override public void projectOpened() { if (ApplicationManager.getApplication().isHeadlessEnvironment()) return; StartupManager.getInstance(myProject).registerPostStartupActivity(new DumbAwareRunnable() { @Override public void run() { final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(myProject); if (toolWindowManager != null) { myToolWindow = toolWindowManager.registerToolWindow(ToolWindowId.VCS, true, ToolWindowAnchor.BOTTOM, myProject, true); myToolWindow.setIcon(AllIcons.Toolwindows.ToolWindowChanges); updateToolWindowAvailability(); final ContentManager contentManager = myToolWindow.getContentManager(); myContentManagerListener = new MyContentManagerListener(); contentManager.addContentManagerListener(myContentManagerListener); myVcsManager.addVcsListener(myVcsListener); Disposer.register(myProject, new Disposable(){ @Override public void dispose() { contentManager.removeContentManagerListener(myContentManagerListener); myVcsManager.removeVcsListener(myVcsListener); } }); loadExtensionTabs(); myContentManager = contentManager; final List<Content> ordered = doPresetOrdering(myAddedContents); for(Content content: ordered) { myContentManager.addContent(content); } myAddedContents.clear(); if (contentManager.getContentCount() > 0) { contentManager.setSelectedContent(contentManager.getContent(0)); } myInitializationWaiter.countDown(); } } }); }
Example #27
Source File: RoboVmModuleBuilder.java From robovm-idea with GNU General Public License v2.0 | 4 votes |
@Override public void setupRootModel(final ModifiableRootModel modifiableRootModel) throws ConfigurationException { // set the Java SDK myJdk = RoboVmPlugin.getSdk(); if (myJdk == null || !robovmDir.isEmpty()) { myJdk = RoboVmSdkType.findBestJdk(); } // set a project jdk if none is set ProjectRootManager manager = ProjectRootManager.getInstance(modifiableRootModel.getProject()); if (manager.getProjectSdk() == null) { manager.setProjectSdk(RoboVmSdkType.findBestJdk()); } if (buildSystem != BuildSystem.None) { // apply the template final Project project = modifiableRootModel.getProject(); StartupManager.getInstance(project).runWhenProjectIsInitialized(new DumbAwareRunnable() { public void run() { DumbService.getInstance(project).smartInvokeLater(new Runnable() { public void run() { ApplicationManager.getApplication().runWriteAction(new Runnable() { public void run() { RoboVmModuleBuilder.this.applyTemplate(project); } }); } }); } }); // apply the build system StartupManager.getInstance(project).registerPostStartupActivity(new DumbAwareRunnable() { public void run() { DumbService.getInstance(project).smartInvokeLater(new Runnable() { public void run() { RoboVmModuleBuilder.this.applyBuildSystem(project); } }); } }); } else { Sdk jdk = RoboVmSdkType.findBestJdk(); LanguageLevel langLevel = ((JavaSdk) jdk.getSdkType()).getVersion(jdk).getMaxLanguageLevel(); modifiableRootModel.getModuleExtension(LanguageLevelModuleExtension.class).setLanguageLevel(langLevel); super.setupRootModel(modifiableRootModel); final VirtualFile contentRoot = LocalFileSystem.getInstance() .findFileByIoFile(new File(modifiableRootModel.getProject().getBasePath())); applyTemplate(modifiableRootModel.getProject()); contentRoot.refresh(false, true); for (ContentEntry entry : modifiableRootModel.getContentEntries()) { for (SourceFolder srcFolder : entry.getSourceFolders()) { entry.removeSourceFolder(srcFolder); } if (robovmDir.isEmpty()) { entry.addSourceFolder(contentRoot.findFileByRelativePath("/src/main/java"), false); } new File(entry.getFile().getCanonicalPath()).delete(); } } }
Example #28
Source File: InspectionProjectProfileManagerImpl.java From consulo with Apache License 2.0 | 4 votes |
@Override public void projectOpened() { StartupManager startupManager = StartupManager.getInstance(myProject); if (startupManager == null) { return; // upsource } startupManager.registerPostStartupActivity(new DumbAwareRunnable() { @Override public void run() { final Set<Profile> profiles = new HashSet<Profile>(); profiles.add(getProjectProfileImpl()); profiles.addAll(getProfiles()); profiles.addAll(InspectionProfileManager.getInstance().getProfiles()); final Application app = ApplicationManager.getApplication(); Runnable initInspectionProfilesRunnable = new Runnable() { @Override public void run() { for (Profile profile : profiles) { initProfileWrapper(profile); } fireProfilesInitialized(); } }; if (app.isUnitTestMode() || app.isHeadlessEnvironment()) { initInspectionProfilesRunnable.run(); UIUtil.dispatchAllInvocationEvents(); //do not restart daemon in the middle of the test } else { app.executeOnPooledThread(initInspectionProfilesRunnable); } myScopeListener = new NamedScopesHolder.ScopeListener() { @Override public void scopesChanged() { for (Profile profile : getProfiles()) { ((InspectionProfile)profile).scopesChanged(); } } }; myHolder.addScopeListener(myScopeListener, myProject); myLocalScopesHolder.addScopeListener(myScopeListener, myProject); } }); }