本文整理匯總了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();
}
}