Package org.eclipse.core.runtime

Examples of org.eclipse.core.runtime.OperationCanceledException


  return false;
}
protected void worked(IProgressMonitor monitor, int work) {
  if (monitor != null) {
    if (monitor.isCanceled()) {
      throw new OperationCanceledException();
    } else {
      monitor.worked(work);
    }
  }
}
View Full Code Here


    pathBuffer.append('/');
  }
  String packPath= this.getElementName().replace('.', '/');
  pathBuffer.append(packPath).append('/').append(JavadocConstants.PACKAGE_FILE_NAME);
 
  if (monitor != null && monitor.isCanceled()) throw new OperationCanceledException();
  final String contents = getURLContents(String.valueOf(pathBuffer));
  if (monitor != null && monitor.isCanceled()) throw new OperationCanceledException();
  if (contents == null) throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.CANNOT_RETRIEVE_ATTACHED_JAVADOC, this));
  synchronized (projectInfo.javadocCache) {
    projectInfo.javadocCache.put(this, contents);
  }
  return contents;
View Full Code Here

   
  }
  protected void worked(IProgressMonitor monitor, int work) {
    if (monitor != null) {
      if (monitor.isCanceled()) {
        throw new OperationCanceledException();
      } else {
        monitor.worked(work);
      }
    }
  }
View Full Code Here

      // Get document path access restriction from java search scope
      // Note that requestor has to verify if needed whether the document violates the access restriction or not
      AccessRuleSet access = javaSearchScope.getAccessRuleSet(relativePath, index.containerPath);
      if (access != JavaSearchScope.NOT_ENCLOSED) { // scope encloses the path
        if (!requestor.acceptIndexMatch(documentPath, this, participant, access))
          throw new OperationCanceledException();
      }
    } else if (scope.encloses(documentPath)) {
      if (!requestor.acceptIndexMatch(documentPath, this, participant, null))
        throw new OperationCanceledException();
    }
  }
View Full Code Here

    // Get document path access restriction from java search scope
    // Note that requestor has to verify if needed whether the document violates the access restriction or not
    AccessRuleSet access = javaSearchScope.getAccessRuleSet(relativePath, index.containerPath);
    if (access != JavaSearchScope.NOT_ENCLOSED) { // scope encloses the path
      if (!requestor.acceptIndexMatch(documentPath, this, participant, access))
        throw new OperationCanceledException();
    }
  } else if (scope.encloses(documentPath)) {
    if (!requestor.acceptIndexMatch(documentPath, this, participant, null))
      throw new OperationCanceledException();
  }
}
View Full Code Here

  }
 
  // open the parent if necessary
  openParent(info, newElements, monitor);
  if (monitor != null && monitor.isCanceled())
    throw new OperationCanceledException();

   // puts the info before building the structure so that questions to the handle behave as if the element existed
   // (case of compilation units becoming working copies)
  newElements.put(this, info);
View Full Code Here

          case IJob.CancelIfNotReady :
            if (VERBOSE)
              Util.verbose("-> NOT READY - cancelling - " + searchJob); //$NON-NLS-1$
            if (VERBOSE)
              Util.verbose("CANCELED concurrent job - " + searchJob); //$NON-NLS-1$
            throw new OperationCanceledException();
 
          case IJob.WaitUntilReady :
            IProgressMonitor subProgress = null;
            try {
              int totalWork = 1000;
              if (progress != null) {
                subProgress = new SubProgressMonitor(progress, concurrentJobWork * 8 / 10);
                subProgress.beginTask("", totalWork); //$NON-NLS-1$
                concurrentJobWork = concurrentJobWork * 2 / 10;
              }
              // use local variable to avoid potential NPE (see bug 20435 NPE when searching java method
              // and bug 42760 NullPointerException in JobManager when searching)
              Thread t = this.processingThread;
              int originalPriority = t == null ? -1 : t.getPriority();
              try {
                if (t != null)
                  t.setPriority(Thread.currentThread().getPriority());
                synchronized(this) {
                  this.awaitingClients++;
                }
                IJob previousJob = null;
                int awaitingJobsCount;
                int lastJobsCount = totalWork;
                float lastWorked = 0;
                float totalWorked = 0;
                while ((awaitingJobsCount = awaitingJobsCount()) > 0) {
                  if (subProgress != null && subProgress.isCanceled())
                    throw new OperationCanceledException();
                  IJob currentJob = currentJob();
                  // currentJob can be null when jobs have been added to the queue but job manager is not enabled
                  if (currentJob != null && currentJob != previousJob) {
                    if (VERBOSE)
                      Util.verbose("-> NOT READY - waiting until ready - " + searchJob);//$NON-NLS-1$
View Full Code Here

public void ensureReadyToRun() {
  if (!this.areIndexesReady)
    getIndexes(null/*progress*/); // may trigger some index recreation
}
public boolean execute(IProgressMonitor progressMonitor) {
  if (progressMonitor != null && progressMonitor.isCanceled()) throw new OperationCanceledException();

  boolean isComplete = COMPLETE;
  executionTime = 0;
  Index[] indexes = getIndexes(progressMonitor);
  try {
    int max = indexes.length;
    if (progressMonitor != null)
      progressMonitor.beginTask("", max); //$NON-NLS-1$
    for (int i = 0; i < max; i++) {
      isComplete &= search(indexes[i], progressMonitor);
      if (progressMonitor != null) {
        if (progressMonitor.isCanceled()) throw new OperationCanceledException();
        progressMonitor.worked(1);
      }
    }
    if (JobManager.VERBOSE)
      Util.verbose("-> execution time: " + executionTime + "ms - " + this);//$NON-NLS-1$//$NON-NLS-2$
View Full Code Here

  int length = indexLocations.length;
  Index[] indexes = new Index[length];
  int count = 0;
  IndexManager indexManager = JavaModelManager.getJavaModelManager().getIndexManager();
  for (int i = 0; i < length; i++) {
    if (progressMonitor != null && progressMonitor.isCanceled()) throw new OperationCanceledException();
    // may trigger some index recreation work
    IPath indexLocation = indexLocations[i];
    Index index = indexManager.getIndex(indexLocation);
    if (index == null) {
      // only need containerPath if the index must be built
View Full Code Here

    System.arraycopy(indexes, 0, indexes=new Index[count], 0, count);
  return indexes;
public boolean search(Index index, IProgressMonitor progressMonitor) {
  if (index == null) return COMPLETE;
  if (progressMonitor != null && progressMonitor.isCanceled()) throw new OperationCanceledException();

  ReadWriteMonitor monitor = index.monitor;
  if (monitor == null) return COMPLETE; // index got deleted since acquired
  try {
    monitor.enterRead(); // ask permission to read
View Full Code Here

TOP

Related Classes of org.eclipse.core.runtime.OperationCanceledException

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.