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


Java EmptyProgressIndicator类代码示例

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


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

示例1: isUpToDate

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

示例2: actionPerformed

import com.intellij.openapi.progress.EmptyProgressIndicator; //导入依赖的package包/类
public void actionPerformed(final AnActionEvent e) {
  if (myLagging) {
    myLagging = false;
    myAlarm.cancelAllRequests();
  }
  else {
    myLagging = true;
    for (int i = 0; i < 100; i++) {
      new Runnable() {
        @Override
        public void run() {
          DebugUtil.sleep(5);
          ProgressManager.getInstance().runProcessWithProgressAsynchronously(new Task.Backgroundable(null, "lagging") {
            @Override
            public void run(@NotNull ProgressIndicator indicator) {
              DebugUtil.sleep(1);
            }
          }, new EmptyProgressIndicator());
          if (myLagging) {
            myAlarm.addRequest(this, 1);
          }
        }
      }.run();
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:ToggleLaggingModeAction.java

示例3: testProcessorReturningFalseDoesNotCrashTheOtherThread

import com.intellij.openapi.progress.EmptyProgressIndicator; //导入依赖的package包/类
public void testProcessorReturningFalseDoesNotCrashTheOtherThread() {
  final AtomicInteger delay = new AtomicInteger(0);
  final Runnable checkCanceled = new Runnable() {
    @Override
    public void run() {
      ProgressManager.checkCanceled();
    }
  };
  Processor<String> processor = new Processor<String>() {
    @Override
    public boolean process(String s) {
      busySleep(delay.incrementAndGet() % 10 + 10, checkCanceled);
      return delay.get() % 100 != 0;
    }
  };
  for (int i=0; i<100; i++) {
    ProgressIndicator indicator = new EmptyProgressIndicator();
    boolean result = JobLauncher.getInstance()
      .invokeConcurrentlyUnderProgress(Collections.nCopies(10000, ""), indicator, false, false, processor);
    assertFalse(indicator.isCanceled());
    assertFalse(result);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:JobUtilTest.java

示例4: doTest

import com.intellij.openapi.progress.EmptyProgressIndicator; //导入依赖的package包/类
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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:KShortestPathsFinderTest.java

示例5: reparseFile

import com.intellij.openapi.progress.EmptyProgressIndicator; //导入依赖的package包/类
private void reparseFile(final PsiFile file, FileElement treeElement, CharSequence newText) {
  PsiToDocumentSynchronizer synchronizer =((PsiDocumentManagerBase)PsiDocumentManager.getInstance(myProject)).getSynchronizer();
  TextRange changedPsiRange = DocumentCommitProcessor.getChangedPsiRange(file, treeElement, newText);
  if (changedPsiRange == null) return;

  final DiffLog log = BlockSupport.getInstance(myProject).reparseRange(file, changedPsiRange, newText, new EmptyProgressIndicator(),
                                                                       treeElement.getText());
  synchronizer.setIgnorePsiEvents(true);
  try {
    CodeStyleManager.getInstance(file.getProject()).performActionWithFormatterDisabled(new Runnable() {
      @Override
      public void run() {
        runTransaction(new PomTransactionBase(file, getModelAspect(TreeAspect.class)) {
          @Nullable
          @Override
          public PomModelEvent runInner() throws IncorrectOperationException {
            return new TreeAspectEvent(PomModelImpl.this, log.performActualPsiChange(file));
          }
        });
      }
    });
  }
  finally {
    synchronizer.setIgnorePsiEvents(false);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:PomModelImpl.java

示例6: updateExpectAuthCanceled

import com.intellij.openapi.progress.EmptyProgressIndicator; //导入依赖的package包/类
private void updateExpectAuthCanceled(File wc1, String expectedText) {
  Assert.assertTrue(wc1.isDirectory());
  final VirtualFile vf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(wc1);
  final UpdatedFiles files = UpdatedFiles.create();
  final UpdateSession session =
    myVcs.getUpdateEnvironment().updateDirectories(new FilePath[]{VcsUtil.getFilePath(vf)}, files, new EmptyProgressIndicator(),
                                                   new Ref<SequentialUpdatesContext>());
  Assert.assertTrue(session.getExceptions() != null && ! session.getExceptions().isEmpty());
  Assert.assertTrue(!session.isCanceled());
  Assert.assertTrue(session.getExceptions().get(0).getMessage().contains(expectedText));

  if (myIsSecure) {
    ++ myExpectedCreds;
    ++ myExpectedCert;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:SvnNativeClientAuthTest.java

示例7: assertUnversioned

import com.intellij.openapi.progress.EmptyProgressIndicator; //导入依赖的package包/类
private void assertUnversioned(VirtualFile... files) throws VcsException {
  MockChangelistBuilder builder = new MockChangelistBuilder();
  myChangeProvider.getChanges(myDirtyScope, builder, new EmptyProgressIndicator(),
                              new MockChangeListManagerGate(ChangeListManager.getInstance(myProject)));
  List<VirtualFile> unversionedFiles = builder.getUnversionedFiles();
  
  assertEquals(unversionedFiles.size(), files.length, "Incorrect number of unversioned files.");
  for (VirtualFile expected : files) {
    if (!unversionedFiles.contains(expected)) {
      fail("Expected file " + expected + " is not unversioned!");
    }
  }
  for (VirtualFile actual : unversionedFiles) {
    if (ArrayUtil.find(files, actual) < 0) {
      fail("Actually unversioned file " + actual + " is not in the unversioned list!");
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:GitChangeProviderUnversionedTest.java

示例8: updateExpectAuthCanceled

import com.intellij.openapi.progress.EmptyProgressIndicator; //导入依赖的package包/类
private void updateExpectAuthCanceled(File wc1, String expectedText) {
  Assert.assertTrue(wc1.isDirectory());
  final VirtualFile vf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(wc1);
  final UpdatedFiles files = UpdatedFiles.create();
  final UpdateSession session =
    myVcs.getUpdateEnvironment().updateDirectories(new FilePath[]{new FilePathImpl(vf)}, files, new EmptyProgressIndicator(),
                                                   new Ref<SequentialUpdatesContext>());
  Assert.assertTrue(session.getExceptions() != null && ! session.getExceptions().isEmpty());
  Assert.assertTrue(!session.isCanceled());
  Assert.assertTrue(session.getExceptions().get(0).getMessage().contains(expectedText));

  if (myIsSecure) {
    ++ myExpectedCreds;
    ++ myExpectedCert;
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:SvnNativeClientAuthTest.java

示例9: processEvent

import com.intellij.openapi.progress.EmptyProgressIndicator; //导入依赖的package包/类
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);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:27,代码来源:CommitSelectionListener.java

示例10: runUnderDisposeAwareIndicator

import com.intellij.openapi.progress.EmptyProgressIndicator; //导入依赖的package包/类
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);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:21,代码来源:BackgroundTaskUtil.java

示例11: reparseFile

import com.intellij.openapi.progress.EmptyProgressIndicator; //导入依赖的package包/类
@Nullable
private Runnable reparseFile(@Nonnull final PsiFile file, @Nonnull FileElement treeElement, @Nonnull CharSequence newText) {
  TextRange changedPsiRange = ChangedPsiRangeUtil.getChangedPsiRange(file, treeElement, newText);
  if (changedPsiRange == null) return null;

  Runnable reparseLeaf = tryReparseOneLeaf(treeElement, newText, changedPsiRange);
  if (reparseLeaf != null) return reparseLeaf;

  final DiffLog log = BlockSupport.getInstance(myProject).reparseRange(file, treeElement, changedPsiRange, newText, new EmptyProgressIndicator(),
                                                                       treeElement.getText());
  return () -> runTransaction(new PomTransactionBase(file, getModelAspect(TreeAspect.class)) {
    @Override
    public PomModelEvent runInner() throws IncorrectOperationException {
      return new TreeAspectEvent(PomModelImpl.this, log.performActualPsiChange(file));
    }
  });
}
 
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:PomModelImpl.java

示例12: invoke

import com.intellij.openapi.progress.EmptyProgressIndicator; //导入依赖的package包/类
@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");
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:CleanupInspectionIntention.java

示例13: isCheapEnoughToSearch

import com.intellij.openapi.progress.EmptyProgressIndicator; //导入依赖的package包/类
@NotNull
@Override
public SearchCostResult isCheapEnoughToSearch(@NotNull String name,
                                              @NotNull final GlobalSearchScope scope,
                                              @Nullable final PsiFile fileToIgnoreOccurrencesIn,
                                              @Nullable final ProgressIndicator progress) {
  final AtomicInteger count = new AtomicInteger();
  final ProgressIndicator indicator = progress == null ? new EmptyProgressIndicator() : progress;
  final Processor<VirtualFile> processor = new Processor<VirtualFile>() {
    private final VirtualFile virtualFileToIgnoreOccurrencesIn =
      fileToIgnoreOccurrencesIn == null ? null : fileToIgnoreOccurrencesIn.getVirtualFile();

    @Override
    public boolean process(VirtualFile file) {
      indicator.checkCanceled();
      if (Comparing.equal(file, virtualFileToIgnoreOccurrencesIn)) return true;
      final int value = count.incrementAndGet();
      return value < 10;
    }
  };
  List<IdIndexEntry> keys = getWordEntries(name, true);
  boolean cheap = keys.isEmpty() || processFilesContainingAllKeys(myManager.getProject(), scope, null, keys, processor);

  if (!cheap) {
    return SearchCostResult.TOO_MANY_OCCURRENCES;
  }

  return count.get() == 0 ? SearchCostResult.ZERO_OCCURRENCES : SearchCostResult.FEW_OCCURRENCES;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:PsiSearchHelperImpl.java

示例14: ensureCorrectReparse

import com.intellij.openapi.progress.EmptyProgressIndicator; //导入依赖的package包/类
public static void ensureCorrectReparse(@NotNull final PsiFile file) {
  final String psiToStringDefault = DebugUtil.psiToString(file, false, false);

  final String fileText = file.getText();
  final DiffLog diffLog = new BlockSupportImpl(file.getProject()).reparseRange(
    file, TextRange.allOf(fileText), fileText, new EmptyProgressIndicator(), fileText);
  diffLog.performActualPsiChange(file);

  TestCase.assertEquals(psiToStringDefault, DebugUtil.psiToString(file, false, false));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:ParsingTestCase.java

示例15: load

import com.intellij.openapi.progress.EmptyProgressIndicator; //导入依赖的package包/类
@Override
public void load(@Nullable final String configPath) {
  AccessToken token = HeavyProcessLatch.INSTANCE.processStarted("Loading application components");
  try {
    long t = System.currentTimeMillis();
    init(mySplash == null ? null : new EmptyProgressIndicator() {
      @Override
      public void setFraction(double fraction) {
        mySplash.showProgress("", (float)(0.65 + getPercentageOfComponentsLoaded() * 0.35));
      }
    }, new Runnable() {
      @Override
      public void run() {
        // create ServiceManagerImpl at first to force extension classes registration
        getPicoContainer().getComponentInstance(ServiceManagerImpl.class);

        String effectiveConfigPath = FileUtilRt.toSystemIndependentName(configPath == null ? PathManager.getConfigPath() : configPath);
        for (ApplicationLoadListener listener : ApplicationLoadListener.EP_NAME.getExtensions()) {
          try {
            listener.beforeApplicationLoaded(ApplicationImpl.this, effectiveConfigPath);
          }
          catch (Throwable e) {
            LOG.error(e);
          }
        }

        // we set it after beforeApplicationLoaded call, because app store can depends on stream provider state
        ServiceKt.getStateStore(ApplicationImpl.this).setPath(effectiveConfigPath);
      }
    });
    t = System.currentTimeMillis() - t;
    LOG.info(getComponentConfigCount() + " application components initialized in " + t + " ms");
  }
  finally {
    token.finish();
  }
  myLoaded = true;

  createLocatorFile();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:41,代码来源:ApplicationImpl.java


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