Java 类org.eclipse.jface.preference.IPreferenceNode 实例源码

项目:jsweet-eclipse-plugin    文件:FieldEditorProjectPreferencePage.java   
private void configureWorkspaceSettings() {
    String preferenceNodeId = this.getPreferenceNodeId();
    IPreferencePage preferencePage = newPreferencePage();
    final IPreferenceNode preferenceNode = new PreferenceNode(preferenceNodeId, preferencePage);
    PreferenceManager manager = new PreferenceManager();
    manager.addToRoot(preferenceNode);
    final PreferenceDialog dialog = new PreferenceDialog(this.getControl().getShell(), manager);
    BusyIndicator.showWhile(this.getControl().getDisplay(), new Runnable() {
        @Override
        public void run() {
            dialog.create();
            dialog.setMessage(preferenceNode.getLabelText());
            dialog.open();
        }
    });
}
项目:PDFReporter-Studio    文件:FieldEditorOverlayPage.java   
/**
 * Show a single preference pages
 * 
 * @param id
 *          - the preference page identification
 * @param page
 *          - the preference page
 */
protected void showPreferencePage(String id, IPreferencePage page, final IProject project) {
    final IPreferenceNode targetNode = new PreferenceNode(id, page);
    PreferenceManager manager = new PreferenceManager();
    manager.addToRoot(targetNode);
    Shell shell = getControl().getShell();
    final PreferenceDialog dialog = project == null ? new PreferenceDialog(shell, manager) : new PropertyDialog(shell,
            manager, new StructuredSelection(project));
    BusyIndicator.showWhile(getControl().getDisplay(), new Runnable() {
        public void run() {
            dialog.create();
            dialog.setMessage(targetNode.getLabelText());
            dialog.open();
        }
    });
}
项目:JFaceUtils    文件:EnhancedPreferenceDialog.java   
@Override
protected void handleSave() {
    final Iterator<IPreferenceNode> nodes = getPreferenceManager().getElements(PreferenceManager.PRE_ORDER).iterator();
    while (nodes.hasNext()) {
        final IPreferenceNode node = nodes.next();
        final IPreferencePage page = node.getPage();
        if (page instanceof PreferencePage) {
            final IPreferenceStore store = ((PreferencePage) page).getPreferenceStore();
            if (store != null && store.needsSaving() && store instanceof IPersistentPreferenceStore) {
                try {
                    ((IPersistentPreferenceStore) store).save();
                }
                catch (final IOException ioe) {
                    final String message = JFaceMessages.get("err.preferences.save");
                    logger.log(Level.SEVERE, message, ioe);
                    EnhancedErrorDialog.openError(getShell(), title, message, IStatus.ERROR, ioe, new Image[] { Display.getCurrent().getSystemImage(SWT.ICON_ERROR) });
                }
            }
        }
    }
}
项目:APICloud-Studio    文件:PropertyLinkArea.java   
@SuppressWarnings("rawtypes")
private IPreferenceNode getPreferenceNode(String pageId)
{
    /*
     * code pulled from org.eclipse.ui.internal.dialogs.PropertyDialog - i'm not sure why this type of class doesn't
     * already exist for property pages like it does for preference pages since it seems it would be very useful -
     * guess we're breaking new ground :)
     */
    PropertyPageManager pageManager = new PropertyPageManager();
    PropertyPageContributorManager.getManager().contribute(pageManager, element);

    Iterator pages = pageManager.getElements(PreferenceManager.PRE_ORDER).iterator();

    while (pages.hasNext())
    {
        IPreferenceNode node = (IPreferenceNode) pages.next();
        if (node.getId().equals(pageId))
        {
            return node;
        }
    }

    return null;
}
项目:APICloud-Studio    文件:SWTUtil.java   
/**
 * This method allows us to open the preference dialog on the specific page, in this case the perspective page
 * 
 * @param id
 *            the id of pref page to show
 * @param page
 *            the actual page to show Copied from org.eclipse.debug.internal.ui.SWTUtil
 */
