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

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

Introduction

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

Prototype

String getTitle();

Source Link

Document

Returns this dialog page's title.

Usage

From source file:com.siteview.mde.internal.runtime.spy.sections.ActiveDialogPageSection.java

License:Open Source License

public void build(ScrolledForm form, SpyFormToolkit toolkit, ExecutionEvent event) {
    final Shell shell = HandlerUtil.getActiveShell(event);
    Object object = shell.getData();
    if (object == null)
        return;//from ww  w . j  av  a2s.  co m
    Class clazz = object.getClass();

    if (object instanceof IPageChangeProvider) {
        IPageChangeProvider pageChangeProvider = (IPageChangeProvider) object;
        Object selectedPage = pageChangeProvider.getSelectedPage();
        if (selectedPage != null) {
            Section section = toolkit.createSection(form.getBody(), ExpandableComposite.TITLE_BAR);
            section.clientVerticalSpacing = 9;
            if (selectedPage instanceof IDialogPage) {
                IDialogPage page = (IDialogPage) selectedPage;
                clazz = page.getClass();
                section.setText(
                        NLS.bind(MDERuntimeMessages.SpyDialog_activeDialogPageSection_title, page.getTitle()));

            } else {
                clazz = selectedPage.getClass();
                section.setText(MDERuntimeMessages.SpyDialog_activeDialogPageSection_title2);
            }
            // the active page
            FormText text = toolkit.createFormText(section, true);
            section.setClient(text);
            TableWrapData td = new TableWrapData();
            td.align = TableWrapData.FILL;
            td.grabHorizontal = true;
            section.setLayoutData(td);

            StringBuffer buffer = new StringBuffer();
            buffer.append("<form>"); //$NON-NLS-1$

            buffer.append(toolkit.createClassSection(text,
                    MDERuntimeMessages.SpyDialog_activeDialogPageSection_desc, new Class[] { clazz }));

            PackageAdmin admin = PDERuntimePlugin.getDefault().getPackageAdmin();
            Bundle bundle = admin.getBundle(clazz);
            toolkit.generatePluginDetailsText(bundle, null, "dialog page", buffer, text); //$NON-NLS-1$

            buffer.append("</form>"); //$NON-NLS-1$
            text.setText(buffer.toString(), true, false);
        }
    }
}

From source file:no.javatime.inplace.ui.command.handlers.NewPluginProjectHandler.java

License:Open Source License

@Override
public void pageChanged(PageChangedEvent event) {
    IDialogPage idp = (IDialogPage) event.getSelectedPage();
    if (null != wizard) {
        wizard.getShell().setText("New Bundle Project");
    }/*from w  ww  .j a v a2 s .  co m*/
    if (idp.getTitle().equals("Plug-in Project")) {
        idp.setTitle("Bundle Project");
    } else if (idp.getTitle().equals("Content")) {
        idp.setTitle("Bundle Content");
    } else if (idp.getTitle().equals("Templates")) {
        idp.setTitle("Bundle Templates");
    }
    return;
}

From source file:org.eclipse.pde.internal.runtime.spy.sections.ActiveDialogPageSection.java

License:Open Source License

public void build(ScrolledForm form, SpyFormToolkit toolkit, ExecutionEvent event) {
    final Shell shell = HandlerUtil.getActiveShell(event);
    Object object = shell.getData();
    if (object == null)
        return;/*from www  .j  a v  a  2 s .c  om*/
    Class clazz = object.getClass();

    if (object instanceof IPageChangeProvider) {
        IPageChangeProvider pageChangeProvider = (IPageChangeProvider) object;
        Object selectedPage = pageChangeProvider.getSelectedPage();
        if (selectedPage != null) {
            Section section = toolkit.createSection(form.getBody(), ExpandableComposite.TITLE_BAR);
            section.clientVerticalSpacing = 9;
            if (selectedPage instanceof IDialogPage) {
                IDialogPage page = (IDialogPage) selectedPage;
                clazz = page.getClass();
                section.setText(
                        NLS.bind(PDERuntimeMessages.SpyDialog_activeDialogPageSection_title, page.getTitle()));

            } else {
                clazz = selectedPage.getClass();
                section.setText(PDERuntimeMessages.SpyDialog_activeDialogPageSection_title2);
            }
            // the active page
            FormText text = toolkit.createFormText(section, true);
            section.setClient(text);
            TableWrapData td = new TableWrapData();
            td.align = TableWrapData.FILL;
            td.grabHorizontal = true;
            section.setLayoutData(td);

            StringBuffer buffer = new StringBuffer();
            buffer.append("<form>"); //$NON-NLS-1$

            buffer.append(toolkit.createClassSection(text,
                    PDERuntimeMessages.SpyDialog_activeDialogPageSection_desc, new Class[] { clazz }));

            Bundle bundle = FrameworkUtil.getBundle(clazz);
            toolkit.generatePluginDetailsText(bundle, null, "dialog page", buffer, text); //$NON-NLS-1$

            buffer.append("</form>"); //$NON-NLS-1$
            text.setText(buffer.toString(), true, false);
        }
    }
}

