Java Code Examples for org.eclipse.xtext.resource.impl.ResourceDescriptionChangeEvent#getDeltas()
The following examples show how to use
org.eclipse.xtext.resource.impl.ResourceDescriptionChangeEvent#getDeltas() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractBuilderState.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
@Override public synchronized ImmutableList<IResourceDescription.Delta> update(BuildData buildData, IProgressMonitor monitor) { ensureLoaded(); final SubMonitor subMonitor = SubMonitor.convert(monitor, Messages.AbstractBuilderState_0, 1); subMonitor.subTask(Messages.AbstractBuilderState_0); if (buildData.isEmpty()) return ImmutableList.of(); if (monitor.isCanceled()) throw new OperationCanceledException(); final ResourceDescriptionsData newData = getCopiedResourceDescriptionsData(); final Collection<IResourceDescription.Delta> result = doUpdate(buildData, newData, subMonitor.split(1)); if (monitor.isCanceled()) throw new OperationCanceledException(); final ResourceDescriptionChangeEvent event = new ResourceDescriptionChangeEvent(result); // update the reference setResourceDescriptionsData(newData); notifyListeners(event); return event.getDeltas(); }
Example 2
Source File: MonitoredClusteringBuilderState.java From dsl-devkit with Eclipse Public License 1.0 | 5 votes |
@Override @SuppressWarnings("PMD.AvoidInstanceofChecksInCatchClause") public synchronized ImmutableList<Delta> update(final BuildData buildData, final IProgressMonitor monitor) { ensureLoaded(); final SubMonitor subMonitor = SubMonitor.convert(monitor, org.eclipse.xtext.builder.builderState.Messages.AbstractBuilderState_0, 1); subMonitor.subTask(org.eclipse.xtext.builder.builderState.Messages.AbstractBuilderState_0); checkForCancellation(monitor); final ResourceDescriptionsData newData = getCopiedResourceDescriptionsData(); Collection<IResourceDescription.Delta> result = null; try { result = doUpdate(buildData, newData, subMonitor.newChild(1)); // update the reference setResourceDescriptionsData(newData, monitor); // CHECKSTYLE:CHECK-OFF IllegalCatch } catch (Throwable t) { // CHECKSTYLE:CHECK-ON IllegalCatch if (!operationCanceledManager.isOperationCanceledException(t)) { LOGGER.error("Failed to update index. Executing rollback.", t); //$NON-NLS-1$ } if (newData instanceof AbstractResourceDescriptionsData) { ((AbstractResourceDescriptionsData) newData).rollbackChanges(); } throw t; } final ResourceDescriptionChangeEvent event = new ResourceDescriptionChangeEvent(result); notifyListeners(event); return event.getDeltas(); }
Example 3
Source File: MonitoredClusteringBuilderState.java From dsl-devkit with Eclipse Public License 1.0 | 5 votes |
@Override public synchronized ImmutableList<IResourceDescription.Delta> clean(final Set<URI> toBeRemoved, final IProgressMonitor monitor) { ensureLoaded(); Set<URI> toBeRemovedCopy = ensureNotNull(toBeRemoved); SubMonitor subMonitor = SubMonitor.convert(monitor, org.eclipse.xtext.builder.builderState.Messages.AbstractBuilderState_0, 2); subMonitor.subTask(org.eclipse.xtext.builder.builderState.Messages.AbstractBuilderState_0); if (toBeRemovedCopy.isEmpty()) { return ImmutableList.of(); } checkForCancellation(monitor); Collection<IResourceDescription.Delta> deltas = doClean(toBeRemovedCopy, subMonitor.newChild(1)); final ResourceDescriptionsData newData = getCopiedResourceDescriptionsData(); checkForCancellation(monitor); try { for (IResourceDescription.Delta delta : deltas) { newData.removeDescription(delta.getOld().getURI()); } ResourceDescriptionChangeEvent event = new ResourceDescriptionChangeEvent(deltas); checkForCancellation(monitor); updateDeltas(event.getDeltas(), null, subMonitor.newChild(1)); // update the reference setResourceDescriptionsData(newData, monitor); // CHECKSTYLE:CHECK-OFF IllegalCatch notifyListeners(event); return event.getDeltas(); } catch (Throwable t) { // CHECKSTYLE:CHECK-ON IllegalCatch if (newData instanceof AbstractResourceDescriptionsData) { ((AbstractResourceDescriptionsData) newData).rollbackChanges(); } throw t; } }