use of org.eclipse.jface.wizard.ProgressMonitorPart in project dbeaver by dbeaver.
the class MultiPageWizardDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
wizard.addPages();
wizardSash = new SashForm(composite, SWT.HORIZONTAL);
wizardSash.setLayoutData(new GridData(GridData.FILL_BOTH));
pagesTree = new Tree(wizardSash, SWT.SINGLE);
pagesTree.setLayoutData(new GridData(GridData.FILL_BOTH));
Composite pageContainer = UIUtils.createPlaceholder(wizardSash, 2);
// Vertical separator
new Label(pageContainer, SWT.SEPARATOR | SWT.VERTICAL).setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, true));
pageArea = UIUtils.createPlaceholder(pageContainer, 1);
GridData gd = new GridData(GridData.FILL_BOTH);
pageArea.setLayoutData(gd);
pageArea.setLayout(new GridLayout(1, true));
wizardSash.setWeights(new int[] { 300, 700 });
Point maxSize = new Point(0, 0);
IWizardPage[] pages = wizard.getPages();
for (IWizardPage page : pages) {
addPage(null, page, maxSize);
}
pagesTree.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
changePage();
}
});
// Select first page
pagesTree.select(pagesTree.getItem(0));
changePage();
// Set title and image from first page
IDialogPage firstPage = (IDialogPage) pagesTree.getItem(0).getData();
setTitle(firstPage.getTitle());
setTitleImage(firstPage.getImage());
setMessage(firstPage.getDescription());
// Horizontal separator
new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR).setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
// Progress monitor
monitorPart = new ProgressMonitorPart(composite, null, true) {
@Override
public void setCanceled(boolean b) {
super.setCanceled(b);
if (b) {
cancelCurrentOperation();
}
}
};
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.grabExcessHorizontalSpace = true;
gd.horizontalIndent = 20;
gd.verticalIndent = 0;
monitorPart.setLayoutData(gd);
monitorPart.setVisible(false);
return composite;
}
Aggregations