| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html lang="en"> |
| <HEAD> |
| |
| <meta name="copyright" content="Copyright (c) IBM Corporation and others 2000, 2011. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." > |
| |
| <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> |
| <META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css"> |
| |
| <LINK REL="STYLESHEET" HREF="../book.css" CHARSET="ISO-8859-1" TYPE="text/css"> |
| <script language="JavaScript" src="PLUGINS_ROOT/org.eclipse.help/livehelp.js" type="text/javascript"></script> |
| <TITLE> |
| Contributing a preference page |
| </TITLE> |
| |
| <link rel="stylesheet" type="text/css" HREF="../book.css"> |
| </HEAD> |
| <BODY BGCOLOR="#ffffff"> |
| <h3>Contributing a preference page</h3> |
| <P > The <b><a href="../reference/extension-points/org_eclipse_ui_preferencePages.html"> |
| org.eclipse.ui.preferencePages</a></b> extension point allows you to contribute |
| pages to the general preferences |
| |
| (<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences")'><img src="PLUGINS_ROOT/org.eclipse.help/command_link.svg" alt="command link"> |
| <b>Window > Preferences</b></a>) |
| |
| dialog. The preferences dialog presents a hierarchical list of user preference |
| entries. Each entry displays a corresponding preference page when selected.</P> |
| <P > |
| The readme tool uses this extension point to add the Readme Example preferences page.</P> |
| <pre> <extension |
| point = "org.eclipse.ui.preferencePages"> |
| <page id="org.eclipse.ui.examples.readmetool.Page1" |
| class="org.eclipse.ui.examples.readmetool.ReadmePreferencePage" |
| name="%PreferencePage.name"> |
| </page> |
| </extension></pre> |
| <P > |
| This markup defines a preference page named "Readme Example" which is implemented by the class |
| <b>ReadmePreferencePage</b>. The class must implement the |
| <b><a href="../reference/api/org/eclipse/ui/IWorkbenchPreferencePage.html"> IWorkbenchPreferencePage</a></b> interface.</P> |
| <P > The workbench uses the core runtime's preference mechanisms to access all nodes in the preference tree |
| and their corresponding pages. This list can be initialized from information in the preferences service |
| without running any plug-in code.</P> |
| <P > |
| <img src="images/preferences.png" alt="Workbench preferences page" border="0"></P> |
| <P > |
| The "Readme Example" preference is added to the top level of the |
| preference tree on the left. Why? Because a preference page contribution will be added as a root of the tree unless a |
| <b> category</b> attribute is specified. (The name <b> category</b> is somewhat misleading. |
| Perhaps a better name is |
| <b>path</b>.) The <b> category</b> attribute |
| specifies the id (or a sequence of ids from the root) of the parent page. For example, the following markup would create a second readme tool preference page, "Readme Example Child Page," as a child of the original page.</P> |
| <pre> |
| <extension |
| point = "org.eclipse.ui.preferencePages"> |
| <page |
| id="org.eclipse.ui.examples.readmetool.Page1" |
| class="org.eclipse.ui.examples.readmetool.ReadmePreferencePage" |
| name="%PreferencePage.name"> |
| </page> |
| <page |
| id="org.eclipse.ui.examples.readmetool.Page2" |
| class="org.eclipse.ui.examples.readmetool.ReadmePreferencePage2" |
| name="Readme Example Child Page" |
| category="org.eclipse.ui.examples.readmetool.Page1> |
| </page> |
| </extension> |
| </pre> |
| |
| |
| <P > |
| Once the user selects the entry for a preference page in the tree on the left, |
| the workbench will create and display a preference page using the <b> class</b> specified in the |
| extension definition. This action is what activates the plug-in (if it |
| wasn't already activated due to another user operation).</P> |
| |
| |
| |
| |
| </BODY> |
| </HTML> |