Search code examples
dialogmodal-dialogrcpe4

Modal RCP Dialog not modal


I'm having some trouble creating a modal Dialog in the e4 workbench. There is a predefined dialog(org.eclipse.e4.ui.model.application.ui.basic.impl.DialogImpl), but the problem is that I can't figure out how to make it modal.

Maybe you guys have some clue.


Solution

  • You can set the style for the dialog by using 'styleOverride' in the Persisted State for the dialog. The value of 'styleOverride' is the numeric value of the SWT flags you want to use.

    For a application model dialog the style would normally be

    SWT.TITLE | SWT.RESIZE | SWT.MAX | SWT.CLOSE | SWT.APPLICATION_MODAL
    

    which has a numeric value of 66672 so you would set this in the persisted state data:

    enter image description here

    It may be easier to stick with the traditional JFace Dialog as the application model MDialog does not give you any support for buttons etc.