Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get a notification when build workspace is finished?

Tags:

eclipse

How can I write a plugin or program routine that gets notified when "build workspace" finishes in Eclipse?

Is IProgressMonitor useful for this? If so, how do I get ahold of it?

like image 897
skiphoppy Avatar asked Jun 09 '15 19:06

skiphoppy


2 Answers

You can wait for the automatic build to finish using:

Platform.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_BUILD, null);

This will block until the builds have finished (and do nothing if the build is not running).

You would probably also want to wait on the manual builds are well:

Platform.getJobManager().join(ResourcesPlugin.FAMILY_MANUAL_BUILD, null);
like image 122
greg-449 Avatar answered Sep 17 '22 22:09

greg-449


If you really want to receive a notification (rather than blocking), try this:

IWorkspace.addResourceChangeListener(myListener, IResourceChangeEvent.POST_BUILD);

The Javadoc of IResourceChangeEvent gives more details on usage and on information found in the event instance.

like image 29
Stephan Herrmann Avatar answered Sep 19 '22 22:09

Stephan Herrmann