Package org.eclipse.core.runtime

Examples of org.eclipse.core.runtime.OperationCanceledException


            projectHandle.create(description,
                    new SubProgressMonitor(monitor, 1000));

            if (monitor.isCanceled()) {
                throw new OperationCanceledException();
            }

            projectHandle.open(new SubProgressMonitor(monitor, 1000));
        } finally {
            monitor.done();
View Full Code Here


                throw e;
            }
        }

        if (monitor.isCanceled()) {
            throw new OperationCanceledException();
        }
    }
View Full Code Here

            // kicks off a build before the project is fully configured. This
            // results in MCSProjectNature#getPolicySourcePath() throwing an
            // IllegalStateException. Subsequent builds should succeed (the
            // data will be populated by then) so we just cancel this build.
            // See vbm 2006042816 in mantis for more details.
            throw new OperationCanceledException(e.toString());
        }

        return result;
    }
View Full Code Here

            return false;
        } finally {
            numberOfScannedElements++;
        }
        if (progressMonitor.isCanceled())
            throw new OperationCanceledException(SearchMessages.TextSearchVisitor_canceled);

        return true;
    }
View Full Code Here

            if (end != start) {
                matches.add(new Match(elementMatch, start, end - start));
            }
            if (k++ == 20) {
                if (progressMonitor.isCanceled()) {
                    throw new OperationCanceledException(SearchMessages.TextSearchVisitor_canceled);
                }
                k = 0;
            }
        }
        return matches;
View Full Code Here

            protected void execute(IProgressMonitor monitor) throws CoreException {
                try {
                    monitor.beginTask("", 3000);
                    newProject.create(description, new SubProgressMonitor(monitor, 1000));
                    if (monitor.isCanceled()) {
                        throw new OperationCanceledException();
                    }
                    newProject.open(IResource.BACKGROUND_REFRESH, new SubProgressMonitor(monitor, 1000));
                    newProject.refreshLocal(IResource.DEPTH_INFINITE, new SubProgressMonitor(monitor, 1000));
                } finally {
                    monitor.done();
View Full Code Here

      final ZipOutputStream stream = new ZipOutputStream(fOut);

      if (monitor.isCanceled()) {
        // Nothing written, just close and cancel
        stream.close();
        throw new OperationCanceledException();
      }

      // Add each file to the zip stream
      for (int i = 0; i < fExports.length; ++i) {
        final IFile file = fExports[i];
        // Verify file is child of root
        if (!fRoot.getFullPath().isPrefixOf(file.getFullPath())) {
          throw new IllegalArgumentException(fRoot + " is not a parent of " + file); //$NON-NLS-1$
        }

        // Read file contents
        String filename = file.getFullPath().toPortableString();
        final String cutPath = fRoot.getFullPath().addTrailingSeparator().toPortableString();
        filename = filename.substring(cutPath.length());

        monitor.subTask("Adding " + filename);
        final byte[] fileContents = readContents(file, new SubProgressMonitor(monitor, SCALE));

        // Add contents to zip file
        final ZipEntry entry = new ZipEntry(filename);
        // file.getModificationStamp() seems to use a different semantic
        // for the timestamp
        entry.setTime(file.getLocation().toFile().lastModified());
        if (fCompress) {
          entry.setMethod(ZipEntry.DEFLATED);
        } else {
          entry.setMethod(ZipEntry.STORED);
          entry.setSize(fileContents.length);
          final CRC32 checksumCalculator = new CRC32();
          checksumCalculator.update(fileContents);
          entry.setCrc(checksumCalculator.getValue());
        }
        stream.putNextEntry(entry);
        stream.write(fileContents);
        monitor.worked(SCALE);

        if (monitor.isCanceled()) {
          // Close zip file and remove it, then terminate
          stream.close();
          pearFile.delete();
          throw new OperationCanceledException();
        }
      }

      stream.close();
    } catch (final FileNotFoundException exception) {
View Full Code Here

      final ZipOutputStream stream = new ZipOutputStream(fOut);

      if (monitor.isCanceled()) {
        // Nothing written, just close and cancel
        stream.close();
        throw new OperationCanceledException();
      }

      // Add each file to the zip stream
      for (int i = 0; i < fExports.length; ++i) {
        final IFile file = fExports[i];
        // Verify file is child of root
        if (!fRoot.getFullPath().isPrefixOf(file.getFullPath())) {
          throw new IllegalArgumentException(fRoot + " is not a parent of " + file); //$NON-NLS-1$
        }

        // Read file contents
        String filename = file.getFullPath().toPortableString();
        final String cutPath = fRoot.getFullPath().addTrailingSeparator().toPortableString();
        filename = filename.substring(cutPath.length());

        monitor.subTask("Adding " + filename);
        final byte[] fileContents = readContents(file, new SubProgressMonitor(monitor, SCALE));

        // Add contents to zip file
        final ZipEntry entry = new ZipEntry(filename);
        // file.getModificationStamp() seems to use a different semantic
        // for the timestamp
        entry.setTime(file.getLocation().toFile().lastModified());
        if (fCompress) {
          entry.setMethod(ZipEntry.DEFLATED);
        } else {
          entry.setMethod(ZipEntry.STORED);
          entry.setSize(fileContents.length);
          final CRC32 checksumCalculator = new CRC32();
          checksumCalculator.update(fileContents);
          entry.setCrc(checksumCalculator.getValue());
        }
        stream.putNextEntry(entry);
        stream.write(fileContents);
        monitor.worked(SCALE);

        if (monitor.isCanceled()) {
          // Close zip file and remove it, then terminate
          stream.close();
          pearFile.delete();
          throw new OperationCanceledException();
        }
      }

      stream.close();
    } catch (final FileNotFoundException exception) {
View Full Code Here

  public void validate(IRegion dirtyRegion, IValidationContext helper, IReporter reporter) {
    if (helper == null || fDocument == null || !fEnableSourceValidation)
      return;

    if ((reporter != null) && (reporter.isCancelled() == true)) {
      throw new OperationCanceledException();
    }

    IStructuredModel model = StructuredModelManager.getModelManager().getExistingModelForRead(fDocument);
    if (model == null)
      return; // error
View Full Code Here

  public void validate(IRegion dirtyRegion, IValidationContext helper, IReporter reporter) {
    if (helper == null || fDocument == null || !fEnableSourceValidation)
      return;

    if ((reporter != null) && (reporter.isCancelled() == true)) {
      throw new OperationCanceledException();
    }

    IStructuredModel model = StructuredModelManager.getModelManager().getExistingModelForRead(fDocument);
    if (model == null)
      return;
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.