本文整理匯總了Java中com.intellij.openapi.progress.ProgressIndicator.isCanceled方法的典型用法代碼示例。如果您正苦於以下問題:Java ProgressIndicator.isCanceled方法的具體用法?Java ProgressIndicator.isCanceled怎麽用?Java ProgressIndicator.isCanceled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.openapi.progress.ProgressIndicator
的用法示例。
在下文中一共展示了ProgressIndicator.isCanceled方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: expandNext
import com.intellij.openapi.progress.ProgressIndicator; //導入方法依賴的package包/類
private void expandNext(final NodeElement[] elements, final int index, final ProgressIndicator indicator, final ActionCallback callback) {
if (indicator.isCanceled()) {
callback.setRejected();
return;
}
if (index >= elements.length) {
callback.setDone();
return;
}
getBuilder().expand(elements[index], new Runnable() {
@Override
public void run() {
expandNext(elements, index + 1, indicator, callback);
}
});
}
示例2: initStateFrom
import com.intellij.openapi.progress.ProgressIndicator; //導入方法依賴的package包/類
@Override
public synchronized void initStateFrom(@NotNull final ProgressIndicator indicator) {
myRunning = indicator.isRunning();
myCanceled = indicator.isCanceled();
myFraction = indicator.getFraction();
myIndeterminate = indicator.isIndeterminate();
myText = indicator.getText();
myText2 = indicator.getText2();
myFraction = indicator.getFraction();
if (indicator instanceof ProgressIndicatorStacked) {
ProgressIndicatorStacked stacked = (ProgressIndicatorStacked)indicator;
myNonCancelableCount = stacked.getNonCancelableCount();
myTextStack = new Stack<String>(stacked.getTextStack());
myText2Stack = new Stack<String>(stacked.getText2Stack());
myFractionStack = new DoubleArrayList(stacked.getFractionStack());
}
myShouldStartActivity = false;
}
示例3: waitForFreeConnections
import com.intellij.openapi.progress.ProgressIndicator; //導入方法依賴的package包/類
private void waitForFreeConnections() throws SVNException {
synchronized (myLock) {
while (myCurrentlyActiveConnections >= CachingSvnRepositoryPool.ourMaxTotal && ! myDisposed) {
try {
myLock.wait(500);
}
catch (InterruptedException e) {
//
}
ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
if (indicator != null && indicator.isCanceled()) {
throw new SVNException(SVNErrorMessage.create(SVNErrorCode.CANCELLED));
}
}
}
}
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:17,代碼來源:ApplicationLevelNumberConnectionsGuardImpl.java
示例4: run
import com.intellij.openapi.progress.ProgressIndicator; //導入方法依賴的package包/類
@Override
public void run(@NotNull ProgressIndicator indicator) {
indicator.setIndeterminate(true);
while (!myFuture.isDone()) {
try {
myFuture.get(200, TimeUnit.MILLISECONDS);
}
catch (Exception ignored) {
// all we need to know is whether the future completed or not..
}
if (indicator.isCanceled()) {
return;
}
}
}
示例5: isAborted
import com.intellij.openapi.progress.ProgressIndicator; //導入方法依賴的package包/類
public boolean isAborted() {
myPing = true;
if (myLastError != null) throw new CvsProcessException(myLastError);
if (myIndirectCancel) return true;
final ProgressIndicator progressIndicator = getProgressIndicator();
if (progressIndicator == null) return false;
return progressIndicator.isCanceled();
}
示例6: optimizeImportsOnTheFlyLater
import com.intellij.openapi.progress.ProgressIndicator; //導入方法依賴的package包/類
private void optimizeImportsOnTheFlyLater(@NotNull final ProgressIndicator progress) {
if ((myHasRedundantImports || myHasMissortedImports) && !progress.isCanceled()) {
// schedule optimise action at the time of session disposal, which is after all applyInformation() calls
Disposable invokeFixLater = new Disposable() {
@Override
public void dispose() {
// later because should invoke when highlighting is finished
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
if (myProject.isDisposed() || !myFile.isValid() || !myFile.isWritable()) return;
IntentionAction optimizeImportsFix = QuickFixFactory.getInstance().createOptimizeImportsFix(true);
if (optimizeImportsFix.isAvailable(myProject, null, myFile)) {
optimizeImportsFix.invoke(myProject, null, myFile);
}
}
});
}
};
Disposer.register((DaemonProgressIndicator)progress, invokeFixLater);
if (progress.isCanceled()) {
Disposer.dispose(invokeFixLater);
Disposer.dispose((DaemonProgressIndicator)progress);
progress.checkCanceled();
}
}
}
示例7: replaceDuplicate
import com.intellij.openapi.progress.ProgressIndicator; //導入方法依賴的package包/類
private static void replaceDuplicate(final Project project, final Map<PsiMember, List<Match>> duplicates, final Set<PsiMember> methods) {
final ProgressIndicator progressIndicator = ProgressManager.getInstance().getProgressIndicator();
if (progressIndicator != null && progressIndicator.isCanceled()) return;
final Runnable replaceRunnable = new Runnable() {
@Override
public void run() {
LocalHistoryAction a = LocalHistory.getInstance().startAction(REFACTORING_NAME);
try {
for (final PsiMember member : methods) {
final List<Match> matches = duplicates.get(member);
if (matches == null) continue;
final int duplicatesNo = matches.size();
WindowManager.getInstance().getStatusBar(project).setInfo(getStatusMessage(duplicatesNo));
CommandProcessor.getInstance().executeCommand(project, new Runnable() {
@Override
public void run() {
PostprocessReformattingAspect.getInstance(project).postponeFormattingInside(new Runnable() {
@Override
public void run() {
final MatchProvider matchProvider =
member instanceof PsiMethod ? new MethodDuplicatesMatchProvider((PsiMethod)member, matches)
: new ConstantMatchProvider(member, project, matches);
DuplicatesImpl.invoke(project, matchProvider);
}
});
}
}, REFACTORING_NAME, REFACTORING_NAME);
WindowManager.getInstance().getStatusBar(project).setInfo("");
}
}
finally {
a.finish();
}
}
};
ApplicationManager.getApplication().invokeLater(replaceRunnable, ModalityState.NON_MODAL);
}
示例8: run
import com.intellij.openapi.progress.ProgressIndicator; //導入方法依賴的package包/類
public void run(Project project, final ModalityContext executor) {
initializeListeners();
try {
internalRun(project, executor, runInReadThread());
} finally {
cleanupListeners();
}
if (isCanceled()) throw new ProcessCanceledException();
final ProgressIndicator progress = getProgress();
if (progress != null) {
if (progress.isCanceled()) throw new ProcessCanceledException();
}
}
示例9: doWait
import com.intellij.openapi.progress.ProgressIndicator; //導入方法依賴的package包/類
private void doWait(ProgressIndicator progressIndicator) {
while (!myHandler.waitFor(500)) {
if (progressIndicator.isCanceled()) {
myHandler.destroyProcess();
break;
}
}
}
示例10: addFiles
import com.intellij.openapi.progress.ProgressIndicator; //導入方法依賴的package包/類
private void addFiles(VirtualFile repo, Collection<VirtualFile> files, @Nullable ProgressIndicator indicator) {
final List<List<String>> chunks = VcsFileUtil.chunkFiles(repo, files);
int currentChunk = 0;
for (List<String> paths : chunks) {
if (indicator != null) {
if (indicator.isCanceled()) { return; }
indicator.setFraction((double)currentChunk / chunks.size());
currentChunk++;
}
new HgCommandExecutor(myProject).executeInCurrentThread(repo, "add", paths);
}
}
示例11: checkCancelled
import com.intellij.openapi.progress.ProgressIndicator; //導入方法依賴的package包/類
@Override
public void checkCancelled() throws SVNCancelException {
final ProgressManager pm = ProgressManager.getInstance();
final ProgressIndicator pi = pm.getProgressIndicator();
if (pi != null) {
if (pi.isCanceled()) throw new SVNCancelException();
}
ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
if (indicator != null && indicator.isCanceled()) {
throw new SVNCancelException();
}
}
示例12: collectAndShowDuplicates
import com.intellij.openapi.progress.ProgressIndicator; //導入方法依賴的package包/類
private static void collectAndShowDuplicates(final Project project) {
final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
if (indicator != null && !indicator.isCanceled()) {
indicator.setText("Collecting project images...");
indicator.setIndeterminate(false);
final List<VirtualFile> images = new ArrayList<VirtualFile>();
for (String ext : IMAGE_EXTENSIONS) {
images.addAll(FilenameIndex.getAllFilesByExt(project, ext));
}
final Map<Long, Set<VirtualFile>> duplicates = new HashMap<Long, Set<VirtualFile>>();
final Map<Long, VirtualFile> all = new HashMap<Long, VirtualFile>();
for (int i = 0; i < images.size(); i++) {
indicator.setFraction((double)(i + 1) / (double)images.size());
final VirtualFile file = images.get(i);
if (!(file.getFileSystem() instanceof LocalFileSystem)) continue;
final long length = file.getLength();
if (all.containsKey(length)) {
if (!duplicates.containsKey(length)) {
final HashSet<VirtualFile> files = new HashSet<VirtualFile>();
files.add(all.get(length));
duplicates.put(length, files);
}
duplicates.get(length).add(file);
} else {
all.put(length, file);
}
indicator.checkCanceled();
}
showResults(project, images, duplicates, all);
}
}
示例13: run
import com.intellij.openapi.progress.ProgressIndicator; //導入方法依賴的package包/類
@Override
public void run(@NotNull ProgressIndicator indicator) {
int elapsedTime = 0; // elapsed time in seconds
indicator.setIndeterminate(true);
while (true) {
try {
if (myCompletionLatch.await(1, TimeUnit.SECONDS)) {
break;
}
// update elapsed time in seconds
elapsedTime++;
indicator.setText(String.format("Recording...%1$d %2$s elapsed", elapsedTime, StringUtil.pluralize("second", elapsedTime)));
if (indicator.isCanceled()) {
// explicitly cancel the running task
myReceiver.cancel();
indicator.setText("Stopping...");
// Wait for an additional second to make sure that the command
// completed and screen recorder finishes writing the output
myCompletionLatch.await(1, TimeUnit.SECONDS);
break;
}
}
catch (InterruptedException ignored) {
}
}
}
示例14: analyze
import com.intellij.openapi.progress.ProgressIndicator; //導入方法依賴的package包/類
public void analyze() {
final ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(getProject()).getFileIndex();
getScope().accept(new PsiRecursiveElementVisitor() {
@Override public void visitFile(PsiFile file) {
if (file instanceof PsiJavaFile) {
PsiJavaFile psiJavaFile = (PsiJavaFile)file;
if (getScope().contains(psiJavaFile)) {
final PsiPackage aPackage = findPackage(psiJavaFile.getPackageName());
if (aPackage != null) {
myPackages.put(psiJavaFile.getPackageName(), aPackage);
}
}
final Set<PsiPackage> packs = getPackageHierarhy(psiJavaFile.getPackageName());
final ForwardDependenciesBuilder builder = new ForwardDependenciesBuilder(getProject(), new AnalysisScope(psiJavaFile));
builder.setTotalFileCount(getScope().getFileCount());
builder.setInitialFileCount(++myFileCount);
builder.analyze();
final Set<PsiFile> psiFiles = builder.getDependencies().get(psiJavaFile);
if (psiFiles == null) return;
for (PsiPackage pack : packs) {
Set<PsiPackage> pack2Packages = myPackageDependencies.get(pack);
if (pack2Packages == null) {
pack2Packages = new HashSet<PsiPackage>();
myPackageDependencies.put(pack, pack2Packages);
}
for (PsiFile psiFile : psiFiles) {
if (!(psiFile instanceof PsiJavaFile) ||
!projectFileIndex.isInSourceContent(psiFile.getVirtualFile()) ||
!getScope().contains(psiFile)) {
continue;
}
// construct dependent packages
final String packageName = ((PsiJavaFile)psiFile).getPackageName();
//do not depend on parent packages
if (packageName.startsWith(pack.getQualifiedName())) {
continue;
}
final PsiPackage depPackage = findPackage(packageName);
if (depPackage == null) { //not from analyze scope
continue;
}
pack2Packages.add(depPackage);
constractFilesInDependenciesPackagesMap(pack, depPackage, psiFile, myFilesInDependentPackages);
constractFilesInDependenciesPackagesMap(depPackage, pack, psiJavaFile, myBackwardFilesInDependentPackages);
constractWholeDependenciesMap(psiJavaFile, psiFile);
}
}
}
}
});
ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
if (indicator != null) {
if (indicator.isCanceled()) {
throw new ProcessCanceledException();
}
indicator.setText(AnalysisScopeBundle.message("cyclic.dependencies.progress.text"));
indicator.setText2("");
indicator.setIndeterminate(true);
}
myCyclicDependencies = getCycles(myPackages.values());
}
示例15: finish
import com.intellij.openapi.progress.ProgressIndicator; //導入方法依賴的package包/類
@CalledInAwt
private static void finish(@NotNull Runnable result, @NotNull ProgressIndicator indicator) {
if (indicator.isCanceled()) return;
result.run();
indicator.stop();
}