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