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 User
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 User
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 message
Eclipse User
Originally posted by: joerni_78.xxx.de

Thank you,
but unfortunately it doesn't seem to help. Same problem. Any other ideas?
Previous Topic:ProblemView
Next Topic:TableItem length
Goto Forum:
  


Current Time: Thu Oct 30 13:04:06 GMT 2014

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

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