Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Calling "Refresh using native hooks or polling" programmatically(Calling the job, if available, which eclipse calls when the check box for "Refresh using native hooks or polling" is selected)
Calling "Refresh using native hooks or polling" programmatically [message #893215] Tue, 03 July 2012 09:05 Go to next message
Nikhil chulli is currently offline Nikhil chulliFriend
Messages: 9
Registered: June 2012
Junior Member
I have to check file synchronization in some external folder, that is, I have to do some process if any files in that external folder has been changed even by a tool other than Eclipse.
I know that there is option in Window->General->Workspace "Refresh using native hooks or polling", which can be enough for the purpose.
But I want to call the same job(that eclipse calls when "Refresh using native hooks or polling" is selected) from my program. Is this possible? If it is possible, how can I call that job?
Re: Calling "Refresh using native hooks or polling" programmatically [message #893286 is a reply to message #893215] Tue, 03 July 2012 13:05 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
If you just want to trigger a refresh you basically want to call org.eclipse.core.resources.IResource.refreshLocal(int, IProgressMonitor).
Also org.eclipse.ui.actions.RefreshAction might be of interest.

If you want to refresh the entire workspace, obtain a reference from ResourcesPlugin.getWorkspace().getRoot().

HTH,
Stephan
Re: Calling "Refresh using native hooks or polling" programmatically [message #893419 is a reply to message #893286] Wed, 04 July 2012 04:37 Go to previous messageGo to next message
Nikhil chulli is currently offline Nikhil chulliFriend
Messages: 9
Registered: June 2012
Junior Member
Quote:
If you just want to trigger a refresh you basically want to call org.eclipse.core.resources.IResource.refreshLocal(int, IProgressMonitor).
Also org.eclipse.ui.actions.RefreshAction might be of interest.

If you want to refresh the entire workspace, obtain a reference from ResourcesPlugin.getWorkspace().getRoot().


Thanks a lot for your reply Stephan.

I am not interested in triggering a refresh as such. I would like to check, periodically, if any of the project's external files has been modified by an external tool(other than eclipse). And if it has been modified I will call my builder(which will do some xml processing).
Now, if we select the "Refresh using native hooks or polling" option under Window->General->Workspace, the eclipse automatically checks for any change periodically. And if it detects any change the builders are called.
So I assumed that selecting "Refresh using native hooks or polling" option will trigger a job inside eclipse. I was wondering if I could call that job from my program. If that is not possible, I believe, I would have to create my own job for polling and activating builders.
Re: Calling "Refresh using native hooks or polling" programmatically [message #893617 is a reply to message #893419] Wed, 04 July 2012 23:11 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
Well, performing a refresh while an IResourceChangeListener is registered should actually give the desired notifications, no?

Other references of interest:
- When looking at the preference page (or view or ...) Alt-Shift-F1 points you to the implementing class, look from there
- http://www.eclipsezone.com/eclipse/forums/t71053.html
- org.eclipse.core.resources.refresh.IRefreshMonitor plus implementors
- org.eclipse.core.internal.refresh.RefreshJob

You may have noted that most classes involved are from org.eclipse.core.resources, which is not part of JDT - hint, hint - Smile

best,
Stephan

Re: Calling "Refresh using native hooks or polling" programmatically [message #893650 is a reply to message #893617] Thu, 05 July 2012 06:43 Go to previous message
Nikhil chulli is currently offline Nikhil chulliFriend
Messages: 9
Registered: June 2012
Junior Member
Thanks a lot for your hints. Smile
Previous Topic:Using F3 key for opening a file in eclipse editor.
Next Topic:Extending source lookup
Goto Forum:
  


Current Time: Fri Apr 26 07:46:21 GMT 2024

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

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

Back to the top