* and <code>false</code> otherwise.
* @param finishLabel the label for the finish button or <code>null</code> to
* use the default.
*/
public static void openWizard(Shell shell, Wizard wizard, final boolean modal, final boolean needsProgressPart, final String dialogSettingsKey, final boolean pack, final String finishLabel) {
CustomWizardDialog dialog = new CustomWizardDialog(shell, wizard) {
private ProgressMonitorPart progressMonitorPart;
@Override
protected boolean isResizable() {
return true;
}
@Override
protected Control createDialogArea(Composite parent) {
Control control = super.createDialogArea(parent);
if (progressMonitorPart != null && !needsProgressPart)
((GridData) progressMonitorPart.getLayoutData()).exclude = true;
return control;
}
@Override
public boolean close() {
progressMonitorPart = null;
return super.close();
}
@Override
protected ProgressMonitorPart createProgressMonitorPart(Composite composite, GridLayout pmlayout) {
progressMonitorPart = super.createProgressMonitorPart(composite, pmlayout);
return progressMonitorPart;
}
@Override
protected IDialogSettings getDialogBoundsSettings() {
if (dialogSettingsKey != null) {
IDialogSettings settings = Activator.getDefault().getDialogSettings();
IDialogSettings section = settings.getSection(dialogSettingsKey);
if (section != null)
return section;
return settings.addNewSection(dialogSettingsKey);
}
return super.getDialogBoundsSettings();
}
@Override
protected int getShellStyle() {
if (modal)
return super.getShellStyle();
return SWT.TITLE | SWT.BORDER | SWT.MIN | SWT.RESIZE | SWT.CLOSE | getDefaultOrientation();
}
@Override
protected int getDialogBoundsStrategy() {
return DIALOG_PERSISTSIZE;
}
@Override
protected Button createButton(Composite parent, int id, String label, boolean defaultButton) {
if (IDialogConstants.FINISH_ID == id && StringUtils.isSet(finishLabel))
label = finishLabel;
return super.createButton(parent, id, label, defaultButton);
}
@Override
protected Point getInitialSize() {
if (pack) {
int width = Application.IS_WINDOWS ? WINDOWS_PACKED_WIZARD_WIDTH : Application.IS_LINUX ? LINUX_PACKED_WIZARD_WIDTH : MAC_PACKED_WIZARD_WIDTH;
return getShell().computeSize(convertHorizontalDLUsToPixels(width), SWT.DEFAULT, true);
}
return super.getInitialSize();
}
};
dialog.setMinimumPageSize(0, 0);
dialog.create();
dialog.open();
}