当前位置: 首页>>代码示例>>Java>>正文


Java ProgressIndicator.setFraction方法代码示例

本文整理汇总了Java中com.intellij.openapi.progress.ProgressIndicator.setFraction方法的典型用法代码示例。如果您正苦于以下问题:Java ProgressIndicator.setFraction方法的具体用法?Java ProgressIndicator.setFraction怎么用?Java ProgressIndicator.setFraction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.progress.ProgressIndicator的用法示例。


在下文中一共展示了ProgressIndicator.setFraction方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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

示例2: downloadFiles

import com.intellij.openapi.progress.ProgressIndicator; //导入方法依赖的package包/类
private ArrayList<File> downloadFiles(ArrayList<String> fileIds, ProgressIndicator progressIndicator) {
    ArrayList<File> files = new ArrayList<File>();
    progressIndicator.setText("Downloading selected file(s) from NetSuite File Cabinet");

    double numberOfFilesToDownload = fileIds.size();
    double currentFileNumber = 1;

    for (String fileId : fileIds) {
        progressIndicator.setFraction(currentFileNumber/numberOfFilesToDownload);
        progressIndicator.setText("Downloading selected file(s) from NetSuite File Cabinet: " + decimalFormat.format((currentFileNumber/numberOfFilesToDownload) * 100) + "% Complete");
        try {
            File downloadedFile = nsClient.downloadFile(fileId);

            if (downloadedFile != null) {
                files.add(nsClient.downloadFile(fileId));
            }
        } catch (Exception ex) {
            JOptionPane.showMessageDialog(null, "Exception downloading file from NetSuite File Cabinet: " + ex.getMessage(), "ERROR", JOptionPane.ERROR_MESSAGE);
        }
        currentFileNumber++;
    }

    progressIndicator.setFraction(1);
    return files;
}
 
开发者ID:Topher84,项目名称:NetSuite-Tools-For-WebStorm,代码行数:26,代码来源:CompareWithFileCabinetTask.java

示例3: copyToMirror

import com.intellij.openapi.progress.ProgressIndicator; //导入方法依赖的package包/类
@NotNull
private File copyToMirror(@NotNull File original, @NotNull 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;
  }

  if (progress != null) {
    progress.popState();
  }

  return mirror;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:JarHandler.java

示例4: iteration

