Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » Eclipse editor is not becomes dirty when I change the text(Eclipse plug-in, TextEditor)
Eclipse editor is not becomes dirty when I change the text [message #1758620] Thu, 30 March 2017 15:41 Go to next message
kozhaev Vladimir is currently offline kozhaev VladimirFriend
Messages: 108
Registered: July 2009
Senior Member
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
Re: Eclipse editor is not becomes dirty when I change the text [message #1763621 is a reply to message #1758620] Thu, 18 May 2017 05:37 Go to previous message
saravanakumar Mohanasundaram is currently offline saravanakumar MohanasundaramFriend
Messages: 19
Registered: February 2017
Junior Member
Hi Vladimir,

I think this will help you : https://www.eclipse.org/forums/index.php/t/101048/

Check this : http://www.wideskills.com/eclipse-plugin-tutorial/eclipse-plugin-editors-tutorial

[Updated on: Thu, 18 May 2017 05:49]

Report message to a moderator

Previous Topic:how to add user login function into eclipse by plug-in development
Next Topic:Textmarker overwrites style information in the Editor
Goto Forum:
  


Current Time: Fri Apr 19 19:39:41 GMT 2024

Powered by FUDForum. Page generated in 0.05027 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top