当前位置: 首页>>代码示例>>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;未经允许,请勿转载。