當前位置: 首頁>>代碼示例>>Java>>正文


Java ProgressIndicator類代碼示例

本文整理匯總了Java中com.intellij.openapi.progress.ProgressIndicator的典型用法代碼示例。如果您正苦於以下問題:Java ProgressIndicator類的具體用法?Java ProgressIndicator怎麽用?Java ProgressIndicator使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ProgressIndicator類屬於com.intellij.openapi.progress包,在下文中一共展示了ProgressIndicator類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: execute

import com.intellij.openapi.progress.ProgressIndicator; //導入依賴的package包/類
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());
            }
        });
    }
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:24,代碼來源:DataWriter.java

示例2: refresh

import com.intellij.openapi.progress.ProgressIndicator; //導入依賴的package包/類
/**
 * Refreshes the log console in background
 */
void refresh(final String task) {
    SingleTaskBackgroundExecutor.executeIfPossible(myProject, new SingleTaskBackgroundExecutor.BackgroundTask() {
        @Override
        public void run(ProgressIndicator progressIndicator) {
            try {
                UIUtil.invokeAndWaitIfNeeded((Runnable) () -> {
                    progressIndicator.setFraction(0);
                    doFilter(progressIndicator);
                });
            } catch (Throwable ex) {
                debug("Exception " + ex.getMessage());
            }
        }

        @Override
        public String getTaskName() {
            return task;
        }
    });
}
 
開發者ID:josesamuel,項目名稱:logviewer,代碼行數:24,代碼來源:LogView.java

示例3: doFilter

import com.intellij.openapi.progress.ProgressIndicator; //導入依賴的package包/類
/**
 * Filters the console
 */
private synchronized void doFilter(ProgressIndicator progressIndicator) {
    final ConsoleView console = getConsole();
    String allLInes = getOriginalDocument().toString();
    final String[] lines = allLInes.split("\n");
    if (console != null) {
        console.clear();
    }
    myLogFilterModel.processingStarted();
    int size = lines.length;
    float current = 0;
    for (String line : lines) {
        printMessageToConsole(line);
        current++;
        progressIndicator.setFraction(current / size);
    }
    if (console != null) {
        ((ConsoleViewImpl) console).requestScrollingToEnd();
    }
}
 
開發者ID:josesamuel,項目名稱:logviewer,代碼行數:23,代碼來源:LogView.java

示例4: runAnalysis

import com.intellij.openapi.progress.ProgressIndicator; //導入依賴的package包/類
private void runAnalysis(@NotNull final ProgressIndicator progressIndicator) throws Exception {
    String analysisOutput = getAnalysisOutput(progressIndicator);
    if (!analysisOutput.startsWith("Error") && !analysisOutput.startsWith("FAILURE")) {
        if (Pattern.compile("Overall: PASSED").matcher(analysisOutput).find()) {
            showInfoNotification("Overall: PASSED!");
            requestIdeFocus();
        } else if (!Pattern.compile("Overall: FAILED").matcher(analysisOutput).find()) {
            showErrorNotification("Can't detect analysis result. Try to run it manually.");
        } else {
            Pattern errorsCountPattern = Pattern.compile("Overall: FAILED \\((.+)\\)\u001b");
            Pattern urlPattern = Pattern.compile("file:.+full_report.html");
            Matcher errorsCountMatcher = errorsCountPattern.matcher(analysisOutput);
            Matcher urlMatcher = urlPattern.matcher(analysisOutput);
            if (errorsCountMatcher.find() && urlMatcher.find()) {
                showErrorNotification(String.format("Analysis failed: %s", errorsCountMatcher.group(1)));
                (new OpenUrlHyperlinkInfo(urlMatcher.group())).navigate(project);
            } else {
                showErrorNotification("Can't detect analysis result. Try to run it manually.");
            }
        }
    } else {
        showErrorNotification(analysisOutput);
    }
}
 
開發者ID:arso8,項目名稱:StAnalysisRunner,代碼行數:25,代碼來源:AnalysisTask.java

