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


Java ProgressManager类代码示例

本文整理汇总了Java中com.intellij.openapi.progress.ProgressManager的典型用法代码示例。如果您正苦于以下问题:Java ProgressManager类的具体用法?Java ProgressManager怎么用?Java ProgressManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: execute

import com.intellij.openapi.progress.ProgressManager; //导入依赖的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: generate

import com.intellij.openapi.progress.ProgressManager; //导入依赖的package包/类
@Override
public Set<TSVarExpr> generate(Project project) {
    Set<TSVarExpr> items = new HashSet<>();
    //Search every file in the project
    Collection<VirtualFile> virtualFiles = FileBasedIndex.getInstance().getContainingFiles(FileTypeIndex.NAME, TSFileType.INSTANCE, GlobalSearchScope.projectScope(project));
    for (VirtualFile virtualFile : virtualFiles) {
        TSFile tsFile = (TSFile) PsiManager.getInstance(project).findFile(virtualFile);
        if (tsFile != null) {
            Collection<TSAssignExpr> assignments = PsiTreeUtil.findChildrenOfType(tsFile, TSAssignExpr.class);
            for (TSAssignExpr assignment : assignments) {
                PsiElement first = assignment.getFirstChild();
                if (!(first instanceof TSVarExpr))
                    continue;

                if (((TSVarExpr)first).isLocal())
                    continue;

                items.add((TSVarExpr) first);

            }
        }
        ProgressManager.progress("Loading Symbols");
    }
    return items;
}
 
开发者ID:CouleeApps,项目名称:TS-IJ,代码行数:26,代码来源:TSGlobalCachedListGenerator.java

示例3: asyncScanAndUpdateResults

import com.intellij.openapi.progress.ProgressManager; //导入依赖的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

示例4: OnResult

import com.intellij.openapi.progress.ProgressManager; //导入依赖的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

示例5: beforeProjectGenerated

import com.intellij.openapi.progress.ProgressManager; //导入依赖的package包/类
@Nullable
@Override
public BooleanFunction<PythonProjectGenerator> beforeProjectGenerated(@Nullable Sdk sdk) {
  return generator -> {
    final List<Integer> enrolledCoursesIds = myGenerator.getEnrolledCoursesIds();
    final Course course = myGenerator.getSelectedCourse();
    if (course == null || !(course instanceof RemoteCourse)) return true;
    if (((RemoteCourse)course).getId() > 0 && !enrolledCoursesIds.contains(((RemoteCourse)course).getId())) {
      ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> {
        ProgressManager.getInstance().getProgressIndicator().setIndeterminate(true);
        return StudyUtils.execCancelable(() -> EduStepicConnector.enrollToCourse(((RemoteCourse)course).getId(),
                                                                                 StudySettings.getInstance().getUser()));
      }, "Creating Course", true, ProjectManager.getInstance().getDefaultProject());
    }
    return true;
  };
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:18,代码来源:PyStudyDirectoryProjectGenerator.java

示例6: execCancelable

