Example usage for org.eclipse.jface.preference IPreferenceNode createPage

List of usage examples for org.eclipse.jface.preference IPreferenceNode createPage

Introduction

In this page you can find the example usage for org.eclipse.jface.preference IPreferenceNode createPage.

Prototype

public void createPage();

Source Link

Document

Creates the preference page for this node.

Usage

From source file:com.mindquarry.desktop.preferences.dialog.FilteredPreferenceDialog.java

License:Open Source License

/**
 * Create the page for the node.
 * 
 * @param node
 * 
 * @since 3.1
 */
protected void createPage(IPreferenceNode node) {
    node.createPage();
}

From source file:org.bonitasoft.studio.preferences.dialog.BonitaPreferenceDialog.java

License:Open Source License

protected void openPreferencePage(String pageId) {

    IPreferenceNode node = PreferenceUtil.findNodeMatching(pageId);
    IPreferencePage p = node.getPage();/*ww  w.jav a2 s.c o m*/
    if (p != null) {
        node.disposeResources();
    }
    node.createPage();

    for (Control c : preferencePageComposite.getChildren()) {
        c.dispose();
    }

    preferencePageComposite.pack(true);

    if (pageId.equals(JAVA_PAGE_ID)) {
        Composite parent = new Composite(preferencePageComposite, SWT.NONE);
        GridLayout gl = new GridLayout(1, false);
        gl.verticalSpacing = 0;
        gl.marginHeight = 0;
        gl.marginTop = 0;
        parent.setLayout(gl);
        createTitleBar(parent, Messages.BonitaPreferenceDialog_Java,
                Pics.getImage(PicsConstants.preferenceJava));
        node.getPage().createControl(parent);
        applyOnBack.add(node.getPage());
    } else if (pageId.equals(WEB_BROWSER_PAGE_ID)) {
        Composite parent = new Composite(preferencePageComposite, SWT.NONE);

        GridLayout gl = new GridLayout(1, false);
        gl.verticalSpacing = 0;
        gl.marginHeight = 0;
        gl.marginTop = 0;
        parent.setLayout(gl);

        createTitleBar(parent, Messages.BonitaPreferenceDialog_Browser,
                Pics.getImage(PicsConstants.preferenceWeb));
        Composite fillComposite = new Composite(parent, SWT.NONE);
        fillComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
        fillComposite.setLayout(new FillLayout());
        node.getPage().createControl(fillComposite);
    } else if (pageId.equals(PROXY_PAGE_ID)) {
        Composite parent = new Composite(preferencePageComposite, SWT.NONE);
        GridLayout gl = new GridLayout(1, false);
        gl.verticalSpacing = 0;
        gl.marginHeight = 0;
        gl.marginTop = 0;
        parent.setLayout(gl);

        createTitleBar(parent, Messages.BonitaPreferenceDialog_Proxy,
                Pics.getImage(PicsConstants.preferenceProxy));
        Composite fillComposite = new Composite(parent, SWT.NONE);
        fillComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
        fillComposite.setLayout(new FillLayout());
        node.getPage().createControl(fillComposite);
    } else {
        node.getPage().createControl(preferencePageComposite);
    }

    stack.topControl = preferencePageComposite;
    mainComposite.layout();
    btnDisplay.setEnabled(true);
    updateShellSize(false);
}

From source file:org.eclipse.datatools.connectivity.internal.ui.ProfileUIManager.java

License:Open Source License

/**
 * Creates a new property page contribution of the specified connection profile.
 * @param profile   a connection profile
 * @return  the profile property page//  w  w w  .j ava  2s  .co  m
 */
public static ProfilePropertyPage createPropertyPage(IConnectionProfile profile) {
    IPreferenceNode[] nodes = PreferencesUtil.propertiesContributorsFor(profile);

    for (int i = 0; i < nodes.length; i++) {
        IPreferenceNode pageNode = nodes[i];
        IPreferencePage propPage = pageNode.getPage();
        if (propPage == null) // page is not created yet
        {
            pageNode.createPage();
            propPage = pageNode.getPage();
        }

        if (!(propPage instanceof ProfilePropertyPage)) {
            if (propPage != null)
                pageNode.disposeResources();
            continue; // try the next page contribution node
        }

        return (ProfilePropertyPage) propPage;
    }

    return null;
}

From source file:org.eclipse.ui.tests.dialogs.PreferenceDialogWrapper.java

License:Open Source License

public IPreferencePage getPage(IPreferenceNode node) {
    if (node == null)
        return null;

    // Create the page if nessessary
    if (node.getPage() == null)
        node.createPage();

    if (node.getPage() == null)
        return null;

    return node.getPage();
}

From source file:org.eclipse.ui.tests.dynamicplugins.PropertyPageTests.java

License:Open Source License

public void testPropertyPageContribution() {
    PropertyPageContributorManager cManager = PropertyPageContributorManager.getManager();
    PropertyPageManager manager;//from   w ww .ja  va  2s . co  m
    DynamicTestType type = new DynamicTestType();

    cManager.contribute(manager = new PropertyPageManager(), type);
    assertNull(manager.find(PROPERTYPAGE));
    getBundle();
    cManager.contribute(manager = new PropertyPageManager(), type);
    IPreferenceNode result = manager.find(PROPERTYPAGE);
    assertNotNull(result);
    result.createPage(); // muck around and ensure we've created some potential garbage
    result.disposeResources();
    removeBundle();
    cManager.contribute(manager = new PropertyPageManager(), type);
    assertNull(manager.find(PROPERTYPAGE));
}

From source file:org.eclipsetrader.ui.internal.trading.AlertPropertyPage.java

License:Open Source License

@SuppressWarnings("unchecked")
void doSelectionChanged(IStructuredSelection selection) {
    for (int i = 0; i < propertyPages.length; i++) {
        propertyPages[i].dispose();/* w  w  w .j a  v  a  2s . co  m*/
    }

    if (selection.isEmpty()) {
        propertyPages = new PropertyPage[0];
        createTabbedPages();
        return;
    }

    final Object element = selection.getFirstElement();

    PropertyPageManager pageManager = new PropertyPageManager();
    PropertyPageContributorManager.getManager().contribute(pageManager, element);

    IAdaptable adaptableElement = new IAdaptable() {

        @Override
        public Object getAdapter(Class adapter) {
            if (adapter.isAssignableFrom(element.getClass())) {
                return element;
            }
            return null;
        }
    };

    List<PropertyPage> list = new ArrayList<PropertyPage>();
    for (Object nodeObj : pageManager.getElements(PreferenceManager.PRE_ORDER)) {
        IPreferenceNode node = (IPreferenceNode) nodeObj;
        node.createPage();
        if (node.getPage() instanceof PropertyPage) {
            PropertyPage page = (PropertyPage) node.getPage();
            page.setElement(adaptableElement);
            list.add(page);
        }
    }
    propertyPages = list.toArray(new PropertyPage[list.size()]);

    createTabbedPages();
}