示例5: getAnalysisOutput

import com.intellij.openapi.progress.ProgressIndicator; //導入依賴的package包/類
@NotNull
private String getAnalysisOutput(@NotNull final ProgressIndicator progressIndicator) throws Exception {
    final List<String> gradlewCommand = System.getProperty("os.name").startsWith("Windows")
            ? Arrays.asList("cmd", "/c", "gradlew.bat", "staticAnalys")
            : Arrays.asList("./gradlew", "staticAnalys");
    gradlewProcess = new ProcessBuilder(gradlewCommand)
            .directory(new File(project.getBasePath()))
            .redirectErrorStream(true)
            .start();
    BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(gradlewProcess.getInputStream()));
    StringBuilder analysisOutputBuilder = new StringBuilder();

    String outputLine;
    while ((outputLine = bufferedReader.readLine()) != null) {
        progressIndicator.setText2(outputLine);
        progressIndicator.checkCanceled();
        analysisOutputBuilder.append(outputLine);
        analysisOutputBuilder.append('\n');
    }

    return analysisOutputBuilder.toString();
}
 
開發者ID:arso8,項目名稱:StAnalysisRunner,代碼行數:23,代碼來源:AnalysisTask.java

示例6: scanAndUpdate

import com.intellij.openapi.progress.ProgressIndicator; //導入依賴的package包/類
/**
 * Scan and update dependency components.
 */
private void scanAndUpdate(boolean quickScan, ProgressIndicator indicator, @Nullable Collection<DataNode<LibraryDependencyData>> libraryDependencies) {
    // Don't scan if Xray is not configured
    if (!GlobalSettings.getInstance().isCredentialsSet()) {
        Utils.notify(logger, "JFrog Xray scan failed", "Xray server is not configured.", NotificationType.ERROR);
        return;
    }
    // Prevent multiple simultaneous scans
    if (!scanInProgress.compareAndSet(false, true)) {
        if (!quickScan) {
            Utils.notify(logger, "JFrog Xray", "Scan already in progress.", NotificationType.INFORMATION);
        }
        return;
    }
    try {
        // Refresh dependencies -> Collect -> Scan and store to cache -> Update view
        refreshDependencies(getRefreshDependenciesCbk(quickScan, indicator), libraryDependencies);
    } finally {
        scanInProgress.set(false);
    }
}
 
開發者ID:JFrogDev,項目名稱:jfrog-idea-plugin,代碼行數:24,代碼來源:ScanManager.java

示例7: asyncScanAndUpdateResults

import com.intellij.openapi.progress.ProgressIndicator; //導入依賴的package包/類
/**
 * Launch async dependency scan.
 */
public void asyncScanAndUpdateResults(boolean quickScan, @Nullable Collection<DataNode<LibraryDependencyData>> libraryDependencies) {
    Task.Backgroundable scanAndUpdateTask = new Task.Backgroundable(project, "Xray: Scanning for Vulnerabilities...") {
        @Override
        public void run(@NotNull ProgressIndicator indicator) {
            scanAndUpdate(quickScan, indicator, libraryDependencies);
            indicator.finishNonCancelableSection();
        }
    };
    // The progress manager is only good for foreground threads.
    if (SwingUtilities.isEventDispatchThread()) {
        ProgressManager.getInstance().run(scanAndUpdateTask);
    } else {
        // Run the scan task when the thread is in the foreground.
        SwingUtilities.invokeLater(() -> ProgressManager.getInstance().run(scanAndUpdateTask));
    }
}
 
開發者ID:JFrogDev,項目名稱:jfrog-idea-plugin,代碼行數:20,代碼來源:ScanManager.java

示例8: OnResult