public static void showPreferencePage(String id, IPreferencePage page)
{
    final IPreferenceNode targetNode = new PreferenceNode(id, page);
    PreferenceManager manager = new PreferenceManager();
    manager.addToRoot(targetNode);
    final PreferenceDialog dialog = new PreferenceDialog(UIUtils.getActiveShell(), manager);
    BusyIndicator.showWhile(getStandardDisplay(), new Runnable()
    {
        public void run()
        {
            dialog.create();
            dialog.setMessage(targetNode.getLabelText());
            dialog.open();
        }
    });
}
项目:OpenSPIFe    文件:EnsembleWorkbenchWindowAdvisor.java   
protected final void cleanupPreferencePages() {
    Collection<Pattern> patterns = new HashSet<Pattern>();
    for (String s : getUndesirablePreferencePageIDRegExes())
        patterns.add(Pattern.compile(s));
    if (patterns.size() == 0)
        return;
    PreferenceManager manager = PlatformUI.getWorkbench().getPreferenceManager();
    for (IPreferenceNode node : manager.getRootSubNodes()) {
        for (Pattern pattern : patterns) {
            if (pattern.matcher(node.getId()).matches()) {
                manager.remove(node);
                continue;
            }
        }
        cleanupPreferencePages(node, patterns);
    }
}
项目:translationstudio8    文件:ProjectSettingDialog.java   
/**
 * Selects the saved item in the tree of preference pages. If it cannot do this it saves the first one.
 */
protected void selectSavedItem() {
    IPreferenceNode node = findNodeMatching(getSelectedNodePreference());
    if (node == null) {
        IPreferenceNode[] nodes = preferenceManager.getRootSubNodes();
        ViewerComparator comparator = getTreeViewer().getComparator();
        if (comparator != null) {
            comparator.sort(null, nodes);
        }           
        for (int i = 0; i < nodes.length; i++) {
            IPreferenceNode selectedNode = nodes[i];
            if (selectedNode != null) {
                node = selectedNode;
                break;
            }
        }
    }
    if (node != null) {
        getTreeViewer().setSelection(new StructuredSelection(node), true);
        // Keep focus in tree. See bugs 2692, 2621, and 6775.
        getTreeViewer().getControl().setFocus();
        boolean expanded = getTreeViewer().getExpandedState(node);
        getTreeViewer().setExpandedState(node, !expanded);
    }
}
项目:JettyWTPPlugin    文件:JettyRuntimeComposite.java   
protected boolean showPreferencePage()
{
    Trace.trace(Trace.CONFIG, "JettyRuntimeComposite: showPreferencePage()");

    String id = "org.eclipse.jdt.debug.ui.preferences.VMPreferencePage";

    // should be using the following API, but it only allows a single
    // preference page instance.
    // see bug 168211 for details
    // PreferenceDialog dialog =
    // PreferencesUtil.createPreferenceDialogOn(getShell(), id, new String[]
    // { id }, null);
    // return (dialog.open() == Window.OK);

    PreferenceManager manager = PlatformUI.getWorkbench().getPreferenceManager();
    IPreferenceNode node = manager.find("org.eclipse.jdt.ui.preferences.JavaBasePreferencePage").findSubNode(id);
    PreferenceManager manager2 = new PreferenceManager();
    manager2.addToRoot(node);
    PreferenceDialog dialog = new PreferenceDialog(getShell(),manager2);
    dialog.create();
    return (dialog.open() == Window.OK);
}
项目:tmxeditor8    文件:ProjectSettingDialog.java   
/**
 * Selects the saved item in the tree of preference pages. If it cannot do this it saves the first one.
 */
