com.intellij.openapi.progress.ProgressManager Java Examples
The following examples show how to use
com.intellij.openapi.progress.ProgressManager.
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: CompletionThreadingBase.java From consulo with Apache License 2.0 | 6 votes |
public static void withBatchUpdate(Runnable runnable, CompletionProcess process) { if (ourIsInBatchUpdate.get().booleanValue() || !(process instanceof CompletionProgressIndicator)) { runnable.run(); return; } try { ourIsInBatchUpdate.set(Boolean.TRUE); runnable.run(); ProgressManager.checkCanceled(); CompletionProgressIndicator currentIndicator = (CompletionProgressIndicator)process; CompletionThreadingBase threading = Objects.requireNonNull(currentIndicator.getCompletionThreading()); threading.flushBatchResult(currentIndicator); } finally { ourIsInBatchUpdate.set(Boolean.FALSE); } }
Example #2
Source File: WolfTheProblemSolverImpl.java From consulo with Apache License 2.0 | 6 votes |
private boolean isToBeHighlighted(@Nullable VirtualFile virtualFile) { if (virtualFile == null) return false; synchronized (myFilters) { if (!myFiltersLoaded) { myFiltersLoaded = true; myFilters.addAll(Arrays.asList(FILTER_EP_NAME.getExtensions(myProject))); } } for (final Condition<VirtualFile> filter : myFilters) { ProgressManager.checkCanceled(); if (filter.value(virtualFile)) { return true; } } return false; }
Example #3
Source File: AnalysisScope.java From consulo with Apache License 2.0 | 6 votes |
private static boolean processFile(@Nonnull final VirtualFile vFile, @Nonnull final PsiElementVisitor visitor, @Nonnull final PsiManager psiManager, final boolean needReadAction, final boolean clearResolveCache) { final Runnable runnable = new Runnable() { @Override public void run() { doProcessFile(visitor, psiManager, vFile, clearResolveCache); } }; if (needReadAction && !ApplicationManager.getApplication().isDispatchThread()) { commitAndRunInSmartMode(runnable, psiManager.getProject()); } else { runnable.run(); } final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator(); return indicator == null || !indicator.isCanceled(); }
Example #4
Source File: FileHistoryPanelImpl.java From consulo with Apache License 2.0 | 6 votes |
private void refreshFile(VcsFileRevision revision) { Runnable refresh = null; final VirtualFile vf = getVirtualFile(); if (vf == null) { final LocalHistoryAction action = startLocalHistoryAction(revision); final VirtualFile vp = myFilePath.getVirtualFileParent(); if (vp != null) { refresh = () -> vp.refresh(false, true, action::finish); } } else { refresh = () -> vf.refresh(false, false); } if (refresh != null) { ProgressManager.getInstance().runProcessWithProgressSynchronously(refresh, "Refreshing Files...", false, myVcs.getProject()); } }
Example #5
Source File: FindInProjectUtil.java From consulo with Apache License 2.0 | 6 votes |
static int processUsagesInFile(@Nonnull final PsiFile psiFile, @Nonnull final VirtualFile virtualFile, @Nonnull final FindModel findModel, @Nonnull final Processor<? super UsageInfo> consumer) { if (findModel.getStringToFind().isEmpty()) { if (!ReadAction.compute(() -> consumer.process(new UsageInfo(psiFile)))) { throw new ProcessCanceledException(); } return 1; } if (virtualFile.getFileType().isBinary()) return 0; // do not decompile .class files final Document document = ReadAction.compute(() -> virtualFile.isValid() ? FileDocumentManager.getInstance().getDocument(virtualFile) : null); if (document == null) return 0; final int[] offset = {0}; int count = 0; int found; ProgressIndicator indicator = ProgressWrapper.unwrap(ProgressManager.getInstance().getProgressIndicator()); TooManyUsagesStatus tooManyUsagesStatus = TooManyUsagesStatus.getFrom(indicator); do { tooManyUsagesStatus.pauseProcessingIfTooManyUsages(); // wait for user out of read action found = ReadAction.compute(() -> { if (!psiFile.isValid()) return 0; return addToUsages(document, findModel, psiFile, offset, USAGES_PER_READ_ACTION, consumer); }); count += found; } while (found != 0); return count; }
Example #6
Source File: CompilerPathsEx.java From consulo with Apache License 2.0 | 6 votes |
protected void acceptDirectory(final VirtualFile file, final String fileRoot, final String filePath) { ProgressManager.checkCanceled(); final VirtualFile[] children = file.getChildren(); for (final VirtualFile child : children) { final String name = child.getName(); final String _filePath; final StringBuilder buf = StringBuilderSpinAllocator.alloc(); try { buf.append(filePath).append("/").append(name); _filePath = buf.toString(); } finally { StringBuilderSpinAllocator.dispose(buf); } accept(child, fileRoot, _filePath); } }
Example #7
Source File: ProgressIndicatorUtils.java From consulo with Apache License 2.0 | 6 votes |
/** * Run the given computation with its execution time restricted to the given amount of time in milliseconds.<p></p> * <p> * Internally, it creates a new {@link ProgressIndicator}, runs the computation with that indicator and cancels it after the the timeout. * The computation should call {@link ProgressManager#checkCanceled()} frequently enough, so that after the timeout has been exceeded * it can stop the execution by throwing {@link ProcessCanceledException}, which will be caught by this {@code withTimeout}.<p></p> * <p> * If a {@link ProcessCanceledException} happens due to any other reason (e.g. a thread's progress indicator got canceled), * it'll be thrown out of this method. * * @return the computation result or {@code null} if timeout has been exceeded. */ @Nullable public static <T> T withTimeout(long timeoutMs, @Nonnull Computable<T> computation) { ProgressManager.checkCanceled(); ProgressIndicator outer = ProgressIndicatorProvider.getGlobalProgressIndicator(); ProgressIndicator inner = outer != null ? new SensitiveProgressWrapper(outer) : new ProgressIndicatorBase(false, false); AtomicBoolean canceledByTimeout = new AtomicBoolean(); ScheduledFuture<?> cancelProgress = AppExecutorUtil.getAppScheduledExecutorService().schedule(() -> { canceledByTimeout.set(true); inner.cancel(); }, timeoutMs, TimeUnit.MILLISECONDS); try { return ProgressManager.getInstance().runProcess(computation, inner); } catch (ProcessCanceledException e) { if (canceledByTimeout.get()) { return null; } throw e; // canceled not by timeout } finally { cancelProgress.cancel(false); } }
Example #8
Source File: DataWriter.java From GsonFormat with Apache License 2.0 | 6 votes |
public void execute(ClassEntity targetClass) { this.targetClass = targetClass; ProgressManager.getInstance().run(new Task.Backgroundable(project, "GsonFormat") { @Override public void run(@NotNull ProgressIndicator progressIndicator) { progressIndicator.setIndeterminate(true); long currentTimeMillis = System.currentTimeMillis(); execute(); progressIndicator.setIndeterminate(false); progressIndicator.setFraction(1.0); StringBuffer sb = new StringBuffer(); sb.append("GsonFormat [" + (System.currentTimeMillis() - currentTimeMillis) + " ms]\n"); // sb.append("generate class : ( "+generateClassList.size()+" )\n"); // for (String item: generateClassList) { // sb.append(" at "+item+"\n"); // } // sb.append(" \n"); // NotificationCenter.info(sb.toString()); Toast.make(project, MessageType.INFO, sb.toString()); } }); }
Example #9
Source File: HaxeUtil.java From intellij-haxe with Apache License 2.0 | 6 votes |
public static void reparseProjectFiles(@NotNull final Project project) { Task.Backgroundable task = new Task.Backgroundable(project, HaxeBundle.message("haxe.project.reparsing"), false) { public void run(@NotNull ProgressIndicator indicator) { final Collection<VirtualFile> haxeFiles = new ArrayList<VirtualFile>(); final VirtualFile baseDir = project.getBaseDir(); if (baseDir != null) { FileBasedIndex.getInstance().iterateIndexableFiles(new ContentIterator() { public boolean processFile(VirtualFile file) { if (HaxeFileType.HAXE_FILE_TYPE == file.getFileType()) { haxeFiles.add(file); } return true; } }, project, indicator); } ApplicationManager.getApplication().invokeAndWait(new Runnable() { public void run() { FileContentUtil.reparseFiles(project, haxeFiles, !project.isDefault()); } }, ModalityState.NON_MODAL); } }; ProgressManager.getInstance().run(task); }
Example #10
Source File: DWCleanAction.java From intellij-demandware with MIT License | 6 votes |
public void actionPerformed(AnActionEvent e) { Project project = e.getProject(); if (project != null) { for (Module module : ModuleManager.getInstance(project).getModules()) { if (ModuleType.get(module) instanceof DWModuleType) { ModuleServiceManager.getService(module, DWServerConnection.class); ProgressManager.getInstance().run( new DWCleanTask(project, module, "Cleaning cartridges...", true, PerformInBackgroundOption.ALWAYS_BACKGROUND) ); } } } }
Example #11
Source File: JarHandler.java From consulo with Apache License 2.0 | 6 votes |
@Nonnull private File copyToMirror(@Nonnull File original, @Nonnull File mirror) { ProgressIndicator progress = ProgressManager.getInstance().getProgressIndicator(); if (progress != null) { progress.pushState(); progress.setText(VfsBundle.message("jar.copy.progress", original.getPath())); progress.setFraction(0); } try { FileUtil.copy(original, mirror); } catch (final IOException e) { reportIOErrorWithJars(original, mirror, e); return original; } finally { if (progress != null) { progress.popState(); } } return mirror; }
Example #12
Source File: VcsSynchronousProgressWrapper.java From consulo with Apache License 2.0 | 6 votes |
public static boolean wrap(final ThrowableRunnable<VcsException> runnable, final Project project, final String title) { final VcsException[] exc = new VcsException[1]; final Runnable process = new Runnable() { @Override public void run() { try { runnable.run(); } catch (VcsException e) { exc[0] = e; } } }; final boolean notCanceled; if (ApplicationManager.getApplication().isDispatchThread()) { notCanceled = ProgressManager.getInstance().runProcessWithProgressSynchronously(process, title, true, project); } else { process.run(); notCanceled = true; } if (exc[0] != null) { AbstractVcsHelper.getInstance(project).showError(exc[0], title); return false; } return notCanceled; }
Example #13
Source File: ShelveChangesManager.java From consulo with Apache License 2.0 | 6 votes |
public void unshelveSilentlyAsynchronously(@Nonnull final Project project, @Nonnull final List<ShelvedChangeList> selectedChangeLists, @Nonnull final List<ShelvedChange> selectedChanges, @Nonnull final List<ShelvedBinaryFile> selectedBinaryChanges, @Nullable final LocalChangeList forcePredefinedOneChangelist) { ProgressManager.getInstance().run(new Task.Backgroundable(project, VcsBundle.message("unshelve.changes.progress.title"), true) { @Override public void run(@Nonnull ProgressIndicator indicator) { for (ShelvedChangeList changeList : selectedChangeLists) { List<ShelvedChange> changesForChangelist = ContainerUtil.newArrayList(ContainerUtil.intersection(changeList.getChanges(myProject), selectedChanges)); List<ShelvedBinaryFile> binariesForChangelist = ContainerUtil.newArrayList(ContainerUtil.intersection(changeList.getBinaryFiles(), selectedBinaryChanges)); boolean shouldUnshelveAllList = changesForChangelist.isEmpty() && binariesForChangelist.isEmpty(); unshelveChangeList(changeList, shouldUnshelveAllList ? null : changesForChangelist, shouldUnshelveAllList ? null : binariesForChangelist, forcePredefinedOneChangelist != null ? forcePredefinedOneChangelist : getChangeListUnshelveTo(changeList), true); } } }); }
Example #14
Source File: ImplementationSearcher.java From consulo with Apache License 2.0 | 6 votes |
/** * * @param element * @param editor * @return For the case the search has been cancelled */ @Nullable protected PsiElement[] searchDefinitions(PsiElement element, Editor editor) { PsiElement[][] result = new PsiElement[1][]; if (!ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> { try { result[0] = search(element, editor).toArray(PsiElement.EMPTY_ARRAY); } catch (IndexNotReadyException e) { dumbModeNotification(element); result[0] = null; } }, SEARCHING_FOR_IMPLEMENTATIONS, true, element.getProject())) { return null; } return result[0]; }
Example #15
Source File: ModuleManagerComponent.java From consulo with Apache License 2.0 | 6 votes |
@Override protected void fireModulesAdded() { Runnable runnableWithProgress = () -> { for (final Module module : myModuleModel.getModules()) { final Application app = ApplicationManager.getApplication(); final Runnable swingRunnable = () -> fireModuleAddedInWriteAction(module); if (app.isDispatchThread() || app.isHeadlessEnvironment()) { swingRunnable.run(); } else { ProgressIndicator pi = ProgressManager.getInstance().getProgressIndicator(); app.invokeAndWait(swingRunnable, pi.getModalityState()); } } }; ProgressIndicator progressIndicator = myProgressManager.getProgressIndicator(); if (progressIndicator == null) { myProgressManager.runProcessWithProgressSynchronously(runnableWithProgress, "Loading modules", false, myProject); } else { runnableWithProgress.run(); } }
Example #16
Source File: AddSourceToProjectHelper.java From intellij with Apache License 2.0 | 6 votes |
@Nullable private static WorkspacePath findBlazePackagePath(Project project, WorkspacePath source) { WorkspacePathResolver pathResolver = WorkspacePathResolverProvider.getInstance(project).getPathResolver(); if (pathResolver == null) { return null; } BuildSystemProvider provider = Blaze.getBuildSystemProvider(project); while (source != null) { ProgressManager.checkCanceled(); if (provider.findBuildFileInDirectory(pathResolver.resolveToFile(source)) != null) { return source; } source = source.getParent(); } return null; }
Example #17
Source File: SingleTargetRequestResultProcessor.java From consulo with Apache License 2.0 | 6 votes |
@Override public boolean processTextOccurrence(@Nonnull PsiElement element, int offsetInElement, @Nonnull final Processor<? super PsiReference> consumer) { if (!myTarget.isValid()) { return false; } final List<PsiReference> references = ourReferenceService.getReferences(element, new PsiReferenceService.Hints(myTarget, offsetInElement)); //noinspection ForLoopReplaceableByForEach for (int i = 0; i < references.size(); i++) { PsiReference ref = references.get(i); ProgressManager.checkCanceled(); if (ReferenceRange.containsOffsetInElement(ref, offsetInElement) && ref.isReferenceTo(myTarget) && !consumer.process(ref)) { return false; } } return true; }
Example #18
Source File: ExtractMethodHelper.java From consulo with Apache License 2.0 | 6 votes |
/** * Finds duplicates of the code fragment specified in the finder in given scopes. * Note that in contrast to {@link #processDuplicates} the search is performed synchronously because normally you need the results in * order to complete the refactoring. If user cancels it, empty list will be returned. * * @param finder finder object to seek for duplicates * @param searchScopes scopes where to look them in * @param generatedMethod new method that should be excluded from the search * @return list of discovered duplicate code fragments or empty list if user interrupted the search * @see #replaceDuplicates(PsiElement, Editor, Consumer, List) */ @Nonnull public static List<SimpleMatch> collectDuplicates(@Nonnull SimpleDuplicatesFinder finder, @Nonnull List<PsiElement> searchScopes, @Nonnull PsiElement generatedMethod) { final Project project = generatedMethod.getProject(); try { //noinspection RedundantCast return ProgressManager.getInstance().runProcessWithProgressSynchronously( (ThrowableComputable<List<SimpleMatch>, RuntimeException>)() -> { ProgressManager.getInstance().getProgressIndicator().setIndeterminate(true); ThrowableComputable<List<SimpleMatch>, RuntimeException> action = () -> finder.findDuplicates(searchScopes, generatedMethod); return AccessRule.read(action); }, RefactoringBundle.message("searching.for.duplicates"), true, project); } catch (ProcessCanceledException e) { return Collections.emptyList(); } }
Example #19
Source File: IdeaMMDPrintPanelAdaptor.java From netbeans-mmd-plugin with Apache License 2.0 | 6 votes |
@Override public void startBackgroundTask(@Nonnull final MMDPrintPanel source, @Nonnull final String taskName, @Nonnull final Runnable task) { final Task.Backgroundable backgroundTask = new Task.Backgroundable(this.project, taskName) { @Override public void run(@Nonnull final ProgressIndicator indicator) { try { indicator.setIndeterminate(true); task.run(); IdeaUtils.showPopup(String.format("%s has been sent to the printer", taskName), MessageType.INFO); } catch (Exception ex) { LOGGER.error("Print error", ex); IdeaUtils.showPopup("Print error! See the log!", MessageType.ERROR); } finally { indicator.stop(); } } }; ProgressManager.getInstance().run(backgroundTask); }
Example #20
Source File: AbstractRefactoringPanel.java From IntelliJDeodorant with MIT License | 5 votes |
public static void runAfterCompilationCheck(Task.Backgroundable afterCompilationBackgroundable, Project project, ProjectInfo projectInfo) { final Task.Backgroundable compilationBackgroundable = new Task.Backgroundable(project, IntelliJDeodorantBundle.message("project.compiling.indicator.text"), true) { @Override public void run(@NotNull ProgressIndicator indicator) { runAfterCompilationCheck(projectInfo, afterCompilationBackgroundable); } }; ProgressManager.getInstance().run(compilationBackgroundable); }
Example #21
Source File: CompletionProgressIndicator.java From consulo with Apache License 2.0 | 5 votes |
private void calculateItems(CompletionInitializationContext initContext, WeighingDelegate weigher, CompletionParameters parameters) { duringCompletion(initContext, parameters); ProgressManager.checkCanceled(); CompletionService.getCompletionService().performCompletion(parameters, weigher); ProgressManager.checkCanceled(); weigher.waitFor(); ProgressManager.checkCanceled(); }
Example #22
Source File: CheckoutAction.java From azure-devops-intellij with MIT License | 5 votes |
@Override protected void execute(@NotNull MultipleItemActionContext actionContext) { Project project = actionContext.project; ProgressManager.getInstance().run( new Task.Modal( project, TfPluginBundle.message(TfPluginBundle.KEY_ACTIONS_TFVC_CHECKOUT_PROGRESS), false) { @Override public void run(@NotNull ProgressIndicator indicator) { TfvcClient client = TfvcClient.getInstance(project); List<Path> filePaths = actionContext.itemInfos.stream() .map(item -> Paths.get(item.getLocalItem())) .collect(Collectors.toList()); TfvcCheckoutResult checkoutResult = client.checkoutForEdit( actionContext.serverContext, filePaths, true); try { TfvcCheckoutResultUtils.verify(checkoutResult); } catch (VcsException e) { ourLogger.warn(e); UIUtil.invokeLaterIfNeeded(() -> Messages.showErrorDialog( TfPluginBundle.message(TfPluginBundle.KEY_ACTIONS_TFVC_CHECKOUT_TITLE), LocalizationServiceImpl.getInstance().getExceptionMessage(e))); } } }); }
Example #23
Source File: DesktopAsyncEditorLoader.java From consulo with Apache License 2.0 | 5 votes |
private void waitForCommit(long commitDeadlineNs) { Document document = myEditor.getDocument(); PsiDocumentManager pdm = PsiDocumentManager.getInstance(myProject); if (!pdm.isCommitted(document) && System.nanoTime() < commitDeadlineNs) { Semaphore semaphore = new Semaphore(1); pdm.performForCommittedDocument(document, semaphore::up); while (System.nanoTime() < commitDeadlineNs && !semaphore.waitFor(10)) { ProgressManager.checkCanceled(); } } }
Example #24
Source File: ProgressSuspender.java From consulo with Apache License 2.0 | 5 votes |
/** * @param reason if provided, is displayed in the UI instead of suspended text passed into constructor until the progress is resumed */ public void suspendProcess(@Nullable String reason) { synchronized (myLock) { if (mySuspended || myClosed) return; mySuspended = true; myTempReason = reason; ((ProgressManagerImpl)ProgressManager.getInstance()).addCheckCanceledHook(myHook); } myPublisher.suspendedStatusChanged(this); }
Example #25
Source File: InspectionProfileWrapper.java From consulo with Apache License 2.0 | 5 votes |
public static void checkInspectionsDuplicates(@Nonnull InspectionToolWrapper[] toolWrappers) { if (alreadyChecked) return; alreadyChecked = true; Set<InspectionProfileEntry> uniqTools = new THashSet<InspectionProfileEntry>(toolWrappers.length); for (InspectionToolWrapper toolWrapper : toolWrappers) { ProgressManager.checkCanceled(); if (!uniqTools.add(toolWrapper.getTool())) { LOG.error("Inspection " + toolWrapper.getDisplayName() + " (" + toolWrapper.getTool().getClass() + ") already registered"); } } }
Example #26
Source File: FileBasedIndexImpl.java From consulo with Apache License 2.0 | 5 votes |
@Nullable private <K, V> TIntHashSet collectFileIdsContainingAllKeys(@Nonnull final ID<K, V> indexId, @Nonnull final Collection<? extends K> dataKeys, @Nonnull final GlobalSearchScope filter, @Nullable final Condition<? super V> valueChecker, @Nullable final ProjectIndexableFilesFilter projectFilesFilter) { ThrowableConvertor<UpdatableIndex<K, V, FileContent>, TIntHashSet, StorageException> convertor = index -> InvertedIndexUtil.collectInputIdsContainingAllKeys(index, dataKeys, __ -> { ProgressManager.checkCanceled(); return true; }, valueChecker, projectFilesFilter == null ? null : projectFilesFilter::containsFileId); return processExceptions(indexId, null, filter, convertor); }
Example #27
Source File: CallbackData.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull private static CallbackData createInteractive(@Nonnull Project project, @Nonnull InvokeAfterUpdateMode mode, @Nonnull Runnable afterUpdate, String title, @Nullable ModalityState state) { Task task = mode.isSynchronous() ? new Waiter(project, afterUpdate, title, mode.isCancellable()) : new FictiveBackgroundable(project, afterUpdate, title, mode.isCancellable(), state); Runnable callback = () -> { logUpdateFinished(project, mode); setDone(task); }; return new CallbackData(callback, () -> ProgressManager.getInstance().run(task)); }
Example #28
Source File: JobUtilTest.java From consulo with Apache License 2.0 | 5 votes |
private static void checkProgressAndReadAction(final List<Object> objects, final DaemonProgressIndicator progress, final boolean runInReadAction) throws Throwable { final AtomicReference<Throwable> exception = new AtomicReference<Throwable>(); JobLauncher.getInstance().invokeConcurrentlyUnderProgress(objects, progress, runInReadAction, new Processor<Object>() { @Override public boolean process(Object o) { try { if (objects.size() <= 1 || JobSchedulerImpl.getCPUCoresCount() <= 2) { assertTrue(ApplicationManager.getApplication().isDispatchThread()); } else { // generally we know nothing about current thread since FJP can help others task to execute while in current context } ProgressIndicator actualIndicator = ProgressManager.getInstance().getProgressIndicator(); assertTrue(actualIndicator instanceof SensitiveProgressWrapper); actualIndicator = ((SensitiveProgressWrapper)actualIndicator).getOriginalProgressIndicator(); if (progress != null) { assertSame(progress, actualIndicator); } else { assertNotNull(actualIndicator); } // there can be read access even if we didn't ask for it (e.g. when task under read action steals others work) assertTrue(!runInReadAction || ApplicationManager.getApplication().isReadAccessAllowed()); } catch (Throwable e) { exception.set(e); } return true; } }); if (exception.get() != null) throw exception.get(); }
Example #29
Source File: BlazeConfigurationResolverTest.java From intellij with Apache License 2.0 | 5 votes |
@Override protected void initTest(Container applicationServices, Container projectServices) { super.initTest(applicationServices, projectServices); applicationServices.register(BlazeExecutor.class, new MockBlazeExecutor()); applicationServices.register(ExperimentService.class, new MockExperimentService()); compilerVersionChecker = new MockCompilerVersionChecker("1234"); applicationServices.register(CompilerVersionChecker.class, compilerVersionChecker); applicationServices.register(ProgressManager.class, new ProgressManagerImpl()); applicationServices.register(CompilerWrapperProvider.class, new CompilerWrapperProviderImpl()); applicationServices.register(VirtualFileManager.class, mock(VirtualFileManager.class)); applicationServices.register(FileOperationProvider.class, new FileOperationProvider()); mockFileSystem = mock(LocalFileSystem.class); applicationServices.register( VirtualFileSystemProvider.class, mock(VirtualFileSystemProvider.class)); when(VirtualFileSystemProvider.getInstance().getSystem()).thenReturn(mockFileSystem); ExtensionPointImpl<Provider> ep = registerExtensionPoint(Kind.Provider.EP_NAME, Kind.Provider.class); ep.registerExtension(new CppBlazeRules()); applicationServices.register(Kind.ApplicationState.class, new Kind.ApplicationState()); projectServices.register( BlazeImportSettingsManager.class, new BlazeImportSettingsManager(project)); BuildSystemProvider buildSystemProvider = new BazelBuildSystemProvider(); registerExtensionPoint(BuildSystemProvider.EP_NAME, BuildSystemProvider.class) .registerExtension(buildSystemProvider); BlazeImportSettingsManager.getInstance(getProject()) .setImportSettings( new BlazeImportSettings("", "", "", "", buildSystemProvider.buildSystem())); registerExtensionPoint( BlazeCompilerFlagsProcessor.EP_NAME, BlazeCompilerFlagsProcessor.Provider.class); context.addOutputSink(IssueOutput.class, errorCollector); resolver = new BlazeConfigurationResolver(project); resolverResult = BlazeConfigurationResolverResult.empty(); }
Example #30
Source File: ModuleManagerComponent.java From consulo with Apache License 2.0 | 5 votes |
@Inject public ModuleManagerComponent(Project project, ProgressManager progressManager) { super(project); myConnection = myMessageBus.connect(project); myProgressManager = progressManager; myConnection.setDefaultHandler((event, params) -> cleanCachedStuff()); myConnection.subscribe(ProjectTopics.PROJECT_ROOTS); }