Java 类org.eclipse.xtext.ui.editor.model.IXtextDocumentContentObserver 实例源码

项目:EASyProducer    文件:EmbeddedXtextSourceEditor.java   
@Override
public void addDocumentStateListener(IDocumentStateListener listener) {
    if (null != listener) {
        IXtextDocumentContentObserver delegatingListener = new DocumentContextObserver(listener);
        documentStateListeners.put(listener, delegatingListener);
        embeddedEditor.getDocument().addXtextDocumentContentObserver(delegatingListener);
    }
}
项目:EASyProducer    文件:EmbeddedXtextSourceEditor.java   
@Override
public void removeDocumentStateListener(IDocumentStateListener listener) {
    if (null != listener) {
        IXtextDocumentContentObserver delegatingListener =  documentStateListeners.remove(listener);
        if (null != delegatingListener && null != embeddedEditor) {
            XtextDocument doc = embeddedEditor.getDocument();
            if (null != doc) {
                doc.removeXtextDocumentContentObserver(delegatingListener);
            }
        }
    }
}