protected void selectSavedItem() {
    IPreferenceNode node = findNodeMatching(getSelectedNodePreference());
    if (node == null) {
        IPreferenceNode[] nodes = preferenceManager.getRootSubNodes();
        ViewerComparator comparator = getTreeViewer().getComparator();
        if (comparator != null) {
            comparator.sort(null, nodes);
        }           
        for (int i = 0; i < nodes.length; i++) {
            IPreferenceNode selectedNode = nodes[i];
            if (selectedNode != null) {
                node = selectedNode;
                break;
            }
        }
    }
    if (node != null) {
        getTreeViewer().setSelection(new StructuredSelection(node), true);
        // Keep focus in tree. See bugs 2692, 2621, and 6775.
        getTreeViewer().getControl().setFocus();
        boolean expanded = getTreeViewer().getExpandedState(node);
        getTreeViewer().setExpandedState(node, !expanded);
    }
}
项目:birt    文件:PreviewPreferencePage.java   
private void createLinkArea( Composite parent )
{
    IPreferenceNode node = getPreferenceNode( WBROWSER_PAGE_ID );
    if ( node != null )
    {
        PreferenceLinkArea linkArea = new PreferenceLinkArea( parent,
                SWT.WRAP,
                WBROWSER_PAGE_ID,
                Messages.getString( "designer.preview.preference.browser.extbrowser.link" ), //$NON-NLS-1$
                (IWorkbenchPreferenceContainer) getContainer( ),
                null );
        GridData data = new GridData( GridData.FILL_HORIZONTAL
                | GridData.GRAB_HORIZONTAL );
        linkArea.getControl( ).setLayoutData( data );
    }
}
项目:goclipse    文件:GoUIPlugin.java   
protected void checkPrefPageIdIsValid(String prefId) {
    Shell shell = WorkbenchUtils.getActiveWorkbenchShell();
    PreferenceDialog prefDialog = PreferencesUtil.createPreferenceDialogOn(shell, prefId, null, null);
    assertNotNull(prefDialog); // Don't create, just eagerly check that it exits, that the ID is correct
    ISelection selection = prefDialog.getTreeViewer().getSelection();
    if(selection instanceof IStructuredSelection) {
        IStructuredSelection ss = (IStructuredSelection) selection;
        if(ss.getFirstElement() instanceof IPreferenceNode) {
            IPreferenceNode prefNode = (IPreferenceNode) ss.getFirstElement();
            if(prefNode.getId().equals(prefId)) {
                return; // Id exists
            }
        }
    }
    assertFail();
}
项目:bts    文件:E4PreferenceRegistry.java   
private IPreferenceNode findNode(PreferenceManager pm, String categoryId)
{
    for (Object o : pm.getElements(PreferenceManager.POST_ORDER))
    {
        if (o instanceof IPreferenceNode && ((IPreferenceNode) o).getId().equals(categoryId))
        {
            return (IPreferenceNode) o;
        }
    }
    return null;
}
项目:bts    文件:ShowPreferenceDialogHandler.java   
private IPreferenceNode findNode(PreferenceManager pm, String categoryId) {
    for (Object o : pm.getElements(PreferenceManager.POST_ORDER)) {
        if (o instanceof IPreferenceNode
                && ((IPreferenceNode) o).getId().equals(categoryId)) {
            return (IPreferenceNode) o;
        }
    }
    return null;
}
项目:cppcheclipse    文件:FieldEditorOverlayPage.java   
/**
 * Show a single preference pages
 * 
 * @param id
 *            - the preference page identification
 * @param page
 *            - the preference page
 */
protected void showPreferencePage(String id, IPreferencePage page) {
    final IPreferenceNode targetNode = new PreferenceNode(id, page);
    PreferenceManager manager = new PreferenceManager();
    manager.addToRoot(targetNode);
    final PreferenceDialog dialog = new PreferenceDialog(getControl()
            .getShell(), manager);
    BusyIndicator.showWhile(getControl().getDisplay(), new Runnable() {
        public void run() {
            dialog.create();
            dialog.setMessage(targetNode.getLabelText());
            dialog.open();
        }
    });
}
项目:scouter    文件:RCPUtil.java   
public static void printPreferencePages(){
    System.out.println("=== PreferencePages ===");
    PreferenceManager preferenceManager = PlatformUI.getWorkbench().getPreferenceManager();
    @SuppressWarnings("unchecked")
    List<IPreferenceNode> preferenceNodes = preferenceManager.getElements(PreferenceManager.PRE_ORDER);
    for (Iterator<IPreferenceNode> it = preferenceNodes.iterator(); it.hasNext();) {
        IPreferenceNode preferenceNode = (IPreferenceNode)it.next();
        System.out.println(preferenceNode.getId());
    }
}
项目:Swiper    文件:FieldEditorOverlayPage.java   
/**
 * Show a single preference pages
 * @param id - the preference page identification
 * @param page - the preference page
 */
