Java – Eclipse: get null display

I tried to pop up a dialog box (i.e. a FileDialog) in the Eclipse Plug-in. In fact, I was running the relevant UI launcher project before an acceleo transformation( http://lowcoupling.com/post/51877317162/the-acceleo-ui-launcher-project )

I tried to do this in the relevant dogenerate method

public void doGenerate(IProgressMonitor monitor) throws IOException {

    Display display = Display.getCurrent();
    System.out.println(display);
    //....

But the display I get is empty. What should I do?

Solution

The iworkbench #getdisplay() document states:

So use:

PlatformUI.getWorkbench().getDisplay()

Replace

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>