4

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?

1
  • whatever defines a notion of "main thread"
    – Dims
    Feb 21, 2014 at 17:13

1 Answer 1

11

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
  }
});
1
  • Always very helpful content from your side!
    – GhostCat
    Aug 28, 2019 at 6:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.