本文整理汇总了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);
}
}
示例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);
}