import com.intellij.openapi.progress.ProgressIndicator; //導入依賴的package包/類
@Override
public void OnResult(String result) {
    int extPos = result.lastIndexOf('/');
    if (extPos < 0 && extPos != result.length() - 1) {
        return;
    }
    String fileName = result.substring(extPos + 1);
    String title = "Download:" + fileName;
    File downloadFile = new File(Constant.CACHE_PATH + "search/" + fileName);
    ProgressManager.getInstance().run(new Task.Backgroundable(project, title) {
        @Override
        public void run(@NotNull ProgressIndicator progressIndicator) {
            try {
                DownloadUtil.downloadAtomically(null, result, downloadFile);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (downloadFile.exists()) {
                Utils.openFileInPanel(downloadFile.getPath(), project);
            }
        }
    });

}
 
開發者ID:pengwei1024,項目名稱:AndroidSourceViewer,代碼行數:25,代碼來源:GlobalSearchAction.java

示例9: filterElements

import com.intellij.openapi.progress.ProgressIndicator; //導入依賴的package包/類
@Override
public boolean filterElements(@NotNull ChooseByNameBase base, @NotNull String pattern, boolean everywhere, @NotNull ProgressIndicator indicator, @NotNull Processor<Object> consumer) {
    Collection<SearchResultElement> elements = getAllFilterItems();

    if (elements != null) {
        for (SearchResultElement element : elements) {
            String value = element.getValue();

            if (value == null) {
                return false;
            }

            if (value.toLowerCase().contains(pattern.toLowerCase()) && !consumer.process(element)) {
                return false;
            }
        }
    }

    return false;
}
 
開發者ID:hoai265,項目名稱:SearchResourcePlugin,代碼行數:21,代碼來源:SearchResultItemProvider.java

示例10: afterCheck

import com.intellij.openapi.progress.ProgressIndicator; //導入依賴的package包/類
@Override
public void afterCheck(@NotNull Project project, @NotNull Task task) {
  Course course = task.getLesson().getCourse();
  if (!(course instanceof RemoteCourse && course.isAdaptive())) {
    return;
  }
  if (myStatusBeforeCheck == StudyStatus.Solved) {
    return;
  }
  StudyStatus statusAfterCheck = task.getStatus();
  if (statusAfterCheck != StudyStatus.Solved) {
    return;
  }
  ProgressManager.getInstance().run(new com.intellij.openapi.progress.Task.Backgroundable(project, EduAdaptiveStepicConnector.LOADING_NEXT_RECOMMENDATION, false,
                                                                                          PerformInBackgroundOption.DEAF) {
    @Override
    public void run(@NotNull ProgressIndicator indicator) {
      indicator.setIndeterminate(true);
      EduAdaptiveStepicConnector.addNextRecommendedTask(project, task.getLesson(), indicator, EduAdaptiveStepicConnector.NEXT_RECOMMENDATION_REACTION);
    }
  });
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:23,代碼來源:EduNextRecommendationCheckListener.java

示例11: mouseClicked

import com.intellij.openapi.progress.ProgressIndicator; //導入依賴的package包/類
@Override
public void mouseClicked(MouseEvent e) {
  if (e.getClickCount() == 1 && isEnabled()) {
    final com.jetbrains.edu.learning.courseFormat.tasks.Task task = StudyUtils.getCurrentTask(myProject);
    if (task != null && task.getStatus() != StudyStatus.Solved) {
      final ProgressIndicatorBase progress = new ProgressIndicatorBase();
      progress.setText(EduAdaptiveStepicConnector.LOADING_NEXT_RECOMMENDATION);
      ProgressManager.getInstance().run(new Task.Backgroundable(myProject,
                                                                EduAdaptiveStepicConnector.LOADING_NEXT_RECOMMENDATION) {
        @Override
        public void run(@NotNull ProgressIndicator indicator) {
          StepicAdaptiveReactionsPanel.this.setEnabledRecursive(false);
          ApplicationManager.getApplication().invokeLater(()->setBackground(UIUtil.getLabelBackground()));
          EduAdaptiveStepicConnector.addNextRecommendedTask(StepicAdaptiveReactionsPanel.this.myProject, task.getLesson(), indicator,
                                                            myReaction);
          StepicAdaptiveReactionsPanel.this.setEnabledRecursive(true);
        }
      });
    }
  }
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:22,代碼來源:StepicAdaptiveReactionsPanel.java

示例12: isUpToDate

import com.intellij.openapi.progress.ProgressIndicator; //導入依賴的package包/類
public boolean isUpToDate() {
  if (id == 0) return true;
  if (!EduNames.STUDY.equals(courseMode)) return true;

  ProgressManager.getInstance().runProcessWithProgressAsynchronously(new Backgroundable(null, "Updating Course") {
    @Override
    public void run(@NotNull ProgressIndicator indicator) {
      final Date date = EduStepicConnector.getCourseUpdateDate(id);
      if (date == null) return;
      if (date.after(myUpdateDate)) {
        isUpToDate = false;
      }
      for (Lesson lesson : lessons) {
        if (!lesson.isUpToDate()) {
          isUpToDate = false;
        }
      }
    }
  }, new EmptyProgressIndicator());

  return isUpToDate;
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:23,代碼來源:RemoteCourse.java

示例13: actionPerformed

import com.intellij.openapi.progress.ProgressIndicator; //導入依賴的package包/類
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
  final IdeView view = e.getData(LangDataKeys.IDE_VIEW);
  final Project project = e.getData(CommonDataKeys.PROJECT);
  if (view == null || project == null) {
    return;
  }
  final String courseId = Messages.showInputDialog("Please, enter course id", "Get Course From Stepik", null);
  if (StringUtil.isNotEmpty(courseId)) {
    ProgressManager.getInstance().run(new Task.Modal(project, "Creating Course", true) {
      @Override
      public void run(@NotNull final ProgressIndicator indicator) {
        createCourse(project, courseId);
      }
    });
  }
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:18,代碼來源:CCGetCourseFromStepic.java

示例14: dropResolveCacheRegularly

import com.intellij.openapi.progress.ProgressIndicator; //導入依賴的package包/類
private static void dropResolveCacheRegularly(ProgressIndicator indicator, final Project project) {
    if (indicator instanceof ProgressIndicatorEx) {
        ((ProgressIndicatorEx)indicator).addStateDelegate(new ProgressIndicatorBase() {
            volatile long lastCleared = System.currentTimeMillis();

            public void setFraction(double fraction) {
                super.setFraction(fraction);
                long current = System.currentTimeMillis();
                if (current - this.lastCleared >= 500L) {
                    this.lastCleared = current;
                    PsiManager.getInstance(project).dropResolveCaches();
                }

            }
        });
    }

}
 
開發者ID:niorgai,項目名稱:Android-Resource-Usage-Count,代碼行數:19,代碼來源:FindUsageUtils.java

示例15: processNamesByPattern

import com.intellij.openapi.progress.ProgressIndicator; //導入依賴的package包/類
private static void processNamesByPattern(@NotNull final ChooseByNameBase base,
                                          @NotNull final String[] names,
                                          @NotNull final String pattern,
                                          final ProgressIndicator indicator,
                                          @NotNull final Consumer<MatchResult> consumer) {
  final MinusculeMatcher matcher = buildPatternMatcher(pattern, NameUtil.MatchingCaseSensitivity.NONE);
  Processor<String> processor = new Processor<String>() {
    @Override
    public boolean process(String name) {
      ProgressManager.checkCanceled();
      MatchResult result = matches(base, pattern, matcher, name);
      if (result != null) {
        consumer.consume(result);
      }
      return true;
    }
  };
  if (!JobLauncher.getInstance().invokeConcurrentlyUnderProgress(Arrays.asList(names), indicator, false, true, processor)) {
    throw new ProcessCanceledException();
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:22,代碼來源:DefaultChooseByNameItemProvider.java


注:本文中的com.intellij.openapi.progress.ProgressIndicator類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。