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

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

Introduction

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

Prototype

public void disposeResources();

Source Link

Document

Release the page managed by this node, and any SWT resources held onto by this node (Images, Fonts, etc).

Usage

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

License:Open Source License

@Override
public boolean close() {
    List nodes = preferenceManager.getElements(PreferenceManager.PRE_ORDER);
    for (int i = 0; i < nodes.size(); i++) {
        IPreferenceNode node = (IPreferenceNode) nodes.get(i);
        node.disposeResources();
    }/*  w ww.  j a v a 2s. com*/
    return super.close();
}

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  . ja v 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//from  w  w w .j  a  v  a 2s  .  c  om
 */
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.internal.dialogs.WorkbenchPreferenceManager.java

License:Open Source License

public void removeExtension(IExtension extension, Object[] objects) {
    for (int i = 0; i < objects.length; i++) {
        if (objects[i] instanceof IPreferenceNode) {
            IPreferenceNode wNode = (IPreferenceNode) objects[i];
            wNode.disposeResources();
            deepRemove(getRoot(), wNode);
        }/*from  w w w.  j a va2s .  c o m*/
    }
}

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

License:Open Source License

public void testPropertyPageContribution() {
    PropertyPageContributorManager cManager = PropertyPageContributorManager.getManager();
    PropertyPageManager manager;// w ww  . j av a2  s.c o  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));
}