From source file:org.jkiss.dbeaver.ui.dialogs.connection.ConnectionPageSettings.java

License:Open Source License

private void createProviderPage(Composite parent) {
    if (this.connectionEditor != null) {
        return;/*from  w  ww . j a  va2 s  .  com*/
    }
    if (getControl() != null) {
        getControl().dispose();
    }

    try {
        this.connectionEditor = viewDescriptor.createView(IDataSourceConnectionEditor.class);
        this.connectionEditor.setSite(this);
        // init sub pages (if any)
        getSubPages();

        if (wizard.isNew() && !ArrayUtils.isEmpty(subPages)) {
            // Create tab folder
            List<IDialogPage> allPages = new ArrayList<>();
            allPages.add(connectionEditor);
            Collections.addAll(allPages, subPages);

            TabFolder tabFolder = new TabFolder(parent, SWT.TOP);
            tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));

            for (IDialogPage page : allPages) {
                TabItem item = new TabItem(tabFolder, SWT.NONE);
                page.createControl(tabFolder);
                Control pageControl = page.getControl();
                item.setControl(pageControl);
                item.setText(CommonUtils.isEmpty(page.getTitle()) ? "General" : page.getTitle());
                item.setToolTipText(page.getDescription());
            }
            tabFolder.setSelection(0);
            setControl(tabFolder);
        } else {
            // Create single editor control
            this.connectionEditor.createControl(parent);
            setControl(this.connectionEditor.getControl());
        }

        UIUtils.setHelp(getControl(), IHelpContextIds.CTX_CON_WIZARD_SETTINGS);
    } catch (Exception ex) {
        log.warn(ex);
        setErrorMessage("Can't create settings dialog: " + ex.getMessage());
    }
    parent.layout();
}

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();/*ww w.  ja  v  a2 s  .  co  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;
}

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

License:Open Source License

private TreeItem addPage(TreeItem parentItem, IDialogPage page, Point maxSize) {
    boolean hasPages = pagesTree.getItemCount() != 0;
    page.createControl(pageArea);/*  www .ja v a 2 s .  c  o  m*/
    Control control = page.getControl();
    Point pageSize = control.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    if (pageSize.x > maxSize.x)
        maxSize.x = pageSize.x;
    if (pageSize.y > maxSize.y)
        maxSize.y = pageSize.y;
    GridData gd = (GridData) control.getLayoutData();
    if (gd == null) {
        gd = new GridData(GridData.FILL_BOTH);
        control.setLayoutData(gd);
    }
    gd.exclude = hasPages;
    control.setVisible(!gd.exclude);

    TreeItem item = parentItem == null ? new TreeItem(pagesTree, SWT.NONE) : new TreeItem(parentItem, SWT.NONE);
    item.setText(page.getTitle());
    item.setData(page);

    // Ad sub pages
    if (page instanceof ICompositeDialogPage) {
        IDialogPage[] subPages = ((ICompositeDialogPage) page).getSubPages();
        if (!ArrayUtils.isEmpty(subPages)) {
            for (IDialogPage subPage : subPages) {
                addPage(item, subPage, maxSize);
            }
            item.setExpanded(true);
        }
    }

    return item;
}

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

License:Open Source License

private void changePage() {
    pageArea.setRedraw(false);//from   w  w  w.  jav a 2s.  c  om
    try {
        TreeItem[] selection = pagesTree.getSelection();
        if (selection.length != 1) {
            return;
        }
        TreeItem newItem = selection[0];
        if (prevPage == newItem.getData()) {
            return;
        }

        GridData gd;
        if (prevPage != null) {
            gd = (GridData) prevPage.getControl().getLayoutData();
            gd.exclude = true;
            prevPage.setVisible(false);
        }

        IDialogPage page = (IDialogPage) newItem.getData();
        gd = (GridData) page.getControl().getLayoutData();
        gd.exclude = false;
        page.setVisible(true);
        setTitle(page.getTitle());
        setMessage(page.getDescription());

        prevPage = page;
        pageArea.layout();
    } finally {
        pageArea.setRedraw(true);
    }
}