com.intellij.openapi.progress.EmptyProgressIndicator Java Examples
The following examples show how to use
com.intellij.openapi.progress.EmptyProgressIndicator.
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: CleanupInspectionIntention.java From consulo with Apache License 2.0 | 6 votes |
@Override public void invoke(@Nonnull final Project project, final Editor editor, final PsiFile file) throws IncorrectOperationException { final List<ProblemDescriptor> descriptions = ProgressManager.getInstance().runProcess(() -> { InspectionManager inspectionManager = InspectionManager.getInstance(project); return InspectionEngine.runInspectionOnFile(file, myToolWrapper, inspectionManager.createNewGlobalContext(false)); }, new EmptyProgressIndicator()); if (!descriptions.isEmpty() && !FileModificationService.getInstance().preparePsiElementForWrite(file)) return; final AbstractPerformFixesTask fixesTask = applyFixes(project, "Apply Fixes", descriptions, myQuickfixClass); if (!fixesTask.isApplicableFixFound()) { HintManager.getInstance().showErrorHint(editor, "Unfortunately '" + myText + "' is currently not available for batch mode\n User interaction is required for each problem found"); } }
Example #2
Source File: BackgroundTaskUtil.java From consulo with Apache License 2.0 | 6 votes |
public static <T> T runUnderDisposeAwareIndicator(@Nonnull Disposable parent, @Nonnull Computable<T> task) { ProgressIndicator indicator = new EmptyProgressIndicator(ModalityState.defaultModalityState()); indicator.start(); Disposable disposable = () -> { if (indicator.isRunning()) indicator.cancel(); }; if (!registerIfParentNotDisposed(parent, disposable)) { indicator.cancel(); throw new ProcessCanceledException(); } try { return ProgressManager.getInstance().runProcess(task, indicator); } finally { Disposer.dispose(disposable); } }
Example #3
Source File: CommitSelectionListener.java From consulo with Apache License 2.0 | 6 votes |
public void processEvent() { int rows = myGraphTable.getSelectedRowCount(); if (rows < 1) { myLoadingPanel.stopLoading(); onEmptySelection(); } else { onSelection(myGraphTable.getSelectedRows()); myLoadingPanel.startLoading(); final EmptyProgressIndicator indicator = new EmptyProgressIndicator(); myLastRequest = indicator; List<Integer> selectionToLoad = getSelectionToLoad(); myLogData.getCommitDetailsGetter() .loadCommitsData(myGraphTable.getModel().convertToCommitIds(selectionToLoad), detailsList -> { if (myLastRequest == indicator && !(indicator.isCanceled())) { LOG.assertTrue(selectionToLoad.size() == detailsList.size(), "Loaded incorrect number of details " + detailsList + " for selection " + selectionToLoad); myLastRequest = null; onDetailsLoaded(detailsList); myLoadingPanel.stopLoading(); } }, indicator); } }
Example #4
Source File: KShortestPathsFinderTest.java From consulo with Apache License 2.0 | 6 votes |
private static void doTest(Map<String, String> graph, final String start, final String finish, final int k, String... expectedPaths) { final Graph<String> generator = initGraph(graph); final List<List<String>> paths = getAlgorithmsInstance().findKShortestPaths(generator, start, finish, k, new EmptyProgressIndicator()); List<String> pathStrings = new ArrayList<String>(); Set<Integer> sizes = new HashSet<Integer>(); for (List<String> path : paths) { pathStrings.add(StringUtil.join(path, "")); sizes.add(path.size()); } if (sizes.size() != paths.size()) { UsefulTestCase.assertSameElements(pathStrings, expectedPaths); } else { UsefulTestCase.assertOrderedEquals(pathStrings, expectedPaths); } }
Example #5
Source File: QuarkusModuleInfoStep.java From intellij-quarkus with Eclipse Public License 2.0 | 5 votes |
@Override public void _init() { ProgressIndicator indicator = new EmptyProgressIndicator() { @Override public void setText(String text) { SwingUtilities.invokeLater(() -> panel.setLoadingText(text)); } }; try { QuarkusModel model = QuarkusModelRegistry.INSTANCE.load(context.getUserData(QuarkusConstants.WIZARD_ENDPOINT_URL_KEY), indicator); context.putUserData(QuarkusConstants.WIZARD_MODEL_KEY, model); final FormBuilder formBuilder = new FormBuilder(); final CollectionComboBoxModel<ToolDelegate> toolModel = new CollectionComboBoxModel<>(Arrays.asList(ToolDelegate.getDelegates())); toolComboBox = new ComboBox<>(toolModel); toolComboBox.setRenderer(new ColoredListCellRenderer<ToolDelegate>() { @Override protected void customizeCellRenderer(@NotNull JList<? extends ToolDelegate> list, ToolDelegate toolDelegate, int index, boolean selected, boolean hasFocus) { this.append(toolDelegate.getDisplay()); } }); formBuilder.addLabeledComponent("Tool:", toolComboBox); groupIdField = new JBTextField("org.acme"); formBuilder.addLabeledComponent("Group:", groupIdField); artifactIdField = new JBTextField("code-with-quarkus"); formBuilder.addLabeledComponent("Artifact:", artifactIdField); versionField = new JBTextField("1.0.0-SNAPSHOT"); formBuilder.addLabeledComponent("Version:", versionField); classNameField = new JBTextField("org.acme.ExampleResource"); formBuilder.addLabeledComponent("Class name:", classNameField); pathField = new JBTextField("/hello"); formBuilder.addLabeledComponent("Path:", pathField); panel.add(ScrollPaneFactory.createScrollPane(formBuilder.getPanel(), true), "North"); } catch (IOException e) { LOGGER.error(e.getLocalizedMessage(), e); throw new RuntimeException(e); } }
Example #6
Source File: FindInProjectTask.java From consulo with Apache License 2.0 | 5 votes |
FindInProjectTask(@Nonnull final FindModel findModel, @Nonnull final Project project, @Nonnull Set<? extends VirtualFile> filesToScanInitially) { myFindModel = findModel; myProject = project; myFilesToScanInitially = filesToScanInitially; myDirectory = FindInProjectUtil.getDirectory(findModel); myPsiManager = PsiManager.getInstance(project); final String moduleName = findModel.getModuleName(); myModule = moduleName == null ? null : ReadAction.compute(() -> ModuleManager.getInstance(project).findModuleByName(moduleName)); myProjectFileIndex = ProjectRootManager.getInstance(project).getFileIndex(); myFileIndex = myModule == null ? myProjectFileIndex : ModuleRootManager.getInstance(myModule).getFileIndex(); Condition<CharSequence> patternCondition = FindInProjectUtil.createFileMaskCondition(findModel.getFileFilter()); myFileMask = file -> file != null && patternCondition.value(file.getNameSequence()); final ProgressIndicator progress = ProgressManager.getInstance().getProgressIndicator(); myProgress = progress != null ? progress : new EmptyProgressIndicator(); String stringToFind = myFindModel.getStringToFind(); if (myFindModel.isRegularExpressions()) { stringToFind = FindInProjectUtil.buildStringToFindForIndicesFromRegExp(stringToFind, myProject); } myStringToFindInIndices = stringToFind; TooManyUsagesStatus.createFor(myProgress); }
Example #7
Source File: LineMarkersPass.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull public static Collection<LineMarkerInfo<PsiElement>> queryLineMarkers(@Nonnull PsiFile file, @Nonnull Document document) { if (file.getNode() == null) { // binary file? see IDEADEV-2809 return Collections.emptyList(); } LineMarkersPass pass = new LineMarkersPass(file.getProject(), file, document, file.getTextRange(), file.getTextRange()); pass.doCollectInformation(new EmptyProgressIndicator()); return pass.myMarkers; }
Example #8
Source File: SeparatePiecesRunner.java From consulo with Apache License 2.0 | 5 votes |
@RequiredUIAccess private void pingImpl() { while (true) { myCurrentWrapper.set(null); // stop if project is being disposed if (!myProject.isDefault() && !myProject.isOpen()) return; if (getSuspendFlag()) return; final TaskDescriptor current = getNextMatching(); if (current == null) { return; } if (Where.AWT.equals(current.getWhere())) { setIndicator(null); try { current.run(this); } catch (RuntimeException th) { handleException(th, true); } } else { final TaskWrapper task = new TaskWrapper(myProject, current.getName(), myCancellable, current); myCurrentWrapper.set(task); if (ApplicationManager.getApplication().isUnitTestMode()) { setIndicator(new EmptyProgressIndicator()); } else { setIndicator(new BackgroundableProcessIndicator(task)); } ProgressManager.getInstance().runProcessWithProgressAsynchronously(task, getIndicator()); return; } } }
Example #9
Source File: PsiBuilderImpl.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull private DiffLog merge(@Nonnull final ASTNode oldRoot, @Nonnull StartMarker newRoot, @Nonnull CharSequence lastCommittedText) { DiffLog diffLog = new DiffLog(); DiffTreeChangeBuilder<ASTNode, LighterASTNode> builder = new ConvertFromTokensToASTBuilder(newRoot, diffLog); MyTreeStructure treeStructure = new MyTreeStructure(newRoot, null); ShallowNodeComparator<ASTNode, LighterASTNode> comparator = new MyComparator(getUserData(CUSTOM_COMPARATOR), treeStructure); ProgressIndicator indicator = ProgressIndicatorProvider.getGlobalProgressIndicator(); BlockSupportImpl.diffTrees(oldRoot, builder, comparator, treeStructure, indicator == null ? new EmptyProgressIndicator() : indicator, lastCommittedText); return diffLog; }
Example #10
Source File: ActionUpdater.java From consulo with Apache License 2.0 | 5 votes |
CancellablePromise<List<AnAction>> expandActionGroupAsync(ActionGroup group, boolean hideDisabled) { AsyncPromise<List<AnAction>> promise = new AsyncPromise<>(); ProgressIndicator indicator = new EmptyProgressIndicator(); promise.onError(__ -> { indicator.cancel(); ActionUpdateEdtExecutor.computeOnEdt(() -> { applyPresentationChanges(); return null; }); }); cancelAndRestartOnUserActivity(promise, indicator); ourExecutor.execute(() -> { while (promise.getState() == Promise.State.PENDING) { try { boolean success = ProgressIndicatorUtils.runInReadActionWithWriteActionPriority(() -> { List<AnAction> result = expandActionGroup(group, hideDisabled, myRealUpdateStrategy); ActionUpdateEdtExecutor.computeOnEdt(() -> { applyPresentationChanges(); promise.setResult(result); return null; }); }, new SensitiveProgressWrapper(indicator)); if (!success) { ProgressIndicatorUtils.yieldToPendingWriteActions(); } } catch (Throwable e) { promise.setError(e); } } }); return promise; }
Example #11
Source File: NonBlockingReadActionImpl.java From consulo with Apache License 2.0 | 5 votes |
void transferToBgThread(@Nonnull ReschedulingAttempt previousAttempt) { if (myCoalesceEquality != null) { acquire(); } backendExecutor.execute(() -> { final ProgressIndicator indicator = myProgressIndicator != null ? new SensitiveProgressWrapper(myProgressIndicator) { @Nonnull @Override public ModalityState getModalityState() { return creationModality; } } : new EmptyProgressIndicator(creationModality); currentIndicator = indicator; try { ReadAction.run(() -> { boolean success = ProgressIndicatorUtils.runWithWriteActionPriority(() -> insideReadAction(previousAttempt, indicator), indicator); if (!success && Promises.isPending(promise)) { reschedule(previousAttempt); } }); } finally { currentIndicator = null; if (myCoalesceEquality != null) { release(); } } }); }
Example #12
Source File: DirDiffTableModel.java From consulo with Apache License 2.0 | 5 votes |
public void reloadModel(final boolean userForcedRefresh) { myUpdating.set(true); myTable.getEmptyText().setText(StatusText.DEFAULT_EMPTY_TEXT); final JBLoadingPanel loadingPanel = getLoadingPanel(); loadingPanel.startLoading(); final ModalityState modalityState = ModalityState.current(); ApplicationManager.getApplication().executeOnPooledThread(() -> { EmptyProgressIndicator indicator = new EmptyProgressIndicator(modalityState); ProgressManager.getInstance().executeProcessUnderProgress(() -> { try { if (myDisposed) return; myUpdater = new Updater(loadingPanel, 100); myUpdater.start(); text.set("Loading..."); myTree = new DTree(null, "", true); mySrc.refresh(userForcedRefresh); myTrg.refresh(userForcedRefresh); scan(mySrc, myTree, true); scan(myTrg, myTree, false); } catch (final IOException e) { LOG.warn(e); reportException(VcsBundle.message("refresh.failed.message", StringUtil.decapitalize(e.getLocalizedMessage()))); } finally { if (myTree != null) { myTree.setSource(mySrc); myTree.setTarget(myTrg); myTree.update(mySettings); applySettings(); } } }, indicator); }); }
Example #13
Source File: BlazeCWorkspace.java From intellij with Apache License 2.0 | 5 votes |
private static ImmutableList<String> collectCompilerSettingsInParallel( OCWorkspaceImpl.ModifiableModel model, CidrToolEnvironment toolEnvironment) { CompilerInfoCache compilerInfoCache = new CompilerInfoCache(); TempFilesPool tempFilesPool = new CachedTempFilesPool(); Session<Integer> session = compilerInfoCache.createSession(new EmptyProgressIndicator()); ImmutableList.Builder<String> issues = ImmutableList.builder(); try { int i = 0; for (OCResolveConfiguration.ModifiableModel config : model.getConfigurations()) { session.schedule(i++, config, toolEnvironment); } MultiMap<Integer, Message> messages = new MultiMap<>(); session.waitForAll(messages); for (Map.Entry<Integer, Collection<Message>> entry : ContainerUtil.sorted(messages.entrySet(), Comparator.comparingInt(Map.Entry::getKey))) { entry.getValue().stream() .filter(m -> m.getType().equals(Message.Type.ERROR)) .map(Message::getText) .forEachOrdered(issues::add); } } catch (Error | RuntimeException e) { session.dispose(); // This calls tempFilesPool.clean(); throw e; } tempFilesPool.clean(); return issues.build(); }
Example #14
Source File: QuarkusModelRegistryTest.java From intellij-quarkus with Eclipse Public License 2.0 | 5 votes |
@Test public void checkAllExtensionsGradleProject() throws IOException { File folder = temporaryFolder.newFolder(); QuarkusModel model = registry.load(QUARKUS_CODE_URL, new EmptyProgressIndicator()); enableAllExtensions(model); QuarkusModelRegistry.zip(QUARKUS_CODE_URL, "GRADLE", "org.acme", "code-with-quarkus", "0.0.1-SNAPSHOT", "org.acme.ExampleResource", "/example", model, folder); assertTrue(new File(folder, "build.gradle").exists()); }
Example #15
Source File: QuarkusModelRegistryTest.java From intellij-quarkus with Eclipse Public License 2.0 | 5 votes |
@Test public void checkBaseGradleProject() throws IOException { File folder = temporaryFolder.newFolder(); QuarkusModelRegistry.zip(QUARKUS_CODE_URL, "GRADLE", "org.acme", "code-with-quarkus", "0.0.1-SNAPSHOT", "org.acme.ExampleResource", "/example", registry.load(QUARKUS_CODE_URL, new EmptyProgressIndicator()), folder); assertTrue(new File(folder, "build.gradle").exists()); }
Example #16
Source File: QuarkusModelRegistryTest.java From intellij-quarkus with Eclipse Public License 2.0 | 5 votes |
@Test public void checkAllExtensionsMavenProject() throws IOException { File folder = temporaryFolder.newFolder(); QuarkusModel model = registry.load(QUARKUS_CODE_URL, new EmptyProgressIndicator()); enableAllExtensions(model); QuarkusModelRegistry.zip(QUARKUS_CODE_URL, "MAVEN", "org.acme", "code-with-quarkus", "0.0.1-SNAPSHOT", "org.acme.ExampleResource", "/example", model, folder); assertTrue(new File(folder, "pom.xml").exists()); }
Example #17
Source File: QuarkusModelRegistryTest.java From intellij-quarkus with Eclipse Public License 2.0 | 5 votes |
@Test public void checkBaseMavenProject() throws IOException { File folder = temporaryFolder.newFolder(); QuarkusModelRegistry.zip(QUARKUS_CODE_URL, "MAVEN", "org.acme", "code-with-quarkus", "0.0.1-SNAPSHOT", "org.acme.ExampleResource", "/example", registry.load(QUARKUS_CODE_URL, new EmptyProgressIndicator()), folder); assertTrue(new File(folder, "pom.xml").exists()); }
Example #18
Source File: MavenImportingTestCase.java From intellij-quarkus with Eclipse Public License 2.0 | 5 votes |
protected void executeGoal(String relativePath, String goal) { VirtualFile dir = myProjectRoot.findFileByRelativePath(relativePath); MavenRunnerParameters rp = new MavenRunnerParameters(true, dir.getPath(), (String)null, Arrays.asList(goal), Collections.emptyList()); MavenRunnerSettings rs = new MavenRunnerSettings(); MavenExecutor e = new MavenExternalExecutor(myProject, rp, getMavenGeneralSettings(), rs, new SoutMavenConsole()); e.execute(new EmptyProgressIndicator()); }
Example #19
Source File: TreeState.java From consulo with Apache License 2.0 | 4 votes |
@Override public void batch(Progressive progressive) { progressive.run(new EmptyProgressIndicator()); }
Example #20
Source File: VcsLogProgress.java From consulo with Apache License 2.0 | 4 votes |
public ProgressIndicator createProgressIndicator(boolean visible) { if (ApplicationManager.getApplication().isHeadlessEnvironment()) { return new EmptyProgressIndicator(); } return new VcsLogProgressIndicator(visible); }
Example #21
Source File: RefreshProgress.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull public static ProgressIndicator create(@Nonnull String message) { Application app = ApplicationManager.getApplication(); return app == null || app.isUnitTestMode() ? new EmptyProgressIndicator() : new RefreshProgress(message); }
Example #22
Source File: ProgressManagerImpl.java From consulo with Apache License 2.0 | 4 votes |
@Override @Nonnull public Future<?> runProcessWithProgressAsynchronously(@Nonnull Task.Backgroundable task) { ProgressIndicator progressIndicator = ApplicationManager.getApplication().isHeadlessEnvironment() ? new EmptyProgressIndicator() : new BackgroundableProcessIndicator(task); return runProcessWithProgressAsynchronously(task, progressIndicator, null); }
Example #23
Source File: MockDumbService.java From consulo with Apache License 2.0 | 4 votes |
@Override public void queueTask(@Nonnull DumbModeTask task) { task.performInDumbMode(new EmptyProgressIndicator()); Disposer.dispose(task); }
Example #24
Source File: AttachToProcessActionBase.java From consulo with Apache License 2.0 | 4 votes |
@Override public List<AttachToProcessItem> getSubItems() { return collectAttachProcessItems(myProject, myInfo, new EmptyProgressIndicator()); }
Example #25
Source File: QuarkusModelRegistryTest.java From intellij-quarkus with Eclipse Public License 2.0 | 4 votes |
@Test(expected = IOException.class) public void checkThatIOExceptionIsReturnedWithInvalidURL() throws IOException { registry.load("https://invalid.org", new EmptyProgressIndicator()); }
Example #26
Source File: QuarkusModelRegistryTest.java From intellij-quarkus with Eclipse Public License 2.0 | 4 votes |
@Test public void checkThatModelCanLoadWithCodeQuarkusIO() throws IOException { assertNotNull(registry.load(QUARKUS_CODE_URL, new EmptyProgressIndicator())); }
Example #27
Source File: GitHubErrorReporter.java From IntelliJDeodorant with MIT License | 4 votes |
@SuppressWarnings("BooleanMethodNameMustStartWithQuestion") private static boolean doSubmit(final IdeaLoggingEvent event, final Component parentComponent, final Consumer<SubmittedReportInfo> callback, final GitHubErrorBean bean, final String description) { final DataContext dataContext = DataManager.getInstance().getDataContext(parentComponent); bean.setDescription(description); bean.setMessage(event.getMessage()); if (event instanceof IdeaReportingEvent) { IdeaReportingEvent reportingEvent = (IdeaReportingEvent) event; IdeaPluginDescriptor descriptor = reportingEvent.getPlugin(); if (descriptor != null) { bean.setPluginName(descriptor.getName()); bean.setPluginVersion(descriptor.getVersion()); } } Object data = event.getData(); if (data instanceof LogMessage) { bean.setAttachments(((LogMessage) data).getIncludedAttachments()); } ErrorReportInformation errorReportInformation = ErrorReportInformation .getUsersInformation(bean, (ApplicationInfoEx) ApplicationInfo.getInstance(), ApplicationNamesInfo.getInstance()); final Project project = CommonDataKeys.PROJECT.getData(dataContext); final CallbackWithNotification notifyingCallback = new CallbackWithNotification(callback, project); AnonymousFeedbackTask task = new AnonymousFeedbackTask(project, IntelliJDeodorantBundle.message("report.error.progress.dialog.text"), true, errorReportInformation, notifyingCallback); if (project == null) { task.run(new EmptyProgressIndicator()); } else { ProgressManager.getInstance().run(task); } return true; }