Example usage for org.eclipse.jface.dialogs IDialogPage getMessage

List of usage examples for org.eclipse.jface.dialogs IDialogPage getMessage

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs IDialogPage getMessage.

Prototype

String getMessage();

Source Link

Document

Returns the current message for this wizard page.

Usage

From source file:org.jkiss.dbeaver.ui.dialogs.MultiPageWizardDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);

    wizard.addPages();//  w ww  . j a  va2s.  c o  m

    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);
    pageArea.setLayoutData(new GridData(GridData.FILL_BOTH));
    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);
    }
    GridData gd = (GridData) pageArea.getLayoutData();
    //gd.minimumWidth = 200;
    //gd.minimumHeight = 200;
    gd.minimumWidth = gd.widthHint = maxSize.x + 10;
    gd.minimumHeight = gd.heightHint = maxSize.y + 10;

    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.getMessage());

    // 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;
}