import com.intellij.openapi.progress.ProgressIndicator; //导入方法依赖的package包/类
@Override
public boolean iteration() {
  final CommonProblemDescriptor descriptor = myDescriptors[myCount++];
  ProgressIndicator indicator = myTask.getIndicator();
  if (indicator != null) {
    indicator.setFraction((double)myCount / myDescriptors.length);
    String presentableText = "usages";
    if (descriptor instanceof ProblemDescriptor) {
      final PsiElement psiElement = ((ProblemDescriptor)descriptor).getPsiElement();
      if (psiElement != null) {
        presentableText = SymbolPresentationUtil.getSymbolPresentableText(psiElement);
      }
    }
    indicator.setText("Processing " + presentableText);
  }
  ApplicationManager.getApplication().runWriteAction(new Runnable() {
    @Override
    public void run() {
      myDocumentManager.commitAllDocuments();
      applyFix(myProject, descriptor);
    }
  });
  return isDone();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:PerformFixesModalTask.java

示例5: iteration

import com.intellij.openapi.progress.ProgressIndicator; //导入方法依赖的package包/类
@Override
public boolean iteration() {
  popUntilCurrentTaskUnfinishedOrNull();

  if (myCurrentTask != null) {
    ProgressIndicator indicator = myProgressTask.getIndicator();
    if (indicator != null) {
      if (myProgressText != null) indicator.setText(myProgressText);
      if (myProgressText2 != null) indicator.setText2(myProgressText2);
      indicator.setFraction((double)myIterationsFinished++ / myTotalIterations);
    }
    myCurrentTask.iteration();
  }

  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:CodeStyleSettingsCodeFragmentFilter.java

示例6: perform

import com.intellij.openapi.progress.ProgressIndicator; //导入方法依赖的package包/类
@NotNull
@Override
protected File perform(@NotNull ProgressIndicator indicator, @NotNull File file) throws WizardException {
  indicator.setText("Moving downloaded SDK");
  indicator.start();
  try {
    File root = getSdkRoot(file);
    if (!root.renameTo(myDestination)) {
      FileUtil.copyDir(root, myDestination);
      FileUtil.delete(root); // Failure to delete it is not critical, the source is in temp folder.
      // No need to abort installation.
    }
    return myDestination;
  }
  catch (IOException e) {
    throw new WizardException("Unable to move Android SDK", e);
  }
  finally {
    indicator.setFraction(1.0);
    indicator.stop();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:InstallComponentsPath.java

示例7: iteration

import com.intellij.openapi.progress.ProgressIndicator; //导入方法依赖的package包/类
@Override
public boolean iteration() {
  final ProgressIndicator indicator = myProgressTask.getIndicator();
  if (indicator != null) {
    indicator.setFraction((double) myIdx/mySize);
  }
  myRunnables.next().run();
  myIdx++;
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:UpdateCopyrightAction.java

示例8: iteration

import com.intellij.openapi.progress.ProgressIndicator; //导入方法依赖的package包/类
@Override
public boolean iteration() {
  final ProgressIndicator indicator = myTask.getIndicator();
  if (indicator != null) {
    indicator.setFraction(((double)myCount) / myTotal);
  }

  NullityInferrer.apply(myProject, myNotNullManager, myInfos[myCount++]);

  return isDone();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:AnnotateTask.java

示例9: execute

import com.intellij.openapi.progress.ProgressIndicator; //导入方法依赖的package包/类
private void execute(@NotNull Collection<VirtualFile> files, @Nullable ProgressIndicator indicator) {
  final Map<VirtualFile, Collection<VirtualFile>> sorted = HgUtil.sortByHgRoots(myProject, files);
  for (Map.Entry<VirtualFile, Collection<VirtualFile>> entry : sorted.entrySet()) {
    if (indicator != null) {
      if (indicator.isCanceled()) { return; }
      indicator.setFraction(0);
      indicator.setText2("Adding files to " + entry.getKey().getPresentableUrl());
    }
    addFiles(entry.getKey(), entry.getValue(), indicator);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:HgAddCommand.java

示例10: initializeProgress

import com.intellij.openapi.progress.ProgressIndicator; //导入方法依赖的package包/类
private void initializeProgress() {
  ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
  if (indicator != null) {
    indicator.setText(IdeBundle.message("loading.editors"));
    indicator.setText2("");
    indicator.setIndeterminate(false);
    indicator.setFraction(0);

    myProgressMaximum = countFiles(mySplittersElement);
    myCurrentProgress = 0;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:EditorsSplitters.java

示例11: generateSkeletonsForList

import com.intellij.openapi.progress.ProgressIndicator; //导入方法依赖的package包/类
private boolean generateSkeletonsForList(@NotNull final PySkeletonRefresher refresher,
                                         ProgressIndicator indicator,
                                         @Nullable final String currentBinaryFilesPath) throws InvalidSdkException {
  final PySkeletonGenerator generator = new PySkeletonGenerator(refresher.getSkeletonsPath(), mySdk, currentBinaryFilesPath);
  indicator.setIndeterminate(false);
  final String homePath = mySdk.getHomePath();
  if (homePath == null) return false;
  GeneralCommandLine cmd = PythonHelper.EXTRA_SYSPATH.newCommandLine(homePath, Lists.newArrayList(myQualifiedName));
  final ProcessOutput runResult = PySdkUtil.getProcessOutput(cmd,
                                                             new File(homePath).getParent(),
                                                             PythonSdkType.getVirtualEnvExtraEnv(homePath), 5000
  );
  if (runResult.getExitCode() == 0 && !runResult.isTimeout()) {
    final String extraPath = runResult.getStdout();
    final PySkeletonGenerator.ListBinariesResult binaries = generator.listBinaries(mySdk, extraPath);
    final List<String> names = Lists.newArrayList(binaries.modules.keySet());
    Collections.sort(names);
    final int size = names.size();
    for (int i = 0; i != size; ++i) {
      final String name = names.get(i);
      indicator.setFraction((double)i / size);
      if (needBinaryList(name)) {
        indicator.setText2(name);
        final PySkeletonRefresher.PyBinaryItem item = binaries.modules.get(name);
        final String modulePath = item != null ? item.getPath() : "";
        //noinspection unchecked
        refresher.generateSkeleton(name, modulePath, new ArrayList<String>(), Consumer.EMPTY_CONSUMER);
      }
    }
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:GenerateBinaryStubsFix.java

示例12: collectAndShowDuplicates

import com.intellij.openapi.progress.ProgressIndicator; //导入方法依赖的package包/类
private static void collectAndShowDuplicates(final Project project) {
  final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
  if (indicator != null && !indicator.isCanceled()) {
    indicator.setText("Collecting project images...");
    indicator.setIndeterminate(false);
    final List<VirtualFile> images = new ArrayList<VirtualFile>();
    for (String ext : IMAGE_EXTENSIONS) {
      images.addAll(FilenameIndex.getAllFilesByExt(project, ext));
    }

    final Map<Long, Set<VirtualFile>> duplicates = new HashMap<Long, Set<VirtualFile>>();
    final Map<Long, VirtualFile> all = new HashMap<Long, VirtualFile>();
    for (int i = 0; i < images.size(); i++) {
      indicator.setFraction((double)(i + 1) / (double)images.size());
      final VirtualFile file = images.get(i);
      if (!(file.getFileSystem() instanceof LocalFileSystem)) continue;
      final long length = file.getLength();
      if (all.containsKey(length)) {
        if (!duplicates.containsKey(length)) {
          final HashSet<VirtualFile> files = new HashSet<VirtualFile>();
          files.add(all.get(length));
          duplicates.put(length, files);
        }
        duplicates.get(length).add(file);
      } else {
        all.put(length, file);
      }
      indicator.checkCanceled();
    }
    showResults(project, images, duplicates, all);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:ShowImageDuplicatesAction.java

示例13: updateIndicator

import com.intellij.openapi.progress.ProgressIndicator; //导入方法依赖的package包/类
private static int updateIndicator(final ProgressIndicator indicator, final int totalCount, int count, final PsiFile psiFile) {
  if (indicator != null) {
    if (indicator.isCanceled()) throw new ProcessCanceledException();
    indicator.setFraction(((double)++count) / totalCount);
    final VirtualFile virtualFile = psiFile.getVirtualFile();
    if (virtualFile != null) {
      indicator.setText(AnalysisScopeBundle.message("find.dependencies.progress.text", virtualFile.getPresentableUrl()));
    }
  }
  return count;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:FindDependencyUtil.java

示例14: update

import com.intellij.openapi.progress.ProgressIndicator; //导入方法依赖的package包/类
private static void update(ProgressIndicator indicator, boolean indeterminate, double fraction) {
  if (indicator instanceof PanelProgressIndicator) {
    ((PanelProgressIndicator)indicator).update(SCANNING_PACKAGES_MESSAGE, indeterminate, fraction);
  } else {
    if (fraction != -1) {
      indicator.setFraction(fraction);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:FileTreeModelBuilder.java

示例15: postCourse

import com.intellij.openapi.progress.ProgressIndicator; //导入方法依赖的package包/类
private static void postCourse(final Project project, @NotNull Course course) {
  if (!checkIfAuthorized(project, "post course")) return;

  final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
  if (indicator != null) {
    indicator.setText("Uploading course to " + EduStepicNames.STEPIC_URL);
    indicator.setIndeterminate(false);
  }
  final HttpPost request = new HttpPost(EduStepicNames.STEPIC_API_URL + "/courses");

  final StepicUser currentUser = EduStepicAuthorizedClient.getCurrentUser();
  if (currentUser != null) {
    final List<StepicUser> courseAuthors = course.getAuthors();
    for (int i = 0; i < courseAuthors.size(); i++) {
      if (courseAuthors.size() > i) {
        final StepicUser courseAuthor = courseAuthors.get(i);
        currentUser.setFirstName(courseAuthor.getFirstName());
        currentUser.setLastName(courseAuthor.getLastName());
      }
    }
    course.setAuthors(Collections.singletonList(currentUser));
  }

  String requestBody = new Gson().toJson(new StepicWrappers.CourseWrapper(course));
  request.setEntity(new StringEntity(requestBody, ContentType.APPLICATION_JSON));

  try {
    final CloseableHttpClient client = EduStepicAuthorizedClient.getHttpClient();
    if (client == null) {
      LOG.warn("Http client is null");
      return;
    }
    final CloseableHttpResponse response = client.execute(request);
    final HttpEntity responseEntity = response.getEntity();
    final String responseString = responseEntity != null ? EntityUtils.toString(responseEntity) : "";
    final StatusLine line = response.getStatusLine();
    EntityUtils.consume(responseEntity);
    if (line.getStatusCode() != HttpStatus.SC_CREATED) {
      final String message = FAILED_TITLE + "course ";
      LOG.error(message + responseString);
      showErrorNotification(project, FAILED_TITLE, responseString);
      return;
    }
    final RemoteCourse postedCourse = new Gson().fromJson(responseString, StepicWrappers.CoursesContainer.class).courses.get(0);
    postedCourse.setLessons(course.getLessons(true));
    postedCourse.setAuthors(course.getAuthors());
    postedCourse.setCourseMode(CCUtils.COURSE_MODE);
    postedCourse.setLanguage(course.getLanguageID());
    final int sectionId = postModule(postedCourse.getId(), 1, String.valueOf(postedCourse.getName()), project);
    int position = 1;
    for (Lesson lesson : course.getLessons()) {
      if (indicator != null) {
        indicator.checkCanceled();
        indicator.setText2("Publishing lesson " + lesson.getIndex());
      }
      final int lessonId = postLesson(project, lesson);
      postUnit(lessonId, position, sectionId, project);
      if (indicator != null) {
        indicator.setFraction((double)lesson.getIndex()/course.getLessons().size());
        indicator.checkCanceled();
      }
      position += 1;
    }
    ApplicationManager.getApplication().runReadAction(() -> postAdditionalFiles(course, project, postedCourse.getId()));
    StudyTaskManager.getInstance(project).setCourse(postedCourse);
    showNotification(project, "Course published");
  }
  catch (IOException e) {
    LOG.error(e.getMessage());
  }
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:72,代码来源:CCStepicConnector.java


注:本文中的com.intellij.openapi.progress.ProgressIndicator.setFraction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。