Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » how to update editor input?
how to update editor input? [message #284447] Mon, 25 April 2005 15:31 Go to next message
Eclipse UserFriend
Originally posted by: joerni_78.gmx.de

Hi, i'm new to eclipse. I'm trying to build a Multipageeditor with a
FormPage and a texteditorpage, which shows the 'source' code (XML) of the
file to edit. These files are created and changed directly with the help
of an external jar. That means, editing the formPage results in an updated
file. Now I have the problem of updating the correspondend texteditorpage.

I thought the pageChange(int newPageIndex)-Method in FormEditor class
could be a good place to update the texteditor content.

I tried the following:

IEditorInput editorInput = ...
textEditor.setInput(editorInput);

Actually this updates the content of the editor when switching to the
editor page, but when I try to edit the texteditor content then, a
MessageDialog appears ->
"Update Conflict- The File has been changed on the File System. Do you
want to load the changes?"

How can I avoid this? I tried various things, but I just do not come to a
solution. How can I get the texteditor to simply rescan the file content
without checking, if the file has been changed?

Thank you!
Joern
Re: how to update editor input? [message #284456 is a reply to message #284447] Mon, 25 April 2005 18:46 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Wolflgang_Horn.onlinehome.de

Try creating an IFile resource pointing to the file and use method
refreshLocal
to update the workbench to the changed file.

IEditorInput input = editor.getEditorInput();
if(input instanceof IFileEditorInput)
{
IFileEditorInput fileInput = (IFileEditorInput) input;
fileInput.getFile().refreshLocal(IResource.DEPTH_ONE, null);
}
setInput(input);

See the API documentation for a description of IFile.refreshLocal.

Regards,
Joggerwolf

"Joern" <joerni_78@gmx.de> schrieb im Newsbeitrag
news:6eb962d8d460fac52aca30da47c31de6$1@www.eclipse.org...
> Hi, i'm new to eclipse. I'm trying to build a Multipageeditor with a
> FormPage and a texteditorpage, which shows the 'source' code (XML) of the
> file to edit. These files are created and changed directly with the help
> of an external jar. That means, editing the formPage results in an updated
> file. Now I have the problem of updating the correspondend texteditorpage.
>
> I thought the pageChange(int newPageIndex)-Method in FormEditor class
> could be a good place to update the texteditor content.
>
> I tried the following:
>
> IEditorInput editorInput = ...
> textEditor.setInput(editorInput);
>
> Actually this updates the content of the editor when switching to the
> editor page, but when I try to edit the texteditor content then, a
> MessageDialog appears ->
> "Update Conflict- The File has been changed on the File System. Do you
> want to load the changes?"
>
> How can I avoid this? I tried various things, but I just do not come to a
> solution. How can I get the texteditor to simply rescan the file content
> without checking, if the file has been changed?
>
> Thank you!
> Joern
>
Re: how to update editor input? [message #284488 is a reply to message #284456] Tue, 26 April 2005 13:22 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: joerni_78.xxx.de

Thank you,
but unfortunately it doesn't seem to help. Same problem. Any other ideas?
Re: how to update editor input? [message #1708921 is a reply to message #284488] Tue, 22 September 2015 13:27 Go to previous message
Abhishek Chakraborty is currently offline Abhishek ChakrabortyFriend
Messages: 82
Registered: July 2009
Location: Cologne, Germany
Member

IFile inputArchFile = ((FileEditorInput) input).getFile();
ResourceSet resSet = new ResourceSetImpl();
org.eclipse.emf.ecore.resource.Resource res = resSet.getResource(URI.createDeviceURI(inputArchFile.getLocationURI().toString()), true);


Regards,
Abhishek Chakraborty
Previous Topic:Workflow for Gerrit Code reviews in Platform UI
Next Topic:Eclipse Mars Subversion Workspace problems
Goto Forum:
  


Current Time: Thu Apr 25 01:33:18 GMT 2024

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

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

Back to the top