How do I get the workbench window to open a modal dialog in an Eclipse based project?

后端 未结 3 1065
夕颜
夕颜 2021-02-12 15:07

In order to open a modal dialog, you need to pass a parent window, and pass the necessary flags for the dialog to be modal of course.

Depending on where you are in the e

3条回答
  •  抹茶落季
    2021-02-12 15:32

    From a view or an editor (this part is easy):

    this.getSite().getWorkbenchWindow().getShell()
    

    From elsewhere, access a view or editor and same as above.

    If you find yourself in a class where you don't have access to a view or editor, you probably don't want to be calling any UI code, but if you really want to shoot yourself in the foot:

    PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()
    

提交回复
热议问题