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


Java ProgressIndicator.startNonCancelableSection方法代码示例

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


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

示例1: startTransaction

import com.intellij.openapi.progress.ProgressIndicator; //导入方法依赖的package包/类
private void startTransaction(@NotNull PomTransaction transaction) {
  final ProgressIndicator progressIndicator = ProgressIndicatorProvider.getGlobalProgressIndicator();
  if(progressIndicator != null) progressIndicator.startNonCancelableSection();
  final PsiDocumentManagerBase manager = (PsiDocumentManagerBase)PsiDocumentManager.getInstance(myProject);
  final PsiToDocumentSynchronizer synchronizer = manager.getSynchronizer();
  final PsiElement changeScope = transaction.getChangeScope();
  LOG.assertTrue(changeScope != null);

  final PsiFile containingFileByTree = getContainingFileByTree(changeScope);
  boolean physical = changeScope.isPhysical();
  if (physical && synchronizer.toProcessPsiEvent() && isDocumentUncommitted(containingFileByTree)) {
    // fail-fast to prevent any psi modifications that would cause psi/document text mismatch
    // PsiToDocumentSynchronizer assertions happen inside event processing and are logged by PsiManagerImpl.fireEvent instead of being rethrown
    // so it's important to throw something outside event processing
    throw new IllegalStateException("Attempt to modify PSI for non-committed Document!");
  }

  if (containingFileByTree != null) {
    ((SmartPointerManagerImpl) SmartPointerManager.getInstance(myProject)).fastenBelts(containingFileByTree.getViewProvider().getVirtualFile());
  }

  BlockSupportImpl.sendBeforeChildrenChangeEvent((PsiManagerImpl)PsiManager.getInstance(myProject), changeScope, true);
  Document document = containingFileByTree == null ? null : 
                      physical ? manager.getDocument(containingFileByTree) : 
                      manager.getCachedDocument(containingFileByTree);
  if(document != null) {
    synchronizer.startTransaction(myProject, document, changeScope);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:PomModelImpl.java

示例2: updateDirectories

import com.intellij.openapi.progress.ProgressIndicator; //导入方法依赖的package包/类
@NotNull
public UpdateSession updateDirectories(@NotNull FilePath[] contentRoots,
  UpdatedFiles updatedFiles, ProgressIndicator indicator,
  @NotNull Ref<SequentialUpdatesContext> context) {
  
  List<VcsException> exceptions = new LinkedList<VcsException>();

  boolean result = true;
  for (FilePath contentRoot : contentRoots) {
    if (indicator != null) {
      indicator.checkCanceled();
      indicator.startNonCancelableSection();
    }
    VirtualFile repository =
      ProjectLevelVcsManager.getInstance(project).getVcsRootFor(contentRoot);
    if (repository == null) {
      continue;
    }
    try {
      HgUpdater updater = new HgRegularUpdater(project, repository, updateConfiguration);
      result &= updater.update(updatedFiles, indicator, exceptions);
    } catch (VcsException e) {
      //TODO include module name where exception occurred
      exceptions.add(e);
    }
    if (indicator != null) {
      indicator.finishNonCancelableSection();
    }
  }
  return new UpdateSessionAdapter(exceptions, !result);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:HgUpdateEnvironment.java


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