@Override public void run(@NotNull ProgressIndicator indicator) { if (doNotStart || myProject == null || myProject.isDisposed()) { return; } indicator.setIndeterminate(true); consumer.consume(execute()); } });
@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()); } });
public void run(@NotNull final ProgressIndicator progressIndicator) { progressIndicator.setText(message("handler.before.checkin.scan.in-progress")); progressIndicator.setIndeterminate(true); scanResults.putAll(plugin.scanFiles(new ArrayList<>(checkinPanel.getVirtualFiles()))); } }.queue();
@Override public void run(@NotNull final ProgressIndicator indicator) { indicator.setIndeterminate(true); handler.startNotify(); handler.waitFor(); indicator.setText2("Refreshing"); } catch (ExecutionException e) { LOG.warn(e);
@Test public void should_wrap() { monitor.finishNonCancelableSection(); verify(wrapped).finishNonCancelableSection(); monitor.isCanceled(); verify(wrapped).isCanceled(); monitor.setFraction(0.5f); verify(wrapped).setFraction(0.5f); monitor.setIndeterminate(true); verify(wrapped).setIndeterminate(true); monitor.setMessage("message"); verify(wrapped).setText("message"); monitor.startNonCancelableSection(); verify(wrapped).startNonCancelableSection(); } }
indicator.setIndeterminate(false); indicator.setText(PerlBundle.message("perl.scanning.xs.changes")); if (isActual) { Set<VirtualFile> allXSFiles = getAllXSFiles(myProject); for (VirtualFile virtualFile : allXSFiles) { if (indicator.isCanceled()) { return; indicator.setFraction(filesCounter / allXSFiles.size());
public void run(@NotNull final ProgressIndicator indicator) { indicator.setIndeterminate(true); indicator.setText(sb.toString()); break; if (indicator.isCanceled()) { cancelledByUser = true; OSProcessManager.getInstance().killProcessTree(processHandler.getProcess()); indicator.setText2("Preparing Project Structure..."); try { File fromDir = new File(baseDir.getPath() + "/" + SymfonyInstallerUtil.PROJECT_SUB_FOLDER);
@Override public void run(ProgressIndicator indicator) { AccumulatorIssueListener listener = new AccumulatorIssueListener(); try { checkCanceled(indicator, myProject); List<AnalysisResults> results = analyze(myProject, indicator, listener); //last chance to cancel (to avoid the possibility of having interrupt flag set) checkCanceled(indicator, myProject); LOGGER.info("SonarLint analysis done"); indicator.setIndeterminate(false); indicator.setFraction(.9); List<Issue> issues = listener.getIssues(); indicator.setText("Creating SonarLint issues: " + issues.size()); List<ClientInputFile> allFailedAnalysisFiles = results.stream() .flatMap(r -> r.failedAnalysisFiles().stream()) .collect(Collectors.toList()); processor.process(job, indicator, issues, allFailedAnalysisFiles); } catch (CanceledException e1) { console.info("Analysis canceled"); } catch (Throwable e) { handleError(e, indicator); } finally { myProject.getMessageBus().syncPublisher(TaskListener.SONARLINT_TASK_TOPIC).ended(job); } }
private void refactor() throws IOException, ProcessCanceledException { progressIndicator.checkCanceled(); progressIndicator.setIndeterminate(false); for (int i = 0; i < imageInformationList.size(); i++) { ImageInformation information = imageInformationList.get(i); progressIndicator.setText2(information.getExportName()); progressIndicator.checkCanceled(); if (information.isVector()) { copyTempImage(information); } else { exportTempImage(information); } progressIndicator.setFraction((float) (i + 1) / (float) imageInformationList.size()); } progressIndicator.setIndeterminate(true); progressIndicator.setText2("Finishing"); UIUtil.invokeLaterIfNeeded(new DumbAwareRunnable() { public void run() { try { move(project, imageInformationList); LocalFileSystem.getInstance().refresh(true); } catch (IOException e) { LOGGER.error(e); } } }); }
private static void updateProgress(ProgressIndicator indicator, String message, double fraction) { indicator.setText(message); indicator.setFraction(fraction); } }
@Override public void offer(E item, int estimatedRemainingItems) throws CancellationException { if (progress != null && progress.isCanceled()) { throw new CancellationException(); progress.setIndeterminate(true); } else { progress.setIndeterminate(false); progress.setFraction( pos / (((double) estimatedRemainingItems) + pos) );
public List<Resource> getAllProjectsAndModules() { List<Resource> allResources = new LinkedList<>(); final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator(); indicator.setText("Downloading SonarQube projects"); List<Component> projects = getAllProjects(sonarClient); projects = projects.stream().sorted(comparing(Component::getName)).collect(toList()); indicator.setText("Downloading SonarQube modules"); int i = 0; for (Component project : projects) { if (indicator.isCanceled()) break; i++; indicator.setFraction(1.0 * i / projects.size()); indicator.setText2(project.getName()); allResources.add(new Resource(project.getKey(), project.getName(), project.getQualifier())); List<Component> modules = getAllModules(sonarClient, project.getId()); modules = modules.stream().sorted(comparing(Component::getName)).collect(toList()); for (Component module : modules) { allResources.add(new Resource(module.getKey(), module.getName(), module.getQualifier())); } } return allResources; }
private void initListeners() { testConnectionButton.addActionListener(actionEvent -> { ServerConfiguration configuration = createServerConfigurationForTesting(); final Ref<Exception> excRef = new Ref<>(); final ProgressManager progressManager = ProgressManager.getInstance(); progressManager.runProcessWithProgressSynchronously(() -> { final ProgressIndicator progressIndicator = progressManager.getProgressIndicator(); if (progressIndicator != null) { progressIndicator.setText("Connecting to Mongo server..."); } try { mongoManager.connect(configuration); } catch (Exception ex) { excRef.set(ex); } }, "Testing Connection", true, ServerConfigurationPanel.this.project); if (!excRef.isNull()) { Messages.showErrorDialog(rootPanel, excRef.get().getMessage(), "Connection Test Failed"); } else { Messages.showInfoMessage(rootPanel, "Connection test successful", "Connection Test Successful"); } }); }
@Override public synchronized void run(@NotNull final ProgressIndicator indicator) { indicator.setIndeterminate(true); indicator.setText(HybrisI18NBundleUtils.message("hybris.project.import.preparation")); indicator.setText(HybrisI18NBundleUtils.message("hybris.project.import.facets")); if (isPluginActive(SPRING_PLUGIN_ID)) { this.excludeFrameworkDetection(project, SpringFacet.FACET_TYPE_ID); indicator.setText(HybrisI18NBundleUtils.message("hybris.project.import.spring")); springConfigurator.findSpringConfiguration(allModules); groupModuleConfigurator.findDependencyModules(allModules); indicator.setText(HybrisI18NBundleUtils.message( "hybris.project.import.module.import", moduleDescriptor.getName() )); indicator.setText2(HybrisI18NBundleUtils.message("hybris.project.import.module.settings")); final Module javaModule = rootProjectModifiableModel.newModule( moduleDescriptor.getIdeaModuleFile().getAbsolutePath(), StdModuleTypes.JAVA.getId() indicator.setText2(HybrisI18NBundleUtils.message("hybris.project.import.module.sdk")); ClasspathStorage.setStorageType(modifiableRootModel, ClassPathStorageUtil.DEFAULT_STORAGE); indicator.setText2(HybrisI18NBundleUtils.message("hybris.project.import.module.libs")); libRootsConfigurator.configure(modifiableRootModel, moduleDescriptor, modifiableModelsProvider); indicator.setText2(HybrisI18NBundleUtils.message("hybris.project.import.module.content")); indicator.setText2(HybrisI18NBundleUtils.message("hybris.project.import.module.outputpath")); compilerOutputPathsConfigurator.configure(modifiableRootModel, moduleDescriptor);
private List<AnalysisResults> analyze(Project project, ProgressIndicator indicator, AccumulatorIssueListener listener) { SonarLintAnalyzer analyzer = SonarLintUtils.get(project, SonarLintAnalyzer.class); indicator.setIndeterminate(true); int numModules = job.filesPerModule().keySet().size(); String suffix = ""; if (numModules > 1) { suffix = String.format(" in %d modules", numModules); } int numFiles = job.allFiles().size(); if (numFiles > 1) { indicator.setText("Running SonarLint Analysis for " + numFiles + " files" + suffix); } else { indicator.setText("Running SonarLint Analysis for '" + getFileName(job.allFiles().iterator().next()) + "'"); } LOGGER.info(indicator.getText()); ProgressMonitor progressMonitor = new TaskProgressMonitor(indicator); List<AnalysisResults> results = new LinkedList<>(); for (Map.Entry<Module, Collection<VirtualFile>> e : job.filesPerModule().entrySet()) { results.add(analyzer.analyzeModule(e.getKey(), e.getValue(), listener, progressMonitor)); checkCanceled(indicator, myProject); } indicator.startNonCancelableSection(); return results; } }
/** * Returns true if the task should be cancelled as soon as possible. */ @Override public boolean isCanceled() { return indicator.isCanceled(); }
@Override public void run(@NotNull ProgressIndicator progressIndicator) { progressIndicator.setIndeterminate(true); progressIndicator.startNonCancelableSection(); try { LOG.info("Fetching files into " + rootPath); FetchFilesResult r = P4ServerComponent .perform(project, clientConfig, new FetchFilesAction(Collections.singletonList(rootPath), null, false)) .blockingGet(UserProjectPreferences.getLockWaitTimeoutMillis(project), TimeUnit.MILLISECONDS); progressIndicator.finishNonCancelableSection(); synchronized (sync) { res = r; } } catch (InterruptedException e) { InternalErrorMessage.send(project).cacheLockTimeoutError(new ErrorEvent<>( new VcsInterruptedException(e))); progressIndicator.finishNonCancelableSection(); onCancel(); } catch (P4CommandRunner.ServerResultException e) { progressIndicator.finishNonCancelableSection(); VcsNotifier.getInstance(project).notifyError(P4Bundle.getString("checkout.config.error.title"), e.getMessage()); synchronized (sync) { res = null; } } progressIndicator.stop(); }
@Override public void run(@NotNull ProgressIndicator progressIndicator) { final ClassEntity entity = new ClassEntity(packageName, version); DownloadManager.getInstance().downloadFile(new ClassEntity[]{entity}, new File(Constant.CACHE_PATH + entity.getParentPath()), new DownloadResult<File>() { @Override public void onSuccess(List<File> output) { Log.debug("success: length=" + output.size()); if (output.isEmpty()) { NotificationUtils.errorNotification("Error: Download " + entity.getPackageName() + " Failure"); return; } Utils.openFileInPanel(output.get(0).getPath(), SourceViewerAction.this.project); } @Override public void onFailure(String msg, Throwable throwable) { NotificationUtils.errorNotification("Error:" + msg); } }); progressIndicator.setFraction(0.5); } });
@Override public void run(@NotNull final ProgressIndicator progressIndicator) { progressIndicator.setIndeterminate(true); try { FileUtils.forceMkdir(tempDir); progressIndicator.checkCanceled(); progressIndicator.checkCanceled(); progressIndicator.checkCanceled();
@Override public void run(@NotNull ProgressIndicator indicator) { indicator.setIndeterminate(true); try { requestManager.authenticate(settings, jenkinsSettings); jenkinsWorkspace = requestManager.loadJenkinsWorkspace(settings); } catch (Exception ex) { publisher.loginFailed(ex); indicator.cancel(); } } }.queue();