java - Check if eclipse editor document was changed by another editor -


I have created a custom eclipse editor (ebribrated text editor) and I need to know that when an editor opens some files in the editor, it modifies and saves it.

For example, I have a document opened in a custom eclipse editor and I keep this document modified and saved in another editor, I need to perform some tasks when it happens is.

I like trying to use listener IDocumentListener:

  last IEditorInput input = editor.getEditorInput (); IDocumentProvider Document Provider = Editor .getDocumentProvider (); ID document document = document provider .getDocument (input); Document.addDocumentListener (New IDocumentListener) {@Override Public void documentAboutToBeChanged (DocumentEvent arg0) {// blank} @ Override Public Null Document Changed (DocumentEvent arg0) Do something here (DoTask);}};  

But the method document is executed 2 times:

1) When the editor edit external eclipse and save the file. (I need it)

2) When I edit the document with my custom editor save without saving. (I do not need it)

The problem is 2, each typed character runs, I need the method document only to change to 1 number.


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -