Package com.intellij.openapi.progress

Examples of com.intellij.openapi.progress.ProcessCanceledException


                                    hasPackage && fileIndex.isInSource(sourceFile) ? fileIndex.getSourceRootForFile(sourceFile) :
                                    fileIndex.isInContent(sourceFile) ? fileIndex.getContentRootForFile(sourceFile) :
                                    getFirstElement(hasPackage && sourceRoots.length > 0? sourceRoots : contentRoots);
    if (virtualRoot == null) {
      fail(project, sourceFile, "Unable to guess target source root");
      throw new ProcessCanceledException();
    }
    try {
      boolean newGenRoot = !fileIndex.isInSourceContent(virtualRoot);
      final String relativePath = (hasPackage && newGenRoot? "gen." + targetPackage :
                                  hasPackage ? targetPackage :
                                  newGenRoot ? "gen" : "").replace('.', '/');
      if (relativePath.isEmpty()) {
        return virtualRoot;
      }
      else {
        VirtualFile result = new WriteAction<VirtualFile>() {
          @Override
          protected void run(@NotNull Result<VirtualFile> result) throws Throwable {
            result.setResult(VfsUtil.createDirectoryIfMissing(virtualRoot, relativePath));
          }
        }.execute().throwException().getResultObject();
        LocalFileSystem.getInstance().refreshFiles(Collections.singleton(result));
        return returnRoot && newGenRoot? ObjectUtils.assertNotNull(virtualRoot.findChild("gen")) :
               returnRoot ? virtualRoot : result;
      }
    }
    catch (Exception ex) {
      fail(project, sourceFile, ex.getMessage());
      throw new ProcessCanceledException();
    }
  }
View Full Code Here


  static void fail(@NotNull Project project, @NotNull VirtualFile sourceFile, @NotNull String message) {
    Notifications.Bus.notify(new Notification(
      BnfConstants.GENERATION_GROUP,
      sourceFile.getName(), message,
      NotificationType.ERROR), project);
    throw new ProcessCanceledException();
  }
View Full Code Here

          if (progressIndicator == null) {
            process.run(new NullProgressIndicator(){
              @Override
              public void checkCanceled() {
                super.checkCanceled();
                throw new ProcessCanceledException();
              }
            });
          } else {
            progressIndicator.pushState();
            process.run(new jetbrains.communicator.ide.ProgressIndicator() {
View Full Code Here

          if (result && initialOffset <= caretOffset && finalOffset > caretOffset ||
              !result && initialOffset <= caretOffset && tokenEndOffset > caretOffset) {
            boolean inWhitespace = isTokenExpression(node) &&
                                   initialOffset <= caretOffset && tokenStartOffset > caretOffset;
            if (!processor.process(node, result && !inWhitespace)) {
              throw new ProcessCanceledException();
            }
          }
        }
        return result;
      }
View Full Code Here

        try {
          action.execute(myObject);
          myTree.fireExecuted(myObject);
        }
        catch (ProcessCanceledException e) {
          throw new ProcessCanceledException(e);
        }
        catch (Throwable e) {
          LOG.error(e);
        }
View Full Code Here

  public void waitFor() {
    try {
      waitForUnsafe();
    }
    catch (InterruptedException e) {
      throw new ProcessCanceledException(e);
    }
  }
View Full Code Here

  public boolean waitFor(final long msTimeout)  {
    try {
      return waitForUnsafe(msTimeout);
    }
    catch (InterruptedException e) {
      throw new ProcessCanceledException(e);
    }
  }
View Full Code Here

TOP

Related Classes of com.intellij.openapi.progress.ProcessCanceledException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.