protected void showPreferencePage(String id, IPreferencePage page) {
    final IPreferenceNode targetNode = new PreferenceNode(id, page);
    PreferenceManager manager = new PreferenceManager();
    manager.addToRoot(targetNode);
    final PreferenceDialog dialog =
        new PreferenceDialog(getControl().getShell(), manager);
    BusyIndicator.showWhile(getControl().getDisplay(), new Runnable() {
        public void run() {
            dialog.create();
            dialog.setMessage(targetNode.getLabelText());
            dialog.open();
        }
    });
}
项目:Swiper    文件:OverlayPage.java   
/**
 * Show a single preference pages
 * @param id - the preference page identification
 * @param page - the preference page
 */
protected void showPreferencePage(String id, IPreferencePage page) {
    final IPreferenceNode targetNode = new PreferenceNode(id, page);
    PreferenceManager manager = new PreferenceManager();
    manager.addToRoot(targetNode);
    final PreferenceDialog dialog =
        new PreferenceDialog(getControl().getShell(), manager);
    BusyIndicator.showWhile(getControl().getDisplay(), new Runnable() {
        public void run() {
            dialog.create();
            dialog.setMessage(targetNode.getLabelText());
            dialog.open();
        }
    });
}
项目:PDFReporter-Studio    文件:OverlayPage.java   
/**
 * Show a single preference pages
 * 
 * @param id
 *          - the preference page identification
 * @param page
 *          - the preference page
 */
protected void showPreferencePage(String id, IPreferencePage page) {
    final IPreferenceNode targetNode = new PreferenceNode(id, page);
    PreferenceManager manager = new PreferenceManager();
    manager.addToRoot(targetNode);
    final PreferenceDialog dialog = new PreferenceDialog(getControl().getShell(), manager);
    BusyIndicator.showWhile(getControl().getDisplay(), new Runnable() {
        public void run() {
            dialog.create();
            dialog.setMessage(targetNode.getLabelText());
            dialog.open();
        }
    });
}
项目:JFaceUtils    文件:EnhancedPreferenceDialog.java   
@Override
protected boolean showPage(final IPreferenceNode node) {
    boolean success = super.showPage(node);
    final IPreferencePage currentPage = getCurrentPage();
    if (currentPage instanceof BasePreferencePage) {
        ((BasePreferencePage) currentPage).updateCrossChildrenStatus();
    }
    return success;
}
项目:APICloud-Studio    文件:PropertyLinkArea.java   
public PropertyLinkArea(Composite parent, int style, final String pageId, IAdaptable element, String message,
        final IWorkbenchPreferenceContainer pageContainer)
{
    this.element = element;
    pageLink = new Link(parent, style);

    IPreferenceNode node = getPreferenceNode(pageId);
    String text = null;
    if (node == null)
    {
        text = NLS.bind(WorkbenchMessages.PreferenceNode_NotFound, pageId);
    }
    else
    {
        text = NLS.bind(message, node.getLabelText());
    }

    pageLink.addSelectionListener(new SelectionAdapter()
    {
        public void widgetSelected(SelectionEvent e)
        {
            pageContainer.openPage(pageId, null);
        }
    });

    pageLink.setText(text);
}
项目:APICloud-Studio    文件:PropToPrefLinkArea.java   
public PropToPrefLinkArea(Composite parent, int style, final String pageId, String message, final Shell shell,
        final Object pageData)
{
    /*
     * breaking new ground yet again - want to link between property and preference paes. ie: project specific debug
     * engine options to general debugging options
     */
    pageLink = new Link(parent, style);

    IPreferenceNode node = getPreferenceNode(pageId);
    String result;
    if (node == null)
    {
        result = NLS.bind(WorkbenchMessages.PreferenceNode_NotFound, pageId);
    }
    else
    {
        result = MessageFormat.format(message, node.getLabelText());

        // only add the selection listener if the node is found
        pageLink.addSelectionListener(new SelectionAdapter()
        {

            public void widgetSelected(SelectionEvent e)
            {
                PreferencesUtil.createPreferenceDialogOn(shell, pageId, new String[] { pageId }, pageData).open();
            }

        });
    }
    pageLink.setText(result);

}
项目:APICloud-Studio    文件:PropToPrefLinkArea.java   
@SuppressWarnings("rawtypes")
private IPreferenceNode getPreferenceNode(String pageId)
{
    Iterator iterator = PlatformUI.getWorkbench().getPreferenceManager().getElements(PreferenceManager.PRE_ORDER)
            .iterator();
    while (iterator.hasNext())
    {
        IPreferenceNode next = (IPreferenceNode) iterator.next();
        if (next.getId().equals(pageId))
        {
            return next;
        }
    }
    return null;
}
项目:OpenSPIFe    文件:EnsembleWorkbenchWindowAdvisor.java   
private void cleanupPreferencePages(IPreferenceNode parent, Collection<Pattern> patterns) {
    for (IPreferenceNode node : parent.getSubNodes()) {
        for (Pattern pattern : patterns) {
            if (pattern.matcher(node.getId()).matches()) {
                parent.remove(node);
                continue;
            }
        }
        cleanupPreferencePages(node, patterns);
    }
}
项目:osate2-agcl    文件:FieldEditorOverlayPage.java   
protected void showPreferencePage(String id, IPreferencePage page) {
    final IPreferenceNode targetNode = new PreferenceNode(id, page);
    PreferenceManager manager = new PreferenceManager();
    manager.addToRoot(targetNode);
    final PreferenceDialog dialog = 
            new PreferenceDialog(getControl().getShell(), manager);
    BusyIndicator.showWhile(getControl().getDisplay(), new Runnable() {
        public void run() {
            dialog.create();
            dialog.setMessage(targetNode.getLabelText());
            dialog.open();
        }
    });
}
项目:CppStyle    文件:CppStylePropertyPage.java   
/**
 * Show a single preference pages
 * 
 * @param id
 *            - the preference page identification
 * @param page
 *            - the preference page
 */
