Reputation: 1027
I'm building a plugin for eclipse which performs some static analysis on the projects currently found in the workspace. I have an implementation of AbstractHandler
, the execute
method is called when my button is pressed in Eclipse.
Once my analysis has been completed, for now, I want a new text window to open in Eclipse with the output of the analysis.
I've followed the vogella tutorial here http://www.vogella.com/tutorials/EclipseJobs/article.html#eclipsejobs_uisynchronize
which explains that I need to inject a UISynchronizer
object (or rather, eclipse will inject it for me) and call the asynch(Runnable)
method from the handler. However, when I import UISynchronizer
, Eclipse gives the warning:
Discouraged access: The type UISynchronizer is not accessible due to restriction on required library /Applications/eclipse/plugins/org.eclipse.ui.workbench_3.105.2.v20140211-1711.jar
Is this to discourage the average user from using the UISynchronizer
class? Or should I be using a different method to update the UI from my handler?
Upvotes: 0
Views: 223
Reputation: 111217
UISynchronizer
is for a Eclipse e4 style application, since you are using AbstractHandler
you must be writing an Eclipse 3.x style plugin so it is not an appropriate thing to use.
Instead use Display.asyncExec
:
Display.getDefault().asyncExec(runnable);
This is actually what UISynchronizer
uses internally.
For the record the 'Discouraged access' warning is because the UISynchronizer
interface has not yet been finalized and might change. For an e4 application this warning can be ignored.
Update:
Checking again the e4 class is UISynchronize
not UISynchronizer
which is an internal class and should not be used at all.
Upvotes: 2