I am trying to pop up a dialog (i.e. a FileDialog) in an Eclipse Plugin, actually before of an Acceleo transformation I am running through the related UI Launcher project (http://lowcoupling.com/post/51877317162/the-acceleo-ui-launcher-project)
I am trying to do this in the related doGenerate method...
public void doGenerate(IProgressMonitor monitor) throws IOException {
Display display = Display.getCurrent();
System.out.println(display);
//....
but the display I get is null How should I do that?
The documentation of IWorkbench#getDisplay()
states:
Code should always ask the workbench for the display rather than rely on
Display.getDefault()
.
So use:
PlatformUI.getWorkbench().getDisplay()
instead.
I'm not sure if you looked at this yet, but in the documentation for the class Display
, it says that Display.getCurrent()
returns
null
if the currently running thread is not a user-interface thread for any display.
This might be the problem, but without more information I can't tell.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With