Example usage for org.eclipse.jface.dialogs IPageChangeProvider getSelectedPage

List of usage examples for org.eclipse.jface.dialogs IPageChangeProvider getSelectedPage

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs IPageChangeProvider getSelectedPage.

Prototype

Object getSelectedPage();

Source Link

Document

Returns the currently selected page in the dialog.

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;// w w w. j  av a2  s .  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: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;/*  w w  w. j a v  a2 s.c  o  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(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);
        }
    }
}