Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SwingUtilities invokeLater equivalent in SWT / Eclipse 3.x API?

What is SwingUtilities.invokeLater() equivalent in Eclipse API 3.x?

I.e. how to run something on "main thread"?

Can I use

@Inject 
UISynchronize sync;

for this in Eclipse Plug-In 3.x?

It is written, that UISynchronize is valid "since 1.0". What does it mean? Why is it in e4 package then?

like image 760
Dims Avatar asked Dec 20 '22 17:12

Dims


1 Answers

You can only use @Inject simply on Eclipse 4.x application model objects (the Eclipse 4.x API is known as e4). So unless you do extra work you can't use injection in the Eclipse 3.x API.

More recent versions of Eclipse do support views declared using the e4view element of the org.eclipse.ui.views extension point. These can make use of @Inject.

Display.getDefault().asyncExec() is used with SWT objects to run code in the SWT main thread.

Display.getDefault().asyncExec(new Runnable()
{
  @Override
  public void run()
  {
     .. code to update the UI
  }
});
like image 171
greg-449 Avatar answered Dec 27 '22 03:12

greg-449