コード例 #1
0
  /** @since 2.7 */
  protected void doBuild(
      List<IResourceDescription.Delta> deltas,
      Map<String, OutputConfiguration> outputConfigurations,
      Map<OutputConfiguration, Iterable<IMarker>> generatorMarkers,
      IBuildContext context,
      EclipseResourceFileSystemAccess2 access,
      IProgressMonitor progressMonitor)
      throws CoreException {
    final int numberOfDeltas = deltas.size();
    SubMonitor subMonitor =
        SubMonitor.convert(progressMonitor, numberOfDeltas / MONITOR_CHUNK_SIZE + 1);
    SubMonitor currentMonitor = null;
    int clusterIndex = 0;
    for (int i = 0; i < numberOfDeltas; i++) {
      IResourceDescription.Delta delta = deltas.get(i);

      if (subMonitor.isCanceled()) {
        throw new OperationCanceledException();
      }
      if (i % 10 == 0) {
        subMonitor.subTask(
            "Compiling chunk "
                + (i / MONITOR_CHUNK_SIZE + 1)
                + " of "
                + (numberOfDeltas / MONITOR_CHUNK_SIZE + 1));
        currentMonitor = subMonitor.newChild(1);
        access.setMonitor(currentMonitor);
      }
      if (logger.isDebugEnabled()) {
        logger.debug("Compiling " + delta.getUri() + " (" + i + " of " + numberOfDeltas + ")");
      }
      if (delta.getNew() != null
          && !clusteringPolicy.continueProcessing(
              context.getResourceSet(), delta.getUri(), clusterIndex)) {
        clearResourceSet(context.getResourceSet());
        clusterIndex = 0;
      }

      Set<IFile> derivedResources =
          getDerivedResources(delta, outputConfigurations, generatorMarkers);
      access.setPostProcessor(getPostProcessor(delta, context, derivedResources));

      if (doGenerate(delta, context, access)) {
        clusterIndex++;
        access.flushSourceTraces();
      }

      cleanDerivedResources(delta, derivedResources, context, access, currentMonitor);
    }
  }
コード例 #2
0
 protected void handleChangedContents(
     Delta delta, IBuildContext context, EclipseResourceFileSystemAccess2 fileSystemAccess)
     throws CoreException {
   // TODO: we will run out of memory here if the number of deltas is large enough
   Resource resource = context.getResourceSet().getResource(delta.getUri(), true);
   saveResourceStorage(resource, fileSystemAccess);
   if (shouldGenerate(resource, context)) {
     try {
       registerCurrentSourceFolder(context, delta, fileSystemAccess);
       generator.doGenerate(resource, fileSystemAccess);
     } catch (RuntimeException e) {
       if (e.getCause() instanceof CoreException) {
         throw (CoreException) e.getCause();
       }
       throw e;
     }
   }
 }