protected void showPreferencePage(String id, IPreferencePage page) {
    final IPreferenceNode targetNode = new PreferenceNode(id, page);
    PreferenceManager manager = new PreferenceManager();
    manager.addToRoot(targetNode);
    final PreferenceDialog dialog = new PreferenceDialog(getControl()
            .getShell(), manager);
    BusyIndicator.showWhile(getControl().getDisplay(), new Runnable() {
        public void run() {
            dialog.create();
            dialog.setMessage(targetNode.getLabelText());
            dialog.open();
        }
    });
}
项目:vdt-plugin    文件:SetupOptionsManager.java   
private SetupOptionsManager() {
    super('/');

    IPreferenceNode node = createInstallContextNode();
    if (node != null)
        addToRoot(node);

    for (PackageContext packageContext : ToolsCore.getContextManager().getPackageContexts())
        addToRoot(createPackageInstallNode(packageContext));

    for (Tool tool : ToolsCore.getStandaloneTools())
        addToRoot(createToolInstallNode(tool));
}
项目:vdt-plugin    文件:SetupOptionsManager.java   
private IPreferenceNode createInstallContextNode() {
    installContext = ToolsCore.getContextManager().getInstallationContext();
    IPreferenceNode node = null;
    if (installContext.isVisible()) {
        node = new ContextPreferenceNode( PAGE_INSTALL_ID
                                        , VDTPluginImages.DESC_INSTALL_PROPERTIES 
                                        , installContext );
    }
    return node;
}
项目:vdt-plugin    文件:SetupOptionsManager.java   
private IPreferenceNode createPackageInstallNode(PackageContext context) {
    ImageDescriptor image = VDTPluginImages.getImageDescriptor(context);
    if (image == null)
        image = VDTPluginImages.DESC_PACKAGE_PROPERTIES;
    String page_id = PAGE_INSTALL_ID+".Package."+context.getName();
    IPreferenceNode node = new PackageInstallNode( page_id 
                                                 , image
                                                 , context );
    for (Tool tool : ToolsCore.getTools(context))
        node.add(createToolInstallNode(tool));

    return node;
}
项目:vdt-plugin    文件:SetupOptionsManager.java   
private IPreferenceNode createToolInstallNode(Tool tool) {
    ImageDescriptor image = VDTPluginImages.getImageDescriptor(tool);
    if (image == null)
        image = VDTPluginImages.DESC_RUN_TOOL;
    String page_id = PAGE_INSTALL_ID + ".Tool." + tool.getName();
    IPreferenceNode node = new ToolInstallNode( page_id
                                              , image 
                                              , tool );
    return node;
}
项目:birt    文件:PreviewPreferencePage.java   
private IPreferenceNode getPreferenceNode( String pageId )
{
    Iterator iterator = PlatformUI.getWorkbench( )
            .getPreferenceManager( )
            .getElements( PreferenceManager.PRE_ORDER )
            .iterator( );
    while ( iterator.hasNext( ) )
    {
        IPreferenceNode next = (IPreferenceNode) iterator.next( );
        if ( next.getId( ).equals( pageId ) )
            return next;
    }
    return null;
}
项目:birt    文件:StyleBuilder.java   
/**
 * Constructor
 * 
 * @param parentShell
 * @param handle
 */
