当前位置: 首页>>代码示例>>Java>>正文


Java ProcessCanceledException类代码示例

本文整理汇总了Java中com.intellij.openapi.progress.ProcessCanceledException的典型用法代码示例。如果您正苦于以下问题:Java ProcessCanceledException类的具体用法?Java ProcessCanceledException怎么用?Java ProcessCanceledException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ProcessCanceledException类属于com.intellij.openapi.progress包,在下文中一共展示了ProcessCanceledException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getLocations

import com.intellij.openapi.progress.ProcessCanceledException; //导入依赖的package包/类
@Override
public Set<String> getLocations(@NotNull @NonNls final String namespace, @NotNull final XmlFile context) throws ProcessCanceledException {
    Set<String> locations = new HashSet<>();
    final Module module = ModuleUtil.findModuleForPsiElement(context);
    if (module == null) {
        return null;
    }
    try {
        final Map<String, XmlFile> schemas = getSchemas(module);
        for (Map.Entry<String, XmlFile> entry : schemas.entrySet()) {
            final String s = getNamespace(entry.getValue(), context.getProject());
            if (s != null && s.equals(namespace)) {
                if (!entry.getKey().contains("mule-httpn.xsd"))
                    locations.add(entry.getKey()); //Observe the formatting rules
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return locations;
}
 
开发者ID:machaval,项目名称:mule-intellij-plugins,代码行数:22,代码来源:MuleSchemaProvider.java

示例2: getSchemas

import com.intellij.openapi.progress.ProcessCanceledException; //导入依赖的package包/类
@NotNull
public Map<String, XmlFile> getSchemas(@NotNull final Module module) throws ProcessCanceledException {
    final Project project = module.getProject();
    final CachedValuesManager manager = CachedValuesManager.getManager(project);
    final Map<String, XmlFile> bundle = manager.getCachedValue(module, SCHEMAS_BUNDLE_KEY, new CachedValueProvider<Map<String, XmlFile>>() {
        public Result<Map<String, XmlFile>> compute() {
            try {
                return computeSchemas(module);
            } catch (ProcessCanceledException pce) {
                throw pce;
            } catch (Exception e) {
                //e.printStackTrace();
                return null;
            }
        }
    }, false);
    return bundle == null ? Collections.<String, XmlFile>emptyMap() : bundle;
}
 
开发者ID:machaval,项目名称:mule-intellij-plugins,代码行数:19,代码来源:MuleSchemaProvider.java

示例3: getItemsWithTimeout

import com.intellij.openapi.progress.ProcessCanceledException; //导入依赖的package包/类
/**
 * Runs the getter under a progress indicator that cancels itself after a certain timeout (assumes
 * that the getter will check for cancellation cooperatively).
 *
 * @param getter computes the GotoRelatedItems.
 * @return a list of items computed, or Optional.empty if timed out.
 */
private Optional<List<? extends GotoRelatedItem>> getItemsWithTimeout(
    ThrowableComputable<List<? extends GotoRelatedItem>, RuntimeException> getter) {
  try {
    ProgressIndicator indicator = new ProgressIndicatorBase();
    ProgressIndicator wrappedIndicator =
        new WatchdogIndicator(indicator, TIMEOUT_MS, TimeUnit.MILLISECONDS);
    // We don't use "runProcessWithProgressSynchronously" because that pops up a ProgressWindow,
    // and that will cause the event IDs to bump up and no longer match the event ID stored in
    // DataContexts which may be used in one of the GotoRelatedProvider#getItems overloads.
    return Optional.of(
        ProgressManager.getInstance()
            .runProcess(() -> ReadAction.compute(getter), wrappedIndicator));
  } catch (ProcessCanceledException e) {
    return Optional.empty();
  }
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:24,代码来源:DelegatingSwitchToHeaderOrSourceProvider.java

示例4: processNamesByPattern

import com.intellij.openapi.progress.ProcessCanceledException; //导入依赖的package包/类
private static void processNamesByPattern(@NotNull final ChooseByNameBase base,
                                          @NotNull final String[] names,
                                          @NotNull final String pattern,
                                          final ProgressIndicator indicator,
                                          @NotNull final Consumer<MatchResult> consumer) {
  final MinusculeMatcher matcher = buildPatternMatcher(pattern, NameUtil.MatchingCaseSensitivity.NONE);
  Processor<String> processor = new Processor<String>() {
    @Override
    public boolean process(String name) {
      ProgressManager.checkCanceled();
      MatchResult result = matches(base, pattern, matcher, name);
      if (result != null) {
        consumer.consume(result);
      }
      return true;
    }
  };
  if (!JobLauncher.getInstance().invokeConcurrentlyUnderProgress(Arrays.asList(names), indicator, false, true, processor)) {
    throw new ProcessCanceledException();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:DefaultChooseByNameItemProvider.java

示例5: consume

import com.intellij.openapi.progress.ProcessCanceledException; //导入依赖的package包/类
@Override
public void consume(final Status status) throws SVNException {
  checkCanceled();
  final File ioFile = status.getFile();
  checkIfCopyRootWasReported(status);

  VirtualFile vFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(ioFile);
  if (vFile != null && isIgnoredByVcs(vFile)) return;
  if (myProject.isDisposed()) throw new ProcessCanceledException();

  if (vFile != null && status.is(StatusType.STATUS_UNVERSIONED)) {
    if (vFile.isDirectory()) {
      if (!FileUtil.filesEqual(myCurrentItem.getPath().getIOFile(), ioFile)) {
        myQueue.add(createItem(VcsUtil.getFilePath(vFile), Depth.INFINITY, true));
      }
    }
    else {
      myReceiver.processUnversioned(vFile);
    }
  }
  else {
    myReceiver.process(VcsUtil.getFilePath(ioFile, status.getKind().isDirectory()), status);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:SvnRecursiveStatusWalker.java

示例6: affectDirectUsages

import com.intellij.openapi.progress.ProcessCanceledException; //导入依赖的package包/类
private void affectDirectUsages(final PsiField psiField, final int fieldAccessFlags, final boolean ignoreAccessScope, final Set<String> affectedPaths) throws ProcessCanceledException {
  ApplicationManager.getApplication().runReadAction(new Runnable() {
    public void run() {
      if (psiField.isValid()) {
        final PsiFile fieldContainingFile = psiField.getContainingFile();
        final Set<PsiFile> processedFiles = new HashSet<PsiFile>();
        if (fieldContainingFile != null) {
          processedFiles.add(fieldContainingFile);
        }
        // if field is invalid, the file might be changed, so next time it is compiled,
        // the constant value change, if any, will be processed
        final Collection<PsiReferenceExpression> references = doFindReferences(psiField, fieldAccessFlags, ignoreAccessScope);
        for (final PsiReferenceExpression ref : references) {
          final PsiElement usage = ref.getElement();
          final PsiFile containingPsi = usage.getContainingFile();
          if (containingPsi != null && processedFiles.add(containingPsi)) {
            final VirtualFile vFile = containingPsi.getOriginalFile().getVirtualFile();
            if (vFile != null) {
              affectedPaths.add(vFile.getPath());
            }
          }
        }
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:DefaultMessageHandler.java

示例7: writeFile

import com.intellij.openapi.progress.ProcessCanceledException; //导入依赖的package包/类
public static void writeFile(final String folder, @NonNls final String fileName, CharSequence buf, final Project project) {
  try {
    HTMLExporter.writeFileImpl(folder, fileName, buf);
  }
  catch (IOException e) {
    Runnable showError = new Runnable() {
      @Override
      public void run() {
        final String fullPath = folder + File.separator + fileName;
        Messages.showMessageDialog(
          project,
          InspectionsBundle.message("inspection.export.error.writing.to", fullPath),
          InspectionsBundle.message("inspection.export.results.error.title"),
          Messages.getErrorIcon()
        );
      }
    };
    ApplicationManager.getApplication().invokeLater(showError, ModalityState.NON_MODAL);
    throw new ProcessCanceledException();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:HTMLExportUtil.java

示例8: build

import com.intellij.openapi.progress.ProcessCanceledException; //导入依赖的package包/类
@NotNull
public static GraphLayoutImpl build(@NotNull LinearGraph graph, @NotNull Comparator<Integer> headerNodeIndexComparator) {
  List<Integer> heads = new ArrayList<Integer>();
  for (int i = 0; i < graph.nodesCount(); i++) {
    if (getUpNodes(graph, i).size() == 0) {
      heads.add(i);
    }
  }
  try {
    heads = ContainerUtil.sorted(heads, headerNodeIndexComparator);
  }
  catch (ProcessCanceledException pce) {
    throw pce;
  }
  catch (Exception e) {
    // protection against possible comparator flaws
    LOG.error(e);
  }
  GraphLayoutBuilder builder = new GraphLayoutBuilder(graph, heads, new DfsUtil());
  return builder.build();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:GraphLayoutBuilder.java

示例9: filterValidationException

import com.intellij.openapi.progress.ProcessCanceledException; //导入依赖的package包/类
public boolean filterValidationException(Exception ex) {
  if (ex instanceof ProcessCanceledException) throw (ProcessCanceledException)ex;
  if (ex instanceof XmlResourceResolver.IgnoredResourceException) throw (XmlResourceResolver.IgnoredResourceException)ex;

  if (ex instanceof FileNotFoundException ||
        ex instanceof MalformedURLException ||
        ex instanceof NoRouteToHostException ||
        ex instanceof SocketTimeoutException ||
        ex instanceof UnknownHostException ||
        ex instanceof ConnectException
        ) {
    // do not log problems caused by malformed and/or ignored external resources
    return true;
  }

  if (ex instanceof NullPointerException) {
    return true; // workaround for NPE at org.apache.xerces.impl.dtd.XMLDTDProcessor.checkDeclaredElements
  }

  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:ErrorReporter.java

示例10: visitPriorityElementsAndInit

import com.intellij.openapi.progress.ProcessCanceledException; //导入依赖的package包/类
@NotNull
private List<InspectionContext> visitPriorityElementsAndInit(@NotNull Map<LocalInspectionToolWrapper, Set<String>> toolToSpecifiedLanguageIds,
                                                             @NotNull final InspectionManager iManager,
                                                             final boolean isOnTheFly,
                                                             @NotNull final ProgressIndicator indicator,
                                                             @NotNull final List<PsiElement> elements,
                                                             @NotNull final LocalInspectionToolSession session,
                                                             @NotNull List<LocalInspectionToolWrapper> wrappers,
                                                             @NotNull final Set<String> elementDialectIds) {
  final List<InspectionContext> init = new ArrayList<InspectionContext>();
  List<Map.Entry<LocalInspectionToolWrapper, Set<String>>> entries = new ArrayList<Map.Entry<LocalInspectionToolWrapper, Set<String>>>(toolToSpecifiedLanguageIds.entrySet());

  Processor<Map.Entry<LocalInspectionToolWrapper, Set<String>>> processor =
    new Processor<Map.Entry<LocalInspectionToolWrapper, Set<String>>>() {
      @Override
      public boolean process(final Map.Entry<LocalInspectionToolWrapper, Set<String>> pair) {
        LocalInspectionToolWrapper toolWrapper = pair.getKey();
        Set<String> dialectIdsSpecifiedForTool = pair.getValue();
        return runToolOnElements(toolWrapper, dialectIdsSpecifiedForTool, iManager, isOnTheFly, indicator, elements, session, init, elementDialectIds);
      }
    };
  boolean result = JobLauncher.getInstance().invokeConcurrentlyUnderProgress(entries, indicator, myFailFastOnAcquireReadAction, processor);
  if (!result) throw new ProcessCanceledException();
  inspectInjectedPsi(elements, isOnTheFly, indicator, iManager, true, wrappers);
  return init;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:LocalInspectionsPass.java

示例11: updateWithMap

import com.intellij.openapi.progress.ProcessCanceledException; //导入依赖的package包/类
protected void updateWithMap(final int inputId,
                             @NotNull UpdateData<Key, Value> updateData) throws StorageException {
  getWriteLock().lock();
  try {
    try {
      ValueContainerImpl.ourDebugIndexInfo.set(myIndexId);
      updateData.iterateRemovedOrUpdatedKeys(inputId, myRemoveStaleKeyOperation);
      updateData.iterateAddedKeys(inputId, myAddedKeyProcessor);
      updateData.save(inputId);
    }
    catch (ProcessCanceledException pce) {
      throw pce; // extra care
    }
    catch (Throwable e) { // e.g. IOException, AssertionError
      throw new StorageException(e);
    }
    finally {
      ValueContainerImpl.ourDebugIndexInfo.set(null);
    }
  }
  finally {
    getWriteLock().unlock();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:MapReduceIndex.java

示例12: waitForAvailableBytes

import com.intellij.openapi.progress.ProcessCanceledException; //导入依赖的package包/类
private int waitForAvailableBytes() throws IOException {
  while (size() == 0 && !myAtEndOfStream) {
    try {
      notify();
      wait(TIMEOUT);
    }
    catch (InterruptedException e) {
      throw new IOException(e.getLocalizedMessage());
    }
    if (size() == 0 && !myAtEndOfStream) {
      if (myCvsCommandStopper.isAborted()) {
        throw new ProcessCanceledException();
      }
    }
  }
  if (myException != null) throw myException;
  if (myAtEndOfStream && (size() == 0)) {
    return END_OF_STREAM;
  }
  return -2;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:ReadThread.java

示例13: runInterruptibly

import com.intellij.openapi.progress.ProcessCanceledException; //导入依赖的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

示例14: upgradeIfNeeded

import com.intellij.openapi.progress.ProcessCanceledException; //导入依赖的package包/类
private void upgradeIfNeeded(final MessageBus bus) {
  final MessageBusConnection connection = bus.connect();
  connection.subscribe(ChangeListManagerImpl.LISTS_LOADED, new LocalChangeListsLoadedListener() {
    @Override
    public void processLoadedLists(final List<LocalChangeList> lists) {
      if (lists.isEmpty()) return;
      try {
        ChangeListManager.getInstance(myProject).setReadOnly(SvnChangeProvider.ourDefaultListName, true);

        if (!myConfiguration.changeListsSynchronized()) {
          processChangeLists(lists);
        }
      }
      catch (ProcessCanceledException e) {
        //
      }
      finally {
        myConfiguration.upgrade();
      }

      connection.disconnect();
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:SvnVcs.java

示例15: getLocalPath

import com.intellij.openapi.progress.ProcessCanceledException; //导入依赖的package包/类
public static FilePath getLocalPath(final Project project, final FilePath filePath) {
  // check if the file has just been renamed (IDEADEV-15494)
  Change change = ApplicationManager.getApplication().runReadAction(new Computable<Change>() {
    @Override
    @Nullable
    public Change compute() {
      if (project.isDisposed()) throw new ProcessCanceledException();
      return ChangeListManager.getInstance(project).getChange(filePath);
    }
  });
  if (change != null) {
    final ContentRevision beforeRevision = change.getBeforeRevision();
    final ContentRevision afterRevision = change.getAfterRevision();
    if (beforeRevision != null && afterRevision != null && !beforeRevision.getFile().equals(afterRevision.getFile()) &&
        beforeRevision.getFile().equals(filePath)) {
      return afterRevision.getFile();
    }
  }
  return filePath;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ChangesUtil.java


注:本文中的com.intellij.openapi.progress.ProcessCanceledException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。