本文整理汇总了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();
}
示例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);
}
}
示例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());
}
}
示例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;
}
示例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);
}
示例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);
}
}
}
示例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();
}
}
示例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;
}
示例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;
}
示例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();
}
}
示例11: close
import com.intellij.openapi.progress.ProgressIndicator; //导入方法依赖的package包/类
protected void close() {
final ProgressIndicator progress = myBuilder.getUi().getProgress();
if (progress != null) {
progress.cancel();
}
}
示例12: cancel
import com.intellij.openapi.progress.ProgressIndicator; //导入方法依赖的package包/类
private static void cancel() {
final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
if (indicator != null) {
indicator.cancel();
}
}