public StyleBuilder( Shell parentShell, ReportElementHandle handle,
        AbstractThemeHandle theme, String title )
{
    super( parentShell, createPreferenceManager( handle, theme ) );
    setHelpAvailable( false );
    IPreferenceNode[] nodes = this.getPreferenceManager( )
            .getRootSubNodes( );
    for ( int i = 0; i < nodes.length; i++ )
    {
        ( (BaseStylePreferencePage) nodes[i].getPage( ) ).setBuilder( this );
    }
    this.title = title;

}
项目:birt    文件:StyleBuilder.java   
public Image getColumnImage( Object element, int columnIndex )
{
    if ( columnIndex == 1 )
        return ( (IPreferenceNode) element ).getLabelImage( );
    else
        return null;
}
项目:birt    文件:StyleBuilder.java   
public String getColumnText( Object element, int columnIndex )
{
    if ( columnIndex == 1 )
        return ( (IPreferenceNode) element ).getLabelText( );
    else
        return ""; //$NON-NLS-1$
}
项目:e4Preferences    文件:E4PreferenceRegistry.java   
private IPreferenceNode findNode(PreferenceManager pm, String categoryId)
{
    for (Object o : pm.getElements(PreferenceManager.POST_ORDER))
    {
        if (o instanceof IPreferenceNode && ((IPreferenceNode) o).getId().equals(categoryId))
        {
            return (IPreferenceNode) o;
        }
    }
    return null;
}
项目:tlaplus    文件:UnwantedPreferenceManager.java   
public void initialize()
{
    if (Activator.getDefault().getWorkbench() == null)
    {
        return;
    }
    PreferenceManager pm = Activator.getDefault().getWorkbench().getPreferenceManager();

    if (pm != null)
    {
        /*
         * Subpages need to be removed by calling the remove method
         * on their parent. Pages with no parent can be removed
         * by calling the remove method on the preference manager.
         * 
         * Getting the appropriate id of the page to remove can be done
         * using the code that is commented at the end of this method.
         * It will print out the name followed by the id of every preference page.
         */
        IPreferenceNode generalNode = pm.find("org.eclipse.ui.preferencePages.Workbench");
        if (generalNode != null)
        {
            // these are sub pages of general that we want removed
            generalNode.remove("org.eclipse.ui.preferencePages.Workspace");
            generalNode.remove("org.eclipse.ui.preferencePages.ContentTypes");
            // We no longer want to remove this node.
            // We only want to remove one of its sub nodes.
            // generalNode.remove("org.eclipse.ui.preferencePages.Views");
            // we only want to remove some subnodes of the Editors page
            IPreferenceNode editorsNode = generalNode.findSubNode("org.eclipse.ui.preferencePages.Editors");
            if (editorsNode != null)
            {
                // remove File Associations page
                editorsNode.remove("org.eclipse.ui.preferencePages.FileEditors");
                // want to remove only some subnodes of the Text Editors page
                IPreferenceNode textEditorsNode = editorsNode
                        .findSubNode("org.eclipse.ui.preferencePages.GeneralTextEditor");
                if (textEditorsNode != null)
                {
                    textEditorsNode.remove("org.eclipse.ui.editors.preferencePages.Spelling");
                    textEditorsNode.remove("org.eclipse.ui.editors.preferencePages.QuickDiff");
                    textEditorsNode.remove("org.eclipse.ui.editors.preferencePages.LinkedModePreferencePage");
                }
            }
            generalNode.remove("org.eclipse.ui.preferencePages.Perspectives");
            generalNode.remove("org.eclipse.equinox.security.ui.category");
            IPreferenceNode appearanceNode = generalNode.findSubNode("org.eclipse.ui.preferencePages.Views");
            if (appearanceNode != null)
            {
                // Removes the label decorators node that is a sub node of
                // the appearance node.
                // We want to keep the other sub node, colors and fonts
                // because it allows for setting the font for
                // the module editor.
                appearanceNode.remove("org.eclipse.ui.preferencePages.Decorators");
            }
        }

        // remove Install/Update
        pm.remove("org.eclipse.equinox.internal.p2.ui.sdk.ProvisioningPreferencePage");

        // remove the sub node of help
        IPreferenceNode helpNode = pm.find("org.eclipse.help.ui.browsersPreferencePage");
        if (helpNode != null)
        {
            helpNode.remove("org.eclipse.help.ui.contentPreferencePage");
        }
    }
}
项目:tlaplus    文件:ApplicationWorkbenchWindowAdvisor.java   
public void postWindowOpen() {
    final PreferenceManager preferenceManager = PlatformUI.getWorkbench().getPreferenceManager();
    final IPreferenceNode[] rootSubNodes = preferenceManager.getRootSubNodes();

    // @see Bug #191 in general/bugzilla/index.html
    final List<String> filters = new ArrayList<String>();
    filters.add("org.eclipse.compare");
    // The following three preferences are shown because the Toolbox uses
    // the local history feature provided by o.e.team.ui
    filters.add("org.eclipse.team.ui");
    filters.add("org.eclipse.ui.trace");
    filters.add("org.eclipse.jsch.ui");

    // Filter out Pdf4Eclipse preference page.
    filters.add("de.vonloesch.pdf4Eclipse");

    // Filter out GraphViz
    filters.add("com.abstratt.graphviz.ui");

    // Clean the preferences
    final List<IPreferenceNode> elements = preferenceManager.getElements(PreferenceManager.POST_ORDER);
    for (Iterator<IPreferenceNode> iterator = elements.iterator(); iterator.hasNext();) {
        final IPreferenceNode elem = iterator.next();
        if (elem instanceof IPluginContribution) {
            final IPluginContribution aPluginContribution = (IPluginContribution) elem;
            if (filters.contains(aPluginContribution.getPluginId())) {
                final IPreferenceNode node = (IPreferenceNode) elem;

                // remove from root node
                preferenceManager.remove(node);

                // remove from all subnodes
                for (int i = 0; i < rootSubNodes.length; i++) {
                    final IPreferenceNode subNode = rootSubNodes[i];
                    subNode.remove(node);
                }
            }
        }
    }
    super.postWindowOpen();

    // At this point in time we can be certain that the UI is fully
    // instantiated (views, editors, menus...). Thus, register
    // listeners that connect the UI to the workspace resources.
    ToolboxLifecycleParticipantManger.postWorkbenchWindowOpen();
}
项目:tmxeditor8    文件:PreferenceUtil.java   
public static void openPreferenceDialog(IWorkbenchWindow window, final String defaultId) {
    PreferenceManager mgr = window.getWorkbench().getPreferenceManager();
    mgr.remove("net.heartsome.cat.ui.preferencePages.Perspectives");
    mgr.remove("org.eclipse.ui.preferencePages.Workbench");
    mgr.remove("org.eclipse.update.internal.ui.preferences.MainPreferencePage");
    mgr.remove("org.eclipse.help.ui.browsersPreferencePage");
    final Object[] defaultNode = new Object[1];
    HsPreferenceDialog dlg = new HsPreferenceDialog(window.getShell(), mgr);
    dlg.create();

    final List<Image> imageList = new ArrayList<Image>();
    dlg.getTreeViewer().setLabelProvider(new PreferenceLabelProvider() {
        public Image getImage(Object element) {
            String id = ((IPreferenceNode) element).getId();
            if (defaultId != null && id.equals(defaultId)) {
                defaultNode[0] = element;
            }
            Image image = null;
            if (SystemPreferencePage.ID.equals(id)) {
                // 系统菜单
                image = Activator.getImageDescriptor("images/preference/system/system.png").createImage();
                imageList.add(image);
                return image;
            } else if ("org.eclipse.ui.preferencePages.Keys".equals(id)) {
                // 系统 > 快捷键菜单
                image = Activator.getImageDescriptor("images/preference/system/keys.png").createImage();
                imageList.add(image);
                return image;
            } else if ("org.eclipse.ui.net.proxy_preference_page_context".equals(id)) {
                // 网络连接
                image = Activator.getImageDescriptor("images/preference/system/network.png").createImage();
                imageList.add(image);
                return image;
            }  else {
                return null;
            }
        }
    });

    if (defaultNode[0] != null) {
        dlg.getTreeViewer().setSelection(new StructuredSelection(defaultNode), true);
        dlg.getTreeViewer().getControl().setFocus();
    }

    dlg.open();

    // 清理资源
    for (Image img : imageList) {
        if (img != null && !img.isDisposed()) {
            img.dispose();
        }
    }
    imageList.clear();
}
项目:birt    文件:StyleBuilder.java   
private static PreferenceManager createPreferenceManager(
        ReportElementHandle handle, AbstractThemeHandle theme )
{
    PreferenceManager preferenceManager = new PreferenceManager( '/' );

    // Get the pages from the registry
    List<IPreferenceNode> pageContributions = new ArrayList<IPreferenceNode>( );

    // adds preference pages into page contributions.
    pageContributions.add( new StylePreferenceNode( "General", //$NON-NLS-1$
            new GeneralPreferencePage( handle, theme ) ) );
    pageContributions.add( new StylePreferenceNode( "Font", //$NON-NLS-1$
            new FontPreferencePage( handle ) ) );
    pageContributions.add( new StylePreferenceNode( "Size", //$NON-NLS-1$
            new SizePreferencePage( handle ) ) );
    pageContributions.add( new StylePreferenceNode( "Background", //$NON-NLS-1$
            new BackgroundPreferencePage( handle ) ) );
    pageContributions.add( new StylePreferenceNode( "Block", //$NON-NLS-1$
            new BlockPreferencePage( handle ) ) );
    pageContributions.add( new StylePreferenceNode( "Box", //$NON-NLS-1$
            new BoxPreferencePage( handle ) ) );
    pageContributions.add( new StylePreferenceNode( "Border", //$NON-NLS-1$
            new BorderPreferencePage( handle ) ) );
    pageContributions.add( new StylePreferenceNode( "Number Format", //$NON-NLS-1$
            new FormatNumberPreferencePage( handle ) ) );
    pageContributions.add( new StylePreferenceNode( "DateTime Format", //$NON-NLS-1$
            new FormatDateTimePreferencePage( handle ) ) );
    pageContributions.add( new StylePreferenceNode( "String Format", //$NON-NLS-1$
            new FormatStringPreferencePage( handle ) ) );
    pageContributions.add( new StylePreferenceNode( "PageBreak", //$NON-NLS-1$
            new PageBreakPreferencePage( handle ) ) );
    pageContributions.add( new StylePreferenceNode( "Map", //$NON-NLS-1$
            new MapPreferencePage( handle ) ) );
    pageContributions.add( new StylePreferenceNode( "Highlights", //$NON-NLS-1$
            new HighlightsPreferencePage( handle ) ) );
    pageContributions.add( new StylePreferenceNode( "Comments", //$NON-NLS-1$
            new CommentsPreferencePage( handle ) ) );

    // Add the contributions to the manager
    Iterator<IPreferenceNode> it = pageContributions.iterator( );
    while ( it.hasNext( ) )
    {
        IPreferenceNode node = it.next( );
        preferenceManager.addToRoot( node );
    }
    return preferenceManager;
}