use of org.eclipse.wst.sse.core.internal.provisional.DocumentChanged in project webtools.sourceediting by eclipse.
the class AbstractStructuredModel method setStructuredDocument.
public void setStructuredDocument(IStructuredDocument newStructuredDocument) {
boolean lifeCycleNotification = false;
if (fStructuredDocument != null) {
fStructuredDocument.removeDocumentChangedListener(fDirtyStateWatcher);
fStructuredDocument.removeDocumentAboutToChangeListener(fDocumentToModelNotifier);
fStructuredDocument.removeDocumentChangedListener(fDocumentToModelNotifier);
// prechange notification
lifeCycleNotification = true;
ModelLifecycleEvent modelLifecycleEvent = new DocumentChanged(ModelLifecycleEvent.PRE_EVENT, this, fStructuredDocument, newStructuredDocument);
signalLifecycleEvent(modelLifecycleEvent);
}
// hold for life cycle notification
IStructuredDocument previousDocument = fStructuredDocument;
// the actual change
fStructuredDocument = newStructuredDocument;
// so we can set our dirty state flag
if (fStructuredDocument != null) {
fStructuredDocument.addDocumentChangedListener(fDirtyStateWatcher);
fStructuredDocument.addDocumentAboutToChangeListener(fDocumentToModelNotifier);
fStructuredDocument.addDocumentChangedListener(fDocumentToModelNotifier);
}
if (lifeCycleNotification) {
// post change notification
ModelLifecycleEvent modelLifecycleEvent = new DocumentChanged(ModelLifecycleEvent.POST_EVENT, this, previousDocument, newStructuredDocument);
signalLifecycleEvent(modelLifecycleEvent);
}
}
Aggregations