Eclipse editor is not becomes dirty when I change the text [message #1758620] |
Thu, 30 March 2017 15:41  |
Eclipse User |
|
|
|
Hi All, now I'm working on the eclipse plug-in. Now I working of the editor extended from org.eclipse.ui.editors.text.TextEditor
And there is following code of marking the editor of dirty when something is changed
public class MyEditor extends TextEditor {
....
@Override
public boolean isDirty() {
return mIsDirty;
}
@Override public void createPartControl(Composite pParent) {
.....
mDocumentUndoManager = DocumentUndoManagerRegistry.getDocumentUndoManager(getSourceViewer().getDocument());
OperationHistoryFactory.getOperationHistory().addOperationHistoryListener(e -> {
if (e.getOperation().hasContext(mDocumentUndoManager.getUndoContext())) {
// if there is no more operation to undo
if (!OperationHistoryFactory.getOperationHistory().canUndo(mDocumentUndoManager.getUndoContext())) {
mIsDirty = false;
} else {
mIsDirty = true;
}
firePropertyChange(IEditorPart.PROP_DIRTY);
}
});
}
}
Listener and isDirty method are called when I make the changes of text in the editor, but my Editor not marked as dirty, also I can't undo the changes.
May I ask to give me some ideas, where can be problem?
Regards,
Vladimir
|
|
|
|
Powered by
FUDForum. Page generated in 0.27138 seconds