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


Java ProgressIndicator.cancel方法代碼示例

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


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

示例1: cancelAndRestartDaemonLater

import com.intellij.openapi.progress.ProgressIndicator; //導入方法依賴的package包/類
private static void cancelAndRestartDaemonLater(@NotNull ProgressIndicator progress,
                                                @NotNull final Project project) throws ProcessCanceledException {
  progress.cancel();
  JobScheduler.getScheduler().schedule(new Runnable() {

    @Override
    public void run() {
      Application application = ApplicationManager.getApplication();
      if (!project.isDisposed() && !application.isDisposed() && !application.isUnitTestMode()) {
        ApplicationManager.getApplication().invokeLater(new Runnable() {
          @Override
          public void run() {
            DaemonCodeAnalyzer.getInstance(project).restart();
          }
        }, project.getDisposed());
      }
    }
  }, RESTART_DAEMON_RANDOM.nextInt(100), TimeUnit.MILLISECONDS);
  throw new ProcessCanceledException();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:21,代碼來源:GeneralHighlightingPass.java

示例2: runInterruptibly

import com.intellij.openapi.progress.ProgressIndicator; //導入方法依賴的package包/類
public void runInterruptibly(@NotNull ProgressIndicator progress,
                             @NotNull Runnable onCancel,
                             @NotNull Runnable runnable) throws ProcessCanceledException {
  Disposable disposable = addPsiListener(progress);
  try {
    progress.checkCanceled();
    ProgressManager.getInstance().executeProcessUnderProgress(runnable, progress);
  }
  catch (ProcessCanceledException e) {
    progress.cancel();
    //reschedule for later
    onCancel.run();
    throw e;
  }
  finally {
    Disposer.dispose(disposable);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:19,代碼來源:SliceManager.java

示例3: run

import com.intellij.openapi.progress.ProgressIndicator; //導入方法依賴的package包/類
@Override
public void run(@NotNull final ProgressIndicator progressIndicator) {
    isRunning = true;
    progressIndicator.setIndeterminate(true);

    try {
        runAnalysis(progressIndicator);
    } catch (final ProcessCanceledException canceledException) {
        progressIndicator.cancel();
    } catch (final Exception exception) {
        showErrorNotification("Exception: " + exception.getMessage());
    }
}
 
開發者ID:arso8,項目名稱:StAnalysisRunner,代碼行數:14,代碼來源:AnalysisTask.java

示例4: cancelTask

import com.intellij.openapi.progress.ProgressIndicator; //導入方法依賴的package包/類
private static boolean cancelTask(@Nullable ImplementationsUpdaterTask task) {
  if (task != null) {
    ProgressIndicator indicator = task.myIndicator;
    if (indicator != null) {
      indicator.cancel();
    }
    return task.setCanceled();
  }
  return false;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:11,代碼來源:ShowImplementationsAction.java

示例5: actionPerformed

import com.intellij.openapi.progress.ProgressIndicator; //導入方法依賴的package包/類
@Override
public final void actionPerformed(final AnActionEvent e) {
  final HierarchyTreeBuilder builder = getCurrentBuilder();
  final AbstractTreeUi treeUi = builder != null ? builder.getUi() : null;
  final ProgressIndicator progress = treeUi != null ? treeUi.getProgress() : null;
  if (progress != null) {
    progress.cancel();
  }
  myContent.getManager().removeContent(myContent, true);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:11,代碼來源:HierarchyBrowserBase.java

示例6: cancel

import com.intellij.openapi.progress.ProgressIndicator; //導入方法依賴的package包/類
/**
 * Cancels the wizard.
 */
public void cancel() {
  ProgressIndicator indicator = myCurrentProgressIndicator.get();
  if (indicator == null) {
    myWizard.doCancelAction();
  }
  else {
    indicator.cancel();
    JButton button = myActionToButtonMap.get(myCancelAction);
    if (button != null) {
      button.setEnabled(false);
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:17,代碼來源:FirstRunWizardHost.java

示例7: doCancelAction

import com.intellij.openapi.progress.ProgressIndicator; //導入方法依賴的package包/類
@Override
public final void doCancelAction() {
  ProgressIndicator indicator = myCurrentProgressIndicator.get();
  if (indicator != null) {
    indicator.cancel();
  } else {
    myWizard.doCancelAction();
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:10,代碼來源:DialogWrapperHost.java

示例8: setIndicator

import com.intellij.openapi.progress.ProgressIndicator; //導入方法依賴的package包/類
public synchronized void setIndicator(ProgressIndicator i) {
  i.setText(myIndicator.getText());
  i.setText2(myIndicator.getText2());
  i.setFraction(myIndicator.getFraction());
  if (i.isCanceled()) i.cancel();
  myIndicator = i;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:8,代碼來源:MavenProgressIndicator.java

示例9: executeOnPooledThread

import com.intellij.openapi.progress.ProgressIndicator; //導入方法依賴的package包/類
@CalledInAwt
@NotNull
public static ProgressIndicator executeOnPooledThread(@NotNull final Consumer<ProgressIndicator> task, @NotNull Disposable parent) {
  final ModalityState modalityState = ModalityState.current();
  final ProgressIndicator indicator = new EmptyProgressIndicator() {
    @NotNull
    @Override
    public ModalityState getModalityState() {
      return modalityState;
    }
  };
  indicator.start();

  final Disposable disposable = new Disposable() {
    @Override
    public void dispose() {
      if (indicator.isRunning()) indicator.cancel();
    }
  };
  Disposer.register(parent, disposable);

  ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
    @Override
    public void run() {
      ProgressManager.getInstance().executeProcessUnderProgress(new Runnable() {
        @Override
        public void run() {
          try {
            task.consume(indicator);
          }
          finally {
            indicator.stop();
            Disposer.dispose(disposable);
          }
        }
      }, indicator);
    }
  });

  return indicator;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:42,代碼來源:BackgroundTaskUtil.java

示例10: processFiles

import com.intellij.openapi.progress.ProgressIndicator; //導入方法依賴的package包/類
public static void processFiles(final ProgressIndicator indicator,
                                boolean processInReadAction,
                                Collection<VirtualFile> files,
                                Project project, Consumer<FileContent> processor) {
  indicator.checkCanceled();
  final FileContentQueue queue = new FileContentQueue();
  final double total = files.size();
  queue.queue(files, indicator);

  Consumer<VirtualFile> progressUpdater = new Consumer<VirtualFile>() {
    // need set here to handle queue.pushbacks after checkCancelled() in order
    // not to count the same file several times
    final Set<VirtualFile> processed = new THashSet<VirtualFile>();
    private boolean fileNameWasShown;

    @Override
    public void consume(VirtualFile virtualFile) {
      indicator.checkCanceled();
      synchronized (processed) {
        boolean added = processed.add(virtualFile);
        indicator.setFraction(processed.size() / total);
        if (!added || (virtualFile.isValid() && virtualFile.getLength() > FILE_SIZE_TO_SHOW_THRESHOLD)) {
          indicator.setText2(virtualFile.getPresentableUrl());
          fileNameWasShown = true;
        } else if (fileNameWasShown) {
          indicator.setText2("");
          fileNameWasShown = false;
        }
      }
    }
  };

  while (!project.isDisposed()) {
    indicator.checkCanceled();
    // todo wait for the user...
    if (processSomeFilesWhileUserIsInactive(queue, progressUpdater, processInReadAction, project, processor)) {
      break;
    }
  }

  if (project.isDisposed()) {
    indicator.cancel();
    indicator.checkCanceled();
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:46,代碼來源:CacheUpdateRunner.java

示例11: close

import com.intellij.openapi.progress.ProgressIndicator; //導入方法依賴的package包/類
protected void close() {
  final ProgressIndicator progress = myBuilder.getUi().getProgress();
  if (progress != null) {
    progress.cancel();
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:7,代碼來源:SlicePanel.java

示例12: cancel

import com.intellij.openapi.progress.ProgressIndicator; //導入方法依賴的package包/類
private static void cancel() {
  final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
  if (indicator != null) {
    indicator.cancel();
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:7,代碼來源:CommitablePanelUserActivityListener.java


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