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.