import com.intellij.openapi.progress.ProgressManager; //导入依赖的package包/类
@Nullable
public static <T> T execCancelable(@NotNull final Callable<T> callable) {
  final Future<T> future = ApplicationManager.getApplication().executeOnPooledThread(callable);

  while (!future.isCancelled() && !future.isDone()) {
    ProgressManager.checkCanceled();
    TimeoutUtil.sleep(500);
  }
  T result = null;
  try {
    result = future.get();
  }
  catch (InterruptedException | ExecutionException e) {
    LOG.warn(e.getMessage());
  }
  return result;
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:18,代码来源:StudyUtils.java

示例7: afterCheck

import com.intellij.openapi.progress.ProgressManager; //导入依赖的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

示例8: doOKAction

import com.intellij.openapi.progress.ProgressManager; //导入依赖的package包/类
@Override
protected void doOKAction() {
  String code = myLoginPanel.getCode();
  if (code == null || code.isEmpty()) return;

  ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> {
    ProgressManager.getInstance().getProgressIndicator().setIndeterminate(true);

    myStepicUser = StudyUtils.execCancelable(() -> EduStepicAuthorizedClient.login(code, EduStepicNames.EXTERNAL_REDIRECT_URL));
    if (myStepicUser != null) {
      doJustOkAction();
    }
    else {
      setError("Login Failed");
    }
  }, myProgressTitle, true, new DefaultProjectFactoryImpl().getDefaultProject());
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:18,代码来源:OAuthDialog.java

示例9: mouseClicked

import com.intellij.openapi.progress.ProgressManager; //导入依赖的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

示例10: isUpToDate

import com.intellij.openapi.progress.ProgressManager; //导入依赖的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

示例11: EduCreateNewStepikProjectDialog

import com.intellij.openapi.progress.ProgressManager; //导入依赖的package包/类
public EduCreateNewStepikProjectDialog(int courseId) {
  this();

  StepicUser user = EduStepicAuthorizedClient.getCurrentUser();
  Project defaultProject = ProjectManager.getInstance().getDefaultProject();
  ApplicationManager.getApplication().invokeAndWait(() ->
    ProgressManager.getInstance()
      .runProcessWithProgressSynchronously(() -> {
        ProgressManager.getInstance().getProgressIndicator().setIndeterminate(true);
        execCancelable(() -> {
          try {
            Course course = EduStepicConnector.getCourseFromStepik(user, courseId);
            if (course != null) {
              setTitle("New Project - " + course.getName());
            }

            setCourse(course);
          }
          catch (IOException e) {
            LOG.warn("Tried to create a project for course with id=" + courseId, e);
          }
          return null;
        });
      }, "Getting Available Courses", true, defaultProject)
  );
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:27,代码来源:EduCreateNewStepikProjectDialog.java

示例12: actionPerformed

import com.intellij.openapi.progress.ProgressManager; //导入依赖的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

示例13: scanForModifiedClassesWithProgress

import com.intellij.openapi.progress.ProgressManager; //导入依赖的package包/类
private Map<DebuggerSession, Map<String, HotSwapFile>> scanForModifiedClassesWithProgress( List<DebuggerSession> sessions, HotSwapProgressImpl progress )
{
  Ref<Map<DebuggerSession, Map<String, HotSwapFile>>> result = Ref.create( null );
  ProgressManager.getInstance().runProcess(
    () -> {
      try
      {
        result.set( scanForModifiedClasses( sessions, progress ) );
      }
      finally
      {
        progress.finished();
      }
    }, progress.getProgressIndicator() );
  return result.get();
}
 
开发者ID:manifold-systems,项目名称:manifold-ij,代码行数:17,代码来源:HotSwapComponent.java

示例14: getAntObjects

import com.intellij.openapi.progress.ProgressManager; //导入依赖的package包/类
@NotNull
public Map<String, Class> getAntObjects() {
  while (true) {
    try {
      final Map<String, Class> map = myFuture.get(100, TimeUnit.MILLISECONDS);
      if (map != null) {
        return map;
      }
    }
    catch (TimeoutException ignore) {
    }
    catch (Exception e) {
      LOG.error(e);
      break;
    }
    ProgressManager.checkCanceled();
  }
  return Collections.emptyMap();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:AntTasksProvider.java

示例15: initRoot

import com.intellij.openapi.progress.ProgressManager; //导入依赖的package包/类
@Nullable
private static SVNURL initRoot(final Project project, final SVNURL url) throws SvnBindException {
  final Ref<SVNURL> result = new Ref<SVNURL>();
  final Ref<SvnBindException> excRef = new Ref<SvnBindException>();

  ProgressManager.getInstance().runProcessWithProgressSynchronously(new Runnable() {
    public void run() {
      try {
        result.set(SvnUtil.getRepositoryRoot(SvnVcs.getInstance(project), url));
      } catch (SvnBindException e) {
        excRef.set(e);
      }
    }
  }, "Detecting repository root", true, project);
  if (! excRef.isNull()) {
    throw excRef.get();
  }
  return result.get();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:SelectLocationDialog.java


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