I have some editors, extending MultiPageEditorPart, if I edit a file outside of my project I occasionally get the message "Resource is out of sync with the file system" when I load the files in these editors.

In Project Explorer I can right click on these files and choose 'Refresh', when I do this something seems to happen but the "Resource is out of sync" message remains.

Are you using any storage servers where you are storing and syncing your files???? Maybe it shows that problem because the files may not be synced with those files. If so you can go to team(menu item) and try to sync your files or try a refresh in the team menu

I am editing the files externally, I want the system to be resilient to such actions.

The problem is that when doing a file -> refresh the files are not refreshed, the message remains, until I close the file and re-open it. This is not really acceptable from a user perspective as it's fairly confusing.

basically, for some reason (which I am trying to find out), file -> refresh (or right click -> refresh or F5) does not do what it should do and I am trying to find out why!

You will have to use a resource change listener which listens to changes made to the content of the file and whenever you get a notification for change in the file you could add a command to refresh the editor automatically on such notifications.
I don't know why file refresh is not working. It should actually work.

andy wrote:
> I have some editors, extending MultiPageEditorPart, if I edit a file
> outside of my project I occasionally get the message "Resource is out
> of sync with the file system" when I load the files in these editors.
>
> In Project Explorer I can right click on these files and choose
> 'Refresh', when I do this something seems to happen but the "Resource
> is out of sync" message remains.
This shouldn't happen. I suggest to file a bug report with detailed
steps to reproduce.

You can easily check if the problem is with refresh of files in workspaces or in your editor.

1. Close your editor.
2. Open the file in question using eclipse text editor.
3. Close the editor.
4. Modify the file outside the workspace.
5. Refresh the file.
6. Open the file again in the eclipse text editor. You should see updated contents.
7. Close the editor.
8. Modify the file outside the workspace.
9. Open the file again in the eclipse text editor. You should see message about file being out of sync.
10. Refresh the file. You should see the text editor update with new contents.

If all of that worked as expected on your file, then the problem is in your editor. Couple of things to look for...

1. How are you opening your editor? Or put another way, what is getEditorInput() of your editor?

2. Is your editor editing multiple files? In this case editor refresh may not happen automatically. If this is your case, I would recommend tracing through how the basic text editor handles this case and doing something similar in your editor except for multiple files.

Platform UI experts will need to comment on what API your editor needs to implement to integrate with workbench file refresh. My guess is that workbench isn't seeing your editor as editing files in question.

Thanks for responding Konstantin. The problem was in my editor. In the end I fixed it by adding a resource change listener, if the resource changes and delta.getFlags() == IResourceDelta.CONTENT then I setInput on my editor again.

My next problem is that Eclipse will only allow me to File -> Refresh if the 'Project Explorer' is highlighted. If my file is the view highlighted or my customer explorer view is what is highlighted it is greyed out.

My next problem is that Eclipse will only allow me to File -> Refresh if the 'Project Explorer' is highlighted. If my file is the view highlighted or my customer explorer view is what is highlighted it is greyed out.

As much as i have seen till now, the File->Refresh works only for the Project Explorer and Package Explorer Views... Because the Refresh item is to refresh the contents of eclipse file system.

So if you want to refresh your Editor, may be you should add you own context menu item for refresh the editor or the custom view which you have(Use refreshLocal)