Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » Refresh TextEditor without close/open
Refresh TextEditor without close/open [message #1814993] Mon, 23 September 2019 18:54 Go to next message
Jerry Bib is currently offline Jerry BibFriend
Messages: 13
Registered: October 2015
Junior Member
Hi,

In my plugin I'm doing some manipulation on the text of a file (internally in the editor). At some point I want to refresh the editor (as originally was loaded from the physical file). Currently the only way I got it to work is by closing and opening again the editor:

IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
...
page.closeEditor(editor, true);
page.openEditor(editor.getEditorInput(), IDE.getEditorDescriptor(file, true).getId());

Does anyone has an idea how can I force the editor to refresh itself (text, colors, outline, etc..) more elegantly without actually re-opening it?

Regards,
Jerry
Re: Refresh TextEditor without close/open [message #1817175 is a reply to message #1814993] Mon, 18 November 2019 03:59 Go to previous message
Vivien Jovet is currently offline Vivien JovetFriend
Messages: 11
Registered: February 2017
Junior Member
If you do the modifications to the same IDocument provided by the IDocumentProvider used by the ITextEditor (see ITextEditor#getDocumentProvider), the editor should react to your changes as expected. Now if you are doing modifications outside of the IDocument or even outside of the Resources API (IFile etc.) you have to notify the Resources plugin that the file needs to be refreshed which will send events that the editor can react to.

[Updated on: Mon, 18 November 2019 03:59]

Report message to a moderator

Previous Topic:Eclipse p2 repository is not accessible
Next Topic:RCPTT linux compatibility
Goto Forum:
  


Current Time: Fri Apr 26 15:43:24 GMT 2024

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

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

Back to the top