platform-update-home/doc/eclipse_plugin_customization.html

Parent Directory Parent Directory | Revision Log 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 &quot;<code>plugin_customization.ini</code>&quot;
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>&nbsp; file are a
25 :     property name qualified by the id of the plug-in; for example, the property
26 :     named &quot;<code>defaultPerspectiveId</code>&quot; in the plug-in with id
27 :     &quot;<code>org.eclispe.ui</code>&quot; is written &quot;<code>org.eclipse.ui/defaultPerspectiveId</code>&quot;.
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 &quot;<code>plugin_customization.ini</code>&quot;
34 :     should be extracted into a companion &quot;<code>plugin_customization.properties</code>&quot;
35 :     file. The &quot;<code>plugin_customization.properties</code>&quot; 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.&nbsp;</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>&lt;<i>workspace</i>&gt;/.metadata/.plugins/&lt;<i>plug-in
53 :     id</i>&gt;/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., &quot;<code>mypref</code>&quot;</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., &quot;<code>preferences.ini</code>&quot;) 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 &quot;<code>preferences.properties</code>&quot;
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 &quot;/'-separated plug-in id and name of preference;
107 :     e.g., &quot;<code>com.example.myplugin/mypref</code>&quot;.</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 &quot;<code>plugin_customization.ini</code>&quot;</li>
119 :     <li>Strings are localized using mechanism like <code>plugin.xml/plugin.properties</code></li>
120 :     <li>i.e., translatable strings extracted to &quot;<code>plugin_customization.properties</code>&quot;
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 &quot;-<code>pluginCustomization</code>&quot;
135 :     followed by a file name&nbsp;</li>
136 :     <li>Keys are same as for product packager; e.g., &quot;<code>com.example.myplugin/mypref</code>&quot;.</li>
137 :     </ul>
138 :     </li>
139 :     </ul>
140 :     <p>To summarize, the value of a preference named &quot;<code>mypref</code>&quot; from plug-in
141 :     &quot;<code>com.example.myplugin</code>&quot; is arrived at as follows:</p>
142 :     <ol>
143 :     <li>A user stated preference value for &quot;<code>mypref</code>&quot;, 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 &quot;<code>com.example.myplugin/mypref</code>&quot;,
148 :     if any.</li>
149 :     <li>An override value from primary feature for &quot;<code>com.example.myplugin/mypref</code>&quot;,
150 :     if any.</li>
151 :     <li>A default value for &quot;<code>mypref</code>&quot; as determined by plug-in
152 :     <code>com.example.myplugin</code>, if any.
153 :     <ol>
154 :     <li>A default value for &quot;<code>mypref</code>&quot; from a read-only file found
155 :     in the root directory of the plug-in, if any. </li>
156 :     <li>A default value for &quot;<code>mypref</code>&quot; 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 :