Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set Size of JFace Wizard

I am building an Eclipse RCP application and am having trouble on settings the size of a JFace Wizard.

like image 952
Ohanes Dadian Avatar asked Jul 29 '10 21:07

Ohanes Dadian


3 Answers

Yeah, it is generally a good idea to let Eclipse work out the size for you. However, if you really want to set the size of the wizard, you can do it by setting the size of the WizardDialog which you are using to open your wizard. For example:

Wizard wizard = new MyCustomWizard();
WizardDialog wizardDialog = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), wizard);
wizardDialog.setPageSize(WIDTH, HEIGHT);
// Could also use wizardDialog.setMinimumPageSize(WIDTH, HEIGHT) if that's more appropriate
like image 106
Dan Gorst Avatar answered Nov 06 '22 04:11

Dan Gorst


It turns out that the Wizard is the size of your largest WizardPage.

like image 9
Ohanes Dadian Avatar answered Nov 06 '22 04:11

Ohanes Dadian


To set the size of the dialog, it's

wizardDialog.getShell().setSize(WIDTH, HEIGHT)

To disable that the dialog is resizable, leave the SWT.RESIZE bit in an own WizardDialog implementation:

// original WizardDialog class
public WizardDialog(Shell parentShell, IWizard newWizard) {
    super(parentShell);
    setShellStyle(SWT.CLOSE | SWT.TITLE | SWT.BORDER | SWT.APPLICATION_MODAL | SWT.RESIZE);
    setWizard(newWizard);
    ...
}

// Own implementation without SWT.RESIZE
public NoResizeWizardDialog(Shell parentShell, IWizard newWizard) {
    super(parentShell);
    setShellStyle(SWT.CLOSE | SWT.TITLE | SWT.BORDER | SWT.APPLICATION_MODAL);
    setWizard(newWizard);
    ...
}
like image 7
nico.ruti Avatar answered Nov 06 '22 03:11

nico.ruti