skiphoppy
skiphoppy

Reputation: 102773

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

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?

Upvotes: 6

Views: 630

Answers (2)

Stephan Herrmann
Stephan Herrmann

Reputation: 8178

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.

Upvotes: 4

greg-449
greg-449

Reputation: 111142

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);

Upvotes: 4

Related Questions