platform-update-home/doc/eclipse_plugin_customization.html
Parent Directory
|
Revision Log
Revision 1.1 - (view) (download) (as text)
| 1 : | jeem | 1.1 | <html> |
| 2 : | |||
| 3 : | <head> | ||
| 4 : | <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> | ||
| 5 : | <meta name="GENERATOR" content="Microsoft FrontPage 4.0"> | ||
| 6 : | <meta name="ProgId" content="FrontPage.Editor.Document"> | ||
| 7 : | <title>Eclipse About Dialogs</title> | ||
| 8 : | </head> | ||
| 9 : | |||
| 10 : | <body> | ||
| 11 : | |||
| 12 : | <h1>Eclipse Plug-in Customization</h1> | ||
| 13 : | <p>Last revised 19:00 Wednesday May 22, 2002</p> | ||
| 14 : | <p>This note describes how an Eclipse-based product can customize any of the | ||
| 15 : | plug-ins installed in the product.</p> | ||
| 16 : | <h2>What product developers need to know</h2> | ||
| 17 : | <p>Any plug-in may choose to expose preferences or internal configuration | ||
| 18 : | parameters that are intended to be given product-specific default settings to | ||
| 19 : | better tailor that plug-in for the product's operating environment.</p> | ||
| 20 : | <p>Product-specific customization is controlled from the product's primary | ||
| 21 : | feature through the file named "<code>plugin_customization.ini</code>" | ||
| 22 : | located within the primary feature's plug-in (a <a href="http://java.sun.com/j2se/1.3/docs/api/java/util/Properties.html">java.io.Properties</a> | ||
| 23 : | format file). Only the primary feature gets to do this; other features have no | ||
| 24 : | say. The keys in the <code>plugin_customization.ini</code> file are a | ||
| 25 : | property name qualified by the id of the plug-in; for example, the property | ||
| 26 : | named "<code>defaultPerspectiveId</code>" in the plug-in with id | ||
| 27 : | "<code>org.eclispe.ui</code>" is written "<code>org.eclipse.ui/defaultPerspectiveId</code>". | ||
| 28 : | The specified value overrides the <b> default</b> preference value | ||
| 29 : | specified by a plug-in. For user preferences, the default override determines the setting that | ||
| 30 : | will be used if the user states no preference (or asks to restore | ||
| 31 : | defaults). For internal preferences, the default override determines the setting | ||
| 32 : | that will be used (since the user has no say).</p> | ||
| 33 : | <p>Translatable strings in "<code>plugin_customization.ini</code>" | ||
| 34 : | should be extracted into a companion "<code>plugin_customization.properties</code>" | ||
| 35 : | file. The "<code>plugin_customization.properties</code>" file is | ||
| 36 : | looked for in NL-specific subdirectories within the feature plug-in or fragment | ||
| 37 : | thereof.</p> | ||
| 38 : | <p>No error is reported for a setting that specifies a non-existent plug-in; the | ||
| 39 : | default setting will be overridden in any configuration in which the plug-in is | ||
| 40 : | configured, and ignored in all others. </p> | ||
| 41 : | <p>The plug-in customization mechanism does not cause plug-in activation; | ||
| 42 : | rather, the default setting is applied the first time a plug-in's preference | ||
| 43 : | object is accessed.</p> | ||
| 44 : | <h2>What product developers do not need to know</h2> | ||
| 45 : | <p><b>N.B. The details in this section are not Eclipse platform API, and may | ||
| 46 : | change over time. Do not rely on anything described in this section.</b></p> | ||
| 47 : | <p>Individual plug-ins often define user preference settings with pre-wired | ||
| 48 : | default values.</p> | ||
| 49 : | <p>Plug-ins present their user preferences to the user via the workbench. The | ||
| 50 : | preferences start out at their pre-wired default values. Any settings that the | ||
| 51 : | user changes are saved by the plug-in in its internal preference settings file (located in the | ||
| 52 : | plug-in's state area, at <code><<i>workspace</i>>/.metadata/.plugins/<<i>plug-in | ||
| 53 : | id</i>>/pref_store.ini</code>). The most recent settings are used when the | ||
| 54 : | Eclipse platform is re-launched and the plug-in reactivated.</p> | ||
| 55 : | <p>More generally, a plug-in may also have internal preference settings that are | ||
| 56 : | never exposed to the user. For example, a plug-in might be pre-configured with a | ||
| 57 : | particular URL where the user would be directed for support (or whatever). | ||
| 58 : | Internal preference settings are even simpler than user preference settings | ||
| 59 : | because there is never a need to save values - everything works from pre-wired | ||
| 60 : | defaults.</p> | ||
| 61 : | <p>In 1.0, preference settings are supported by UI API (on AbstractUIPlugIn), | ||
| 62 : | and is therefore something that is limited to UI plug-ins. There is also an | ||
| 63 : | undocumented (and consequently unused) mechanism for overriding these default | ||
| 64 : | settings.</p> | ||
| 65 : | <p>The changes for 2.0 are as follows: make preference settings available to all | ||
| 66 : | plug-ins; provide a simple mechanism that allows a plug-in's preference default | ||
| 67 : | values to be externally configured by a product packager through the primary | ||
| 68 : | feature; and provide a simple mechanism that allows plug-in | ||
| 69 : | preference default values for a packaged product to be externally configured | ||
| 70 : | (e.g., by in house teams creating site-specific product installs).</p> | ||
| 71 : | <ul> | ||
| 72 : | <li>New Core API in Platform Runtime to support preferences. | ||
| 73 : | <ul> | ||
| 74 : | <li>These are based existing JFace preference and preference store | ||
| 75 : | APIs and implementation (based in turn on <code>java.util.Properties</code>.), | ||
| 76 : | API and implementation in <code>AbstractUIPlugIn</code>.</li> | ||
| 77 : | <li>All default preference settings are expected to be supplied by plug-in | ||
| 78 : | itself.</li> | ||
| 79 : | <li>Keys are simple name of preference; e.g., "<code>mypref</code>"</li> | ||
| 80 : | <li>Plug-in code may set initial default preference values to hard-wired | ||
| 81 : | values.</li> | ||
| 82 : | <li>Additional default preference value are retrieved from a known | ||
| 83 : | read-only file (e.g., "<code>preferences.ini</code>") in the | ||
| 84 : | plug-in's root | ||
| 85 : | directory (same format as other property settings). | ||
| 86 : | <ul> | ||
| 87 : | <li>Strings are localized using mechanism like <code>plugin.xml/plugin.properties</code></li> | ||
| 88 : | <li>i.e., translatable strings extracted to "<code>preferences.properties</code>" | ||
| 89 : | file</li> | ||
| 90 : | </ul> | ||
| 91 : | </li> | ||
| 92 : | <li>Default values from file override defaults hard-wired in code. | ||
| 93 : | <ul> | ||
| 94 : | <li>Makes it easy for plug-in writers to configure default preference | ||
| 95 : | values without changing code.</li> | ||
| 96 : | </ul> | ||
| 97 : | </li> | ||
| 98 : | </ul> | ||
| 99 : | </li> | ||
| 100 : | <li>Primary feature supplies preference default overrides. | ||
| 101 : | <ul> | ||
| 102 : | <li> The primary feature is provided by the product | ||
| 103 : | packager.</li> | ||
| 104 : | <li>This mechanism is for the product packager to customize the plug-ins | ||
| 105 : | included in the product.</li> | ||
| 106 : | <li>Keys consist of "/'-separated plug-in id and name of preference; | ||
| 107 : | e.g., "<code>com.example.myplugin/mypref</code>".</li> | ||
| 108 : | <li>A preference default override replaces the default preference value | ||
| 109 : | specified by a plug-in.</li> | ||
| 110 : | <li>For user preferences, the default override determines the setting that | ||
| 111 : | will be used if the user states no preference (or asks to restore | ||
| 112 : | defaults).</li> | ||
| 113 : | <li>For internal preferences, the default override determines the setting | ||
| 114 : | that will be used (since the user has no say).</li> | ||
| 115 : | <li>Primary feature's preference default overrides are stored in a | ||
| 116 : | properties file with feature (same format as other property settings). | ||
| 117 : | <ul> | ||
| 118 : | <li>Root file in plug-in (or fragment) for feature is named "<code>plugin_customization.ini</code>"</li> | ||
| 119 : | <li>Strings are localized using mechanism like <code>plugin.xml/plugin.properties</code></li> | ||
| 120 : | <li>i.e., translatable strings extracted to "<code>plugin_customization.properties</code>" | ||
| 121 : | file</li> | ||
| 122 : | </ul> | ||
| 123 : | </li> | ||
| 124 : | </ul> | ||
| 125 : | </li> | ||
| 126 : | <li>Allow additional preference default overrides to be supplied via the | ||
| 127 : | Eclipse command line. | ||
| 128 : | <ul> | ||
| 129 : | <li>This mechanism is for additional after-market product customization.</li> | ||
| 130 : | <li>Allows in-house teams to provide site-specific customization (e.g., | ||
| 131 : | URL of team repository).</li> | ||
| 132 : | <li>Preference default overrides specified on command line should have | ||
| 133 : | precedence over preference default overrides from primary feature.</li> | ||
| 134 : | <li>Command line option is "-<code>pluginCustomization</code>" | ||
| 135 : | followed by a file name </li> | ||
| 136 : | <li>Keys are same as for product packager; e.g., "<code>com.example.myplugin/mypref</code>".</li> | ||
| 137 : | </ul> | ||
| 138 : | </li> | ||
| 139 : | </ul> | ||
| 140 : | <p>To summarize, the value of a preference named "<code>mypref</code>" from plug-in | ||
| 141 : | "<code>com.example.myplugin</code>" is arrived at as follows:</p> | ||
| 142 : | <ol> | ||
| 143 : | <li>A user stated preference value for "<code>mypref</code>", if any. (Persisted | ||
| 144 : | in a file in the state are plug-in <code>com.example.myplugin</code>.)</li> | ||
| 145 : | <li>A default value: | ||
| 146 : | <ol> | ||
| 147 : | <li>An override value from after-market customization for "<code>com.example.myplugin/mypref</code>", | ||
| 148 : | if any.</li> | ||
| 149 : | <li>An override value from primary feature for "<code>com.example.myplugin/mypref</code>", | ||
| 150 : | if any.</li> | ||
| 151 : | <li>A default value for "<code>mypref</code>" as determined by plug-in | ||
| 152 : | <code>com.example.myplugin</code>, if any. | ||
| 153 : | <ol> | ||
| 154 : | <li>A default value for "<code>mypref</code>" from a read-only file found | ||
| 155 : | in the root directory of the plug-in, if any. </li> | ||
| 156 : | <li>A default value for "<code>mypref</code>" from code in the plug-in, | ||
| 157 : | if any.</li> | ||
| 158 : | </ol> | ||
| 159 : | </li> | ||
| 160 : | <li>The default-default value (i.e., 0 for numbers, false for booleans, | ||
| 161 : | empty string for strings, etc.).</li> | ||
| 162 : | </ol> | ||
| 163 : | </li> | ||
| 164 : | </ol> | ||
| 165 : | |||
| 166 : | </body> | ||
| 167 : | |||
| 168 : | </html> | ||
| 169 : |
| help@eclipse.org | ViewVC Help |
| Powered by ViewVC 1.0.3 |
