if (myClient == null || monitor.isCanceled()) return Status.OK_STATUS; final IXtextDocument document = myClient.getDocument(); if (document == null) return Status.OK_STATUS;
public void initializeDirtyStateSupport(IDirtyStateEditorSupportClient client) { if (this.currentClient != null) throw new IllegalStateException("editor was already assigned"); //$NON-NLS-1$ this.currentClient = client; this.isDirty = false; IXtextDocument document = client.getDocument(); document.addModelListener(this); initDirtyResource(document); stateChangeEventBroker.addListener(this); client.addVerifyListener(this); scheduleValidationJobIfNecessary(); }
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; }
private void scheduleValidationJobIfNecessary() { if (validationJobScheduler != null && currentClient != null) { validationJobScheduler.scheduleInitialValidation(currentClient.getDocument()); } }