Java Code Examples for com.intellij.openapi.progress.ProgressIndicator.startNonCancelableSection()

The following are Jave code examples for showing how to use startNonCancelableSection() of the com.intellij.openapi.progress.ProgressIndicator class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: intellij-ce-playground   File:   Source Code and License Vote up 5 votes
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) : 
  if(document != null) {
    synchronizer.startTransaction(myProject, document, changeScope);
Example 2
Project: intellij-ce-playground   File:   Source Code and License Vote up 5 votes
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) {
    VirtualFile repository =
    if (repository == null) {
    try {
      HgUpdater updater = new HgRegularUpdater(project, repository, updateConfiguration);
      result &= updater.update(updatedFiles, indicator, exceptions);
    } catch (VcsException e) {
      //TODO include module name where exception occurred
    if (indicator != null) {
  return new UpdateSessionAdapter(exceptions, !result);