开发者

How do I find out the preference page ID of a preference page in Eclipse?

I'd like to know how to find out the preference page ID of an existing preference page in Eclipse. Specifically开发者_JAVA技巧, I want to find out the preference page ID of the General > Capabilities preference page in Eclipse. I have tried "org.eclipse.ui.activities.ActivityCategoryPreferencePage" and that does not seem to be working.

Thanks!


The easiest way I found, assuming you have the PDE as part of your eclipse installation, is to use the Plugin-Spy and go from there.

Open the preference page and hit Alt+Shift+F1. A 'Plug-in Selection Spy' dialog should appear. In that dialog you will find the contributing plugin and the class name for the active page. Then go to that plugin and check out its plugin.xml to find the ID.

Note that some implementations may have the ID as a constant in the viewer class, so you can start by viewing the class's code, and if it's not there, check the plugin.xml.

Cheers


I wrote some code in a command handler to find out all the preference page labels and their IDs based on http://rcpexperiments.blogspot.com/2010/03/how-to-remove-unwanted-preference-pages.html. However, the code on that site only prints out the highest-level preference nodes; whereas the page I wanted resided as a child page of the top level General (org.eclipse.ui.preferencePages.Workbench) preference page. So I modified the code slightly to print out the children as ewll.

    PreferenceManager pm = PlatformUI.getWorkbench( ).getPreferenceManager();
    List<IPreferenceNode> l = pm.getElements(PreferenceManager.PRE_ORDER);

    for(IPreferenceNode node : l){
        System.out.println("Label:" + node.getLabelText() + " ID:" + node.getId());
    }

This printed out all the preference page names and ID, after which I just did a search for the label I wanted.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