Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Right Click / File Refresh not refreshing my editors
Right Click / File Refresh not refreshing my editors [message #632880] Thu, 14 October 2010 14:47 Go to next message
andy is currently offline andyFriend
Messages: 13
Registered: October 2010
Junior Member
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.

Any pointers?
Re: Right Click / File Refresh not refreshing my editors [message #633033 is a reply to message #632880] Fri, 15 October 2010 07:39 Go to previous messageGo to next message
Animesh Kumar is currently offline Animesh KumarFriend
Messages: 79
Registered: September 2010
Location: Bangalore
Member
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

Regards,
Animesh
Re: Right Click / File Refresh not refreshing my editors [message #633035 is a reply to message #632880] Fri, 15 October 2010 07:42 Go to previous messageGo to next message
andy is currently offline andyFriend
Messages: 13
Registered: October 2010
Junior Member
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!

[Updated on: Fri, 15 October 2010 07:43]

Report message to a moderator

Re: Right Click / File Refresh not refreshing my editors [message #633040 is a reply to message #633035] Fri, 15 October 2010 07:59 Go to previous messageGo to next message
Animesh Kumar is currently offline Animesh KumarFriend
Messages: 79
Registered: September 2010
Location: Bangalore
Member
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.


Regards,
Animesh
Re: Right Click / File Refresh not refreshing my editors [message #633041 is a reply to message #632880] Fri, 15 October 2010 07:50 Go to previous messageGo to next message
Dani Megert is currently offline Dani MegertFriend
Messages: 3801
Registered: July 2009
Senior Member
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.

Dani
>
> Any pointers?
Re: Right Click / File Refresh not refreshing my editors [message #633043 is a reply to message #632880] Fri, 15 October 2010 08:12 Go to previous messageGo to next message
andy is currently offline andyFriend
Messages: 13
Registered: October 2010
Junior Member
Animesh: The problem isn't the message, it's the fact that refreshing does not remove the message (or rather that refreshing does not refresh)

Dani: Thanks, I will look in to it in more detail as I'm not sure if it's my end, good to know it shouldn't be happening though. Thankyou.

[Updated on: Fri, 15 October 2010 08:13]

Report message to a moderator

Re: Right Click / File Refresh not refreshing my editors [message #633046 is a reply to message #633043] Fri, 15 October 2010 08:15 Go to previous messageGo to next message
Animesh Kumar is currently offline Animesh KumarFriend
Messages: 79
Registered: September 2010
Location: Bangalore
Member
Even i think that the problem is that your file in the editor does not get refreshed. Thats why you are getting that error.

Regards,
Animesh
Re: Right Click / File Refresh not refreshing my editors [message #633056 is a reply to message #632880] Fri, 15 October 2010 08:44 Go to previous messageGo to next message
andy is currently offline andyFriend
Messages: 13
Registered: October 2010
Junior Member
I have noticed that if my editor is selected then File -> Refresh is greyed out / disabled on the menu. Does this suggest something?
Re: Right Click / File Refresh not refreshing my editors [message #633567 is a reply to message #632880] Mon, 18 October 2010 12:37 Go to previous messageGo to next message
andy is currently offline andyFriend
Messages: 13
Registered: October 2010
Junior Member
Am I right in thinking that I could rephrase this question and say that:

I have an IFile that is externally modified. I run:

ResourcesPlugin.getWorkspace().getRoot().refreshLocal(IResource.DEPTH_INFINITE, null);


And this resource is not updated. Why is this happening?
Re: Right Click / File Refresh not refreshing my editors [message #633688 is a reply to message #633567] Mon, 18 October 2010 21:52 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin KomissarchikFriend
Messages: 952
Registered: July 2009
Senior Member
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.

- Konstantin
Re: Right Click / File Refresh not refreshing my editors [message #633853 is a reply to message #632880] Tue, 19 October 2010 15:39 Go to previous messageGo to next message
andy is currently offline andyFriend
Messages: 13
Registered: October 2010
Junior Member
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.
Re: Right Click / File Refresh not refreshing my editors [message #633867 is a reply to message #633853] Tue, 19 October 2010 16:15 Go to previous message
Animesh Kumar is currently offline Animesh KumarFriend
Messages: 79
Registered: September 2010
Location: Bangalore
Member
Quote:
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)


Regards,
Animesh
Previous Topic:explaining disabled context menu items
Next Topic:Cut/Copy/Paste in an Editor
Goto Forum:
  


Current Time: Fri Nov 28 10:14:49 GMT 2014

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

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