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); if (shouldGenerate(resource, context)) { try { generator.doGenerate(resource, fileSystemAccess); } catch (RuntimeException e) { if (e.getCause() instanceof CoreException) { throw (CoreException) e.getCause(); } throw e; } } }
/** @since 2.4 */ protected PackageFragmentRootData initializeData(final IPackageFragmentRoot root) { final PackageFragmentRootData data = new PackageFragmentRootData(computeModificationStamp(root)); data.addRoot(root); try { final SourceAttachmentPackageFragmentRootWalker<Void> walker = new SourceAttachmentPackageFragmentRootWalker<Void>() { @Override protected URI getURI( IFile file, org.eclipse.xtext.ui.resource.PackageFragmentRootWalker.TraversalState state) { if (!uriValidator.isPossiblyManaged(file)) return null; return super.getURI(file, state); } @Override protected URI getURI( IJarEntryResource jarEntry, org.eclipse.xtext.ui.resource.PackageFragmentRootWalker.TraversalState state) { if (!uriValidator.isPossiblyManaged(jarEntry)) return null; final URI uri = locator.getURI(root, jarEntry, state); if (!uriValidator.isValid(uri, jarEntry)) return null; return uri; } @Override protected Void handle( URI uri, IStorage storage, org.eclipse.xtext.ui.resource.PackageFragmentRootWalker.TraversalState state) { data.uri2Storage.put(uri, storage); return null; } }; walker.traverse(root, false); if (walker.getBundleSymbolicName() != null) data.uriPrefix = URI.createPlatformResourceURI(walker.getBundleSymbolicName() + "/", true); } catch (RuntimeException e) { log.error(e.getMessage(), e); } catch (JavaModelException e) { log.debug(e.getMessage(), e); } return data; }