public void removeDirtyStateSupport(IDirtyStateEditorSupportClient client) { if (this.currentClient == null || this.currentClient != client) throw new IllegalStateException("Was configured with another client or not configured at all."); //$NON-NLS-1$ client.removeVerifyListener(this); stateChangeEventBroker.removeListener(this); if (dirtyResource.isInitialized()) dirtyStateManager.discardDirtyState(delegatingClientAwareResource); IXtextDocument document = client.getDocument(); if (document == null) document = dirtyResource.getUnderlyingDocument(); if (document != null) { dirtyResource.disconnect(document); document.removeModelListener(this); } this.delegatingClientAwareResource = null; this.currentClient = null; }
public void descriptionsChanged(final IResourceDescription.Event event) { if (!getDirtyResource().isInitialized()) return; for(IResourceDescription.Delta delta: event.getDeltas()) { if (delta.getOld() == getDirtyResource().getDescription() || delta.getNew() == getDirtyResource().getDescription()) return; } scheduleUpdateEditorJob(event); }
public void modelChanged(XtextResource resource) { if (resource == null || !dirtyResource.isInitialized()) return; if (isDirty || ((!resource.isTrackingModification() || resource.isModified()) && currentClient.isDirty() && dirtyStateManager.manageDirtyState(delegatingClientAwareResource))) { synchronized (dirtyStateManager) { IResourceDescription.Manager resourceDescriptionManager = resource.getResourceServiceProvider().getResourceDescriptionManager(); final IResourceDescription newDescription = resourceDescriptionManager.getResourceDescription(resource); if (haveEObjectDescriptionsChanged(newDescription, resourceDescriptionManager)) { dirtyResource.copyState(newDescription); dirtyStateManager.announceDirtyStateChanged(delegatingClientAwareResource); } } } }