platform-ui-home/R3_1/undo-redo-proposal/undo-redo support.html

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (view) (download) (as text)

1 : nick 1.2 <html xmlns:v="urn:schemas-microsoft-com:vml"
2 :     xmlns:o="urn:schemas-microsoft-com:office:office"
3 : nick 1.1 xmlns:w="urn:schemas-microsoft-com:office:word"
4 : nick 1.2 xmlns:st1="urn:schemas-microsoft-com:office:smarttags"
5 : nick 1.1 xmlns="http://www.w3.org/TR/REC-html40">
6 :    
7 :     <head>
8 :     <meta http-equiv=Content-Type content="text/html; charset=windows-1252">
9 :     <meta name=ProgId content=Word.Document>
10 :     <meta name=Generator content="Microsoft Word 10">
11 :     <meta name=Originator content="Microsoft Word 10">
12 :     <link rel=File-List href="undo-redo%20support_files/filelist.xml">
13 :     <title>Undo/redo support in Eclipse</title>
14 : nick 1.2 <o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
15 :     name="date"/>
16 : nick 1.1 <!--[if gte mso 9]><xml>
17 :     <o:DocumentProperties>
18 :     <o:Author>IBM_USER</o:Author>
19 :     <o:LastAuthor>IBM_USER</o:LastAuthor>
20 : sfranklin 1.5 <o:Revision>16</o:Revision>
21 :     <o:TotalTime>4560</o:TotalTime>
22 : nick 1.1 <o:LastPrinted>2004-11-08T17:14:00Z</o:LastPrinted>
23 : sfranklin 1.3 <o:Created>2004-12-20T21:30:00Z</o:Created>
24 : sfranklin 1.5 <o:LastSaved>2005-02-23T20:07:00Z</o:LastSaved>
25 : nick 1.1 <o:Pages>1</o:Pages>
26 : sfranklin 1.5 <o:Words>3508</o:Words>
27 :     <o:Characters>20002</o:Characters>
28 : nick 1.1 <o:Company>IBM</o:Company>
29 : sfranklin 1.5 <o:Lines>166</o:Lines>
30 :     <o:Paragraphs>46</o:Paragraphs>
31 :     <o:CharactersWithSpaces>23464</o:CharactersWithSpaces>
32 : nick 1.1 <o:Version>10.6626</o:Version>
33 :     </o:DocumentProperties>
34 :     </xml><![endif]--><!--[if gte mso 9]><xml>
35 :     <w:WordDocument>
36 : sfranklin 1.4 <w:SpellingState>Clean</w:SpellingState>
37 :     <w:GrammarState>Clean</w:GrammarState>
38 : nick 1.1 <w:Compatibility>
39 :     <w:BreakWrappedTables/>
40 :     <w:SnapToGridInCell/>
41 :     <w:WrapTextWithPunct/>
42 :     <w:UseAsianBreakRules/>
43 :     </w:Compatibility>
44 :     <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
45 :     </w:WordDocument>
46 : nick 1.2 </xml><![endif]--><!--[if !mso]><object
47 :     classid="clsid:38481807-CA0E-42D2-BF39-B33AF135CC4D" id=ieooui></object>
48 :     <style>
49 :     st1\:*{behavior:url(#ieooui) }
50 :     </style>
51 :     <![endif]-->
52 : nick 1.1 <style>
53 :     <!--
54 :     /* Font Definitions */
55 :     @font-face
56 :     {font-family:Wingdings;
57 :     panose-1:5 0 0 0 0 0 0 0 0 0;
58 :     mso-font-charset:2;
59 :     mso-generic-font-family:auto;
60 :     mso-font-pitch:variable;
61 :     mso-font-signature:0 268435456 0 0 -2147483648 0;}
62 :     /* Style Definitions */
63 :     p.MsoNormal, li.MsoNormal, div.MsoNormal
64 :     {mso-style-parent:"";
65 :     margin:0in;
66 :     margin-bottom:.0001pt;
67 :     mso-pagination:widow-orphan;
68 :     font-size:12.0pt;
69 :     font-family:"Times New Roman";
70 :     mso-fareast-font-family:"Times New Roman";}
71 :     h1
72 :     {mso-style-next:Normal;
73 :     margin-top:12.0pt;
74 :     margin-right:0in;
75 :     margin-bottom:3.0pt;
76 :     margin-left:0in;
77 :     mso-pagination:widow-orphan;
78 :     page-break-after:avoid;
79 :     mso-outline-level:1;
80 :     font-size:16.0pt;
81 :     font-family:Arial;
82 :     mso-font-kerning:16.0pt;}
83 :     h2
84 :     {mso-style-next:Normal;
85 :     margin-top:12.0pt;
86 :     margin-right:0in;
87 :     margin-bottom:3.0pt;
88 :     margin-left:0in;
89 :     mso-pagination:widow-orphan;
90 :     page-break-after:avoid;
91 :     mso-outline-level:2;
92 :     font-size:14.0pt;
93 :     font-family:Arial;
94 :     font-style:italic;}
95 :     h3
96 :     {mso-style-next:Normal;
97 :     margin-top:12.0pt;
98 :     margin-right:0in;
99 :     margin-bottom:3.0pt;
100 :     margin-left:0in;
101 :     mso-pagination:widow-orphan;
102 :     page-break-after:avoid;
103 :     mso-outline-level:3;
104 :     font-size:13.0pt;
105 :     font-family:Arial;}
106 :     h4
107 :     {mso-style-next:Normal;
108 :     margin-top:12.0pt;
109 :     margin-right:0in;
110 :     margin-bottom:3.0pt;
111 :     margin-left:0in;
112 :     mso-pagination:widow-orphan;
113 :     page-break-after:avoid;
114 :     mso-outline-level:4;
115 :     font-size:14.0pt;
116 :     font-family:"Times New Roman";}
117 :     h5
118 :     {mso-style-next:Normal;
119 :     margin-top:12.0pt;
120 :     margin-right:0in;
121 :     margin-bottom:3.0pt;
122 :     margin-left:0in;
123 :     mso-pagination:widow-orphan;
124 :     mso-outline-level:5;
125 :     font-size:13.0pt;
126 :     font-family:"Times New Roman";
127 :     font-style:italic;}
128 :     p.MsoFootnoteText, li.MsoFootnoteText, div.MsoFootnoteText
129 :     {mso-style-noshow:yes;
130 :     margin:0in;
131 :     margin-bottom:.0001pt;
132 :     mso-pagination:widow-orphan;
133 :     font-size:10.0pt;
134 :     font-family:"Times New Roman";
135 :     mso-fareast-font-family:"Times New Roman";}
136 :     span.MsoFootnoteReference
137 :     {mso-style-noshow:yes;
138 :     vertical-align:super;}
139 :     p.MsoBodyText2, li.MsoBodyText2, div.MsoBodyText2
140 :     {margin-top:0in;
141 :     margin-right:0in;
142 :     margin-bottom:6.0pt;
143 :     margin-left:0in;
144 :     line-height:200%;
145 :     mso-pagination:widow-orphan;
146 :     font-size:12.0pt;
147 :     font-family:"Times New Roman";
148 :     mso-fareast-font-family:"Times New Roman";}
149 : nick 1.2 a:link, span.MsoHyperlink
150 :     {color:#0000EE;
151 :     text-decoration:underline;
152 :     text-underline:single;}
153 :     a:visited, span.MsoHyperlinkFollowed
154 :     {color:purple;
155 :     text-decoration:underline;
156 :     text-underline:single;}
157 : sfranklin 1.3 code
158 :     {font-family:"Courier New";
159 :     mso-ascii-font-family:"Courier New";
160 :     mso-fareast-font-family:"Times New Roman";
161 :     mso-hansi-font-family:"Courier New";
162 :     mso-bidi-font-family:"Courier New";}
163 :     pre
164 :     {margin:0in;
165 :     margin-bottom:.0001pt;
166 :     mso-pagination:widow-orphan;
167 :     font-size:10.0pt;
168 :     font-family:"Courier New";
169 :     mso-fareast-font-family:"Times New Roman";}
170 : sfranklin 1.4 span.SpellE
171 :     {mso-style-name:"";
172 :     mso-spl-e:yes;}
173 :     span.GramE
174 :     {mso-style-name:"";
175 :     mso-gram-e:yes;}
176 : nick 1.1 @page Section1
177 :     {size:8.5in 11.0in;
178 :     margin:1.0in .75in .5in 1.0in;
179 :     mso-header-margin:.5in;
180 :     mso-footer-margin:.5in;
181 :     mso-paper-source:0;}
182 :     div.Section1
183 :     {page:Section1;}
184 :     /* List Definitions */
185 :     @list l0
186 : sfranklin 1.5 {mso-list-id:125585718;
187 :     mso-list-template-ids:-472349186;}
188 :     @list l0:level1
189 :     {mso-level-number-format:bullet;
190 :     mso-level-text:\F0B7;
191 :     mso-level-tab-stop:.5in;
192 :     mso-level-number-position:left;
193 :     text-indent:-.25in;
194 :     mso-ansi-font-size:10.0pt;
195 :     font-family:Symbol;}
196 :     @list l1
197 :     {mso-list-id:186870198;
198 :     mso-list-template-ids:1303815946;}
199 :     @list l2
200 :     {mso-list-id:200558114;
201 :     mso-list-template-ids:-1989615594;}
202 :     @list l2:level1
203 :     {mso-level-number-format:bullet;
204 :     mso-level-text:\F0B7;
205 :     mso-level-tab-stop:.5in;
206 :     mso-level-number-position:left;
207 :     text-indent:-.25in;
208 :     mso-ansi-font-size:10.0pt;
209 :     font-family:Symbol;}
210 :     @list l3
211 : sfranklin 1.3 {mso-list-id:347761159;
212 :     mso-list-type:hybrid;
213 :     mso-list-template-ids:-1680017606 67698689 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
214 : sfranklin 1.5 @list l3:level1
215 : sfranklin 1.3 {mso-level-number-format:bullet;
216 :     mso-level-text:\F0B7;
217 :     mso-level-tab-stop:.5in;
218 :     mso-level-number-position:left;
219 :     text-indent:-.25in;
220 :     font-family:Symbol;}
221 : sfranklin 1.5 @list l3:level2
222 : nick 1.1 {mso-level-tab-stop:1.0in;
223 :     mso-level-number-position:left;
224 :     text-indent:-.25in;}
225 : sfranklin 1.5 @list l3:level3
226 : sfranklin 1.3 {mso-level-tab-stop:1.5in;
227 : nick 1.1 mso-level-number-position:left;
228 :     text-indent:-.25in;}
229 : sfranklin 1.5 @list l3:level4
230 : sfranklin 1.3 {mso-level-tab-stop:2.0in;
231 : nick 1.1 mso-level-number-position:left;
232 :     text-indent:-.25in;}
233 : sfranklin 1.5 @list l3:level5
234 : sfranklin 1.3 {mso-level-tab-stop:2.5in;
235 : nick 1.1 mso-level-number-position:left;
236 : sfranklin 1.3 text-indent:-.25in;}
237 : sfranklin 1.5 @list l3:level6
238 : sfranklin 1.3 {mso-level-tab-stop:3.0in;
239 : nick 1.1 mso-level-number-position:left;
240 : sfranklin 1.3 text-indent:-.25in;}
241 : sfranklin 1.5 @list l3:level7
242 : sfranklin 1.3 {mso-level-tab-stop:3.5in;
243 : nick 1.1 mso-level-number-position:left;
244 : sfranklin 1.3 text-indent:-.25in;}
245 : sfranklin 1.5 @list l3:level8
246 : sfranklin 1.3 {mso-level-tab-stop:4.0in;
247 : nick 1.1 mso-level-number-position:left;
248 : sfranklin 1.3 text-indent:-.25in;}
249 : sfranklin 1.5 @list l3:level9
250 : sfranklin 1.3 {mso-level-tab-stop:4.5in;
251 : nick 1.1 mso-level-number-position:left;
252 :     text-indent:-.25in;}
253 : sfranklin 1.5 @list l4
254 : sfranklin 1.3 {mso-list-id:604456885;
255 : nick 1.1 mso-list-type:hybrid;
256 : sfranklin 1.3 mso-list-template-ids:1734899956 67698703 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
257 : sfranklin 1.5 @list l4:level1
258 : nick 1.1 {mso-level-tab-stop:.5in;
259 :     mso-level-number-position:left;
260 :     text-indent:-.25in;}
261 : sfranklin 1.5 @list l4:level2
262 : nick 1.1 {mso-level-number-format:bullet;
263 :     mso-level-text:o;
264 :     mso-level-tab-stop:1.0in;
265 :     mso-level-number-position:left;
266 :     text-indent:-.25in;
267 :     font-family:"Courier New";}
268 : sfranklin 1.5 @list l4:level3
269 : nick 1.1 {mso-level-number-format:bullet;
270 :     mso-level-text:\F0A7;
271 :     mso-level-tab-stop:1.5in;
272 :     mso-level-number-position:left;
273 :     text-indent:-.25in;
274 :     font-family:Wingdings;}
275 : sfranklin 1.5 @list l4:level4
276 : nick 1.1 {mso-level-number-format:bullet;
277 :     mso-level-text:\F0B7;
278 :     mso-level-tab-stop:2.0in;
279 :     mso-level-number-position:left;
280 :     text-indent:-.25in;
281 :     font-family:Symbol;}
282 : sfranklin 1.5 @list l4:level5
283 : sfranklin 1.3 {mso-level-tab-stop:2.5in;
284 :     mso-level-number-position:left;
285 :     text-indent:-.25in;}
286 : sfranklin 1.5 @list l4:level6
287 : sfranklin 1.3 {mso-level-tab-stop:3.0in;
288 :     mso-level-number-position:left;
289 :     text-indent:-.25in;}
290 : sfranklin 1.5 @list l4:level7
291 : sfranklin 1.3 {mso-level-tab-stop:3.5in;
292 :     mso-level-number-position:left;
293 :     text-indent:-.25in;}
294 : sfranklin 1.5 @list l4:level8
295 : sfranklin 1.3 {mso-level-tab-stop:4.0in;
296 :     mso-level-number-position:left;
297 :     text-indent:-.25in;}
298 : sfranklin 1.5 @list l4:level9
299 : sfranklin 1.3 {mso-level-tab-stop:4.5in;
300 :     mso-level-number-position:left;
301 :     text-indent:-.25in;}
302 : sfranklin 1.5 @list l5
303 : sfranklin 1.3 {mso-list-id:798038152;
304 : nick 1.1 mso-list-type:hybrid;
305 : sfranklin 1.3 mso-list-template-ids:-2087438622 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
306 : sfranklin 1.5 @list l5:level1
307 : sfranklin 1.3 {mso-level-tab-stop:39.0pt;
308 :     mso-level-number-position:left;
309 :     margin-left:39.0pt;
310 :     text-indent:-.25in;}
311 : sfranklin 1.5 @list l5:level2
312 : sfranklin 1.3 {mso-level-tab-stop:1.0in;
313 :     mso-level-number-position:left;
314 :     text-indent:-.25in;}
315 : sfranklin 1.5 @list l5:level3
316 : sfranklin 1.3 {mso-level-tab-stop:1.5in;
317 :     mso-level-number-position:left;
318 :     text-indent:-.25in;}
319 : sfranklin 1.5 @list l5:level4
320 : sfranklin 1.3 {mso-level-tab-stop:2.0in;
321 :     mso-level-number-position:left;
322 :     text-indent:-.25in;}
323 : sfranklin 1.5 @list l5:level5
324 : sfranklin 1.3 {mso-level-tab-stop:2.5in;
325 :     mso-level-number-position:left;
326 :     text-indent:-.25in;}
327 : sfranklin 1.5 @list l5:level6
328 : sfranklin 1.3 {mso-level-tab-stop:3.0in;
329 :     mso-level-number-position:left;
330 :     text-indent:-.25in;}
331 : sfranklin 1.5 @list l5:level7
332 : sfranklin 1.3 {mso-level-tab-stop:3.5in;
333 :     mso-level-number-position:left;
334 :     text-indent:-.25in;}
335 : sfranklin 1.5 @list l5:level8
336 : sfranklin 1.3 {mso-level-tab-stop:4.0in;
337 :     mso-level-number-position:left;
338 :     text-indent:-.25in;}
339 : sfranklin 1.5 @list l5:level9
340 : sfranklin 1.3 {mso-level-tab-stop:4.5in;
341 : nick 1.1 mso-level-number-position:left;
342 : sfranklin 1.3 text-indent:-.25in;}
343 : sfranklin 1.5 @list l6
344 :     {mso-list-id:818612470;
345 :     mso-list-template-ids:-543663642;}
346 :     @list l7
347 :     {mso-list-id:974408184;
348 :     mso-list-template-ids:-653113708;}
349 :     @list l8
350 : sfranklin 1.3 {mso-list-id:1085106306;
351 : nick 1.1 mso-list-type:hybrid;
352 : sfranklin 1.3 mso-list-template-ids:1015583604 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
353 : sfranklin 1.5 @list l8:level1
354 : nick 1.1 {mso-level-tab-stop:.5in;
355 :     mso-level-number-position:left;
356 :     text-indent:-.25in;}
357 : sfranklin 1.5 @list l8:level2
358 : sfranklin 1.3 {mso-level-tab-stop:1.0in;
359 :     mso-level-number-position:left;
360 :     text-indent:-.25in;}
361 : sfranklin 1.5 @list l8:level3
362 : sfranklin 1.3 {mso-level-tab-stop:1.5in;
363 :     mso-level-number-position:left;
364 :     text-indent:-.25in;}
365 : sfranklin 1.5 @list l8:level4
366 : sfranklin 1.3 {mso-level-tab-stop:2.0in;
367 :     mso-level-number-position:left;
368 :     text-indent:-.25in;}
369 : sfranklin 1.5 @list l8:level5
370 : sfranklin 1.3 {mso-level-tab-stop:2.5in;
371 :     mso-level-number-position:left;
372 :     text-indent:-.25in;}
373 : sfranklin 1.5 @list l8:level6
374 : sfranklin 1.3 {mso-level-tab-stop:3.0in;
375 :     mso-level-number-position:left;
376 :     text-indent:-.25in;}
377 : sfranklin 1.5 @list l8:level7
378 : sfranklin 1.3 {mso-level-tab-stop:3.5in;
379 :     mso-level-number-position:left;
380 :     text-indent:-.25in;}
381 : sfranklin 1.5 @list l8:level8
382 : sfranklin 1.3 {mso-level-tab-stop:4.0in;
383 :     mso-level-number-position:left;
384 :     text-indent:-.25in;}
385 : sfranklin 1.5 @list l8:level9
386 : sfranklin 1.3 {mso-level-tab-stop:4.5in;
387 :     mso-level-number-position:left;
388 :     text-indent:-.25in;}
389 : sfranklin 1.5 @list l9
390 : sfranklin 1.3 {mso-list-id:1478297229;
391 : nick 1.1 mso-list-type:hybrid;
392 : sfranklin 1.3 mso-list-template-ids:-438127954 67698689 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
393 : sfranklin 1.5 @list l9:level1
394 : nick 1.1 {mso-level-number-format:bullet;
395 :     mso-level-text:\F0B7;
396 :     mso-level-tab-stop:.5in;
397 :     mso-level-number-position:left;
398 :     text-indent:-.25in;
399 :     font-family:Symbol;}
400 : sfranklin 1.5 @list l9:level2
401 : sfranklin 1.3 {mso-level-tab-stop:1.0in;
402 :     mso-level-number-position:left;
403 :     text-indent:-.25in;}
404 : sfranklin 1.5 @list l9:level3
405 : sfranklin 1.3 {mso-level-tab-stop:1.5in;
406 : nick 1.1 mso-level-number-position:left;
407 : sfranklin 1.3 text-indent:-.25in;}
408 : sfranklin 1.5 @list l9:level4
409 : sfranklin 1.3 {mso-level-tab-stop:2.0in;
410 : nick 1.1 mso-level-number-position:left;
411 :     text-indent:-.25in;}
412 : sfranklin 1.5 @list l9:level5
413 : sfranklin 1.3 {mso-level-tab-stop:2.5in;
414 : nick 1.1 mso-level-number-position:left;
415 :     text-indent:-.25in;}
416 : sfranklin 1.5 @list l9:level6
417 : sfranklin 1.3 {mso-level-tab-stop:3.0in;
418 : nick 1.1 mso-level-number-position:left;
419 : sfranklin 1.3 text-indent:-.25in;}
420 : sfranklin 1.5 @list l9:level7
421 : sfranklin 1.3 {mso-level-tab-stop:3.5in;
422 : nick 1.1 mso-level-number-position:left;
423 : sfranklin 1.3 text-indent:-.25in;}
424 : sfranklin 1.5 @list l9:level8
425 : sfranklin 1.3 {mso-level-tab-stop:4.0in;
426 : nick 1.1 mso-level-number-position:left;
427 : sfranklin 1.3 text-indent:-.25in;}
428 : sfranklin 1.5 @list l9:level9
429 : sfranklin 1.3 {mso-level-tab-stop:4.5in;
430 : nick 1.1 mso-level-number-position:left;
431 : sfranklin 1.3 text-indent:-.25in;}
432 : sfranklin 1.5 @list l10
433 : sfranklin 1.3 {mso-list-id:1723091313;
434 : nick 1.1 mso-list-type:hybrid;
435 : sfranklin 1.3 mso-list-template-ids:-1797201838 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
436 : sfranklin 1.5 @list l10:level1
437 : nick 1.1 {mso-level-tab-stop:.5in;
438 :     mso-level-number-position:left;
439 :     text-indent:-.25in;}
440 : sfranklin 1.5 @list l10:level2
441 : sfranklin 1.3 {mso-level-tab-stop:1.0in;
442 : nick 1.1 mso-level-number-position:left;
443 : sfranklin 1.3 text-indent:-.25in;}
444 : sfranklin 1.5 @list l10:level3
445 : sfranklin 1.3 {mso-level-tab-stop:1.5in;
446 : nick 1.1 mso-level-number-position:left;
447 : sfranklin 1.3 text-indent:-.25in;}
448 : sfranklin 1.5 @list l10:level4
449 : sfranklin 1.3 {mso-level-tab-stop:2.0in;
450 : nick 1.1 mso-level-number-position:left;
451 : sfranklin 1.3 text-indent:-.25in;}
452 : sfranklin 1.5 @list l10:level5
453 : sfranklin 1.3 {mso-level-tab-stop:2.5in;
454 : nick 1.1 mso-level-number-position:left;
455 : sfranklin 1.3 text-indent:-.25in;}
456 : sfranklin 1.5 @list l10:level6
457 : sfranklin 1.3 {mso-level-tab-stop:3.0in;
458 : nick 1.1 mso-level-number-position:left;
459 :     text-indent:-.25in;}
460 : sfranklin 1.5 @list l10:level7
461 : sfranklin 1.3 {mso-level-tab-stop:3.5in;
462 : nick 1.1 mso-level-number-position:left;
463 : sfranklin 1.3 text-indent:-.25in;}
464 : sfranklin 1.5 @list l10:level8
465 : sfranklin 1.3 {mso-level-tab-stop:4.0in;
466 : nick 1.1 mso-level-number-position:left;
467 : sfranklin 1.3 text-indent:-.25in;}
468 : sfranklin 1.5 @list l10:level9
469 : sfranklin 1.3 {mso-level-tab-stop:4.5in;
470 : nick 1.1 mso-level-number-position:left;
471 : sfranklin 1.3 text-indent:-.25in;}
472 : sfranklin 1.5 @list l11
473 : nick 1.1 {mso-list-id:1731031428;
474 :     mso-list-type:hybrid;
475 :     mso-list-template-ids:1886447558 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
476 : sfranklin 1.5 @list l11:level1
477 : nick 1.1 {mso-level-tab-stop:39.0pt;
478 :     mso-level-number-position:left;
479 :     margin-left:39.0pt;
480 :     text-indent:-.25in;}
481 : sfranklin 1.5 @list l11:level2
482 : sfranklin 1.3 {mso-level-tab-stop:1.0in;
483 :     mso-level-number-position:left;
484 :     text-indent:-.25in;}
485 : sfranklin 1.5 @list l11:level3
486 : sfranklin 1.3 {mso-level-tab-stop:1.5in;
487 :     mso-level-number-position:left;
488 :     text-indent:-.25in;}
489 : sfranklin 1.5 @list l11:level4
490 : sfranklin 1.3 {mso-level-tab-stop:2.0in;
491 :     mso-level-number-position:left;
492 :     text-indent:-.25in;}
493 : sfranklin 1.5 @list l11:level5
494 : sfranklin 1.3 {mso-level-tab-stop:2.5in;
495 :     mso-level-number-position:left;
496 :     text-indent:-.25in;}
497 : sfranklin 1.5 @list l11:level6
498 : sfranklin 1.3 {mso-level-tab-stop:3.0in;
499 :     mso-level-number-position:left;
500 :     text-indent:-.25in;}
501 : sfranklin 1.5 @list l11:level7
502 : sfranklin 1.3 {mso-level-tab-stop:3.5in;
503 :     mso-level-number-position:left;
504 :     text-indent:-.25in;}
505 : sfranklin 1.5 @list l11:level8
506 : sfranklin 1.3 {mso-level-tab-stop:4.0in;
507 : nick 1.1 mso-level-number-position:left;
508 : sfranklin 1.3 text-indent:-.25in;}
509 : sfranklin 1.5 @list l11:level9
510 : sfranklin 1.3 {mso-level-tab-stop:4.5in;
511 : nick 1.1 mso-level-number-position:left;
512 : sfranklin 1.3 text-indent:-.25in;}
513 : nick 1.1 ol
514 :     {margin-bottom:0in;}
515 :     ul
516 :     {margin-bottom:0in;}
517 :     -->
518 :     </style>
519 :     <!--[if gte mso 10]>
520 :     <style>
521 :     /* Style Definitions */
522 :     table.MsoNormalTable
523 :     {mso-style-name:"Table Normal";
524 :     mso-tstyle-rowband-size:0;
525 :     mso-tstyle-colband-size:0;
526 :     mso-style-noshow:yes;
527 :     mso-style-parent:"";
528 :     mso-padding-alt:0in 5.4pt 0in 5.4pt;
529 :     mso-para-margin:0in;
530 :     mso-para-margin-bottom:.0001pt;
531 :     mso-pagination:widow-orphan;
532 :     font-size:10.0pt;
533 :     font-family:"Times New Roman";}
534 :     </style>
535 :     <![endif]-->
536 :     </head>
537 :    
538 : nick 1.2 <body lang=EN-US link="#0000EE" vlink=purple style='tab-interval:.5in'>
539 : nick 1.1
540 :     <div class=Section1>
541 :    
542 :     <h1>Generalized Undo Support in Eclipse</h1>
543 :    
544 : nick 1.2 <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'>Last
545 : sfranklin 1.5 updated:<span style='mso-spacerun:yes'>  </span></span><st1:date Year="2005"
546 :     Day="22" Month="2"><span style='font-size:10.0pt;font-family:Arial'>Feb. 22,
547 :     2005</span></st1:date><span style='font-size:10.0pt;font-family:Arial'><o:p></o:p></span></p>
548 : nick 1.2
549 :     <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'>Status:<span
550 : sfranklin 1.5 style='mso-spacerun:yes'>  </span>Proposal – Implemented in 3.1M5<o:p></o:p></span></p>
551 : sfranklin 1.3
552 : sfranklin 1.4 <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'>(<span
553 : sfranklin 1.5 class=GramE>see</span> also bug <span style='mso-spacerun:yes'> </span></span><a
554 : nick 1.2 href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=37716">37716</a>)<span
555 :     style='font-size:10.0pt;font-family:Arial'><o:p></o:p></span></p>
556 :    
557 : sfranklin 1.3 <h2>Problem Description</h2>
558 : nick 1.1
559 : sfranklin 1.5 <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'>In R3.0.1
560 :     of the Eclipse SDK, there is no generalized support for undoing user
561 :     actions.<span style='mso-spacerun:yes'>  </span>Each plug-in is left to
562 :     implement its own strategy for undo, if at all.<span style='mso-spacerun:yes'> 
563 :     </span>This approach can cause problems for both Eclipse users and plug-in
564 :     developers:<o:p></o:p></span></p>
565 : sfranklin 1.3
566 :     <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'><span
567 :     style='mso-spacerun:yes'> </span><o:p></o:p></span></p>
568 :    
569 :     <ul style='margin-top:0in' type=disc>
570 : sfranklin 1.5 <li class=MsoNormal style='mso-list:l3 level1 lfo3;tab-stops:list .5in'><span
571 : sfranklin 1.3 style='font-size:10.0pt;font-family:Arial'>Undo and redo actions appear in
572 :     different menus, causing user confusion and UI clutter<o:p></o:p></span></li>
573 : sfranklin 1.5 <li class=MsoNormal style='mso-list:l3 level1 lfo3;tab-stops:list .5in'><span
574 : sfranklin 1.3 style='font-size:10.0pt;font-family:Arial'>Undo and redo implementations
575 :     may have different semantics.<o:p></o:p></span></li>
576 : sfranklin 1.5 <li class=MsoNormal style='mso-list:l3 level1 lfo3;tab-stops:list .5in'><span
577 : sfranklin 1.3 style='font-size:10.0pt;font-family:Arial'>Plug-ins that depend on other
578 :     plug-ins which implement their own undo strategy are forced to choose
579 :     between different implementations and possibly write integration code to
580 :     allow the different frameworks to coexist.<o:p></o:p></span></li>
581 :     </ul>
582 : nick 1.1
583 :     <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></p>
584 :    
585 : sfranklin 1.3 <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'>Further,
586 :     the meaning of undo can be very different depending on what the user is
587 :     doing.<span style='mso-spacerun:yes'>  </span>The most common type of undo is
588 :     text undo.<span style='mso-spacerun:yes'>  </span>The user can undo lightweight
589 :     edit operations such as inserting, replacing, or deleting text.<span
590 :     style='mso-spacerun:yes'>  </span>Other types of undo may involve more complex,
591 :     heavyweight operations that affect an underlying model of many elements.<span
592 :     style='mso-spacerun:yes'>  </span>For example, the JDT refactoring support
593 :     provides undo support for refactoring operations that involve many Java
594 :     elements at different levels, such as Java packages, compilation units,
595 :     classes, and methods.<o:p></o:p></span></p>
596 :    
597 :     <h2>Operations Framework</h2>
598 : nick 1.1
599 : sfranklin 1.3 <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'>The
600 : sfranklin 1.5 proposed framework defines an interface for describing work, called an “undoable
601 :     operation” (<span class=SpellE>IUndoableOperation</span><span class=GramE>),
602 :     that</span> can be executed, undone, and redone.<span
603 :     style='mso-spacerun:yes'>  </span>Undoable operations are created, executed,
604 :     and added to an operations history (<span class=SpellE>IOperationHistory</span>).<span
605 : sfranklin 1.4 style='mso-spacerun:yes'>  </span>Operations which are comprised of distinct
606 : sfranklin 1.5 steps should be represented as compound operations, which are executed, undone,
607 :     or redone as a unit, and can never be partially undone.<span
608 :     style='mso-spacerun:yes'>  </span><o:p></o:p></span></p>
609 : nick 1.1
610 :     <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></p>
611 :    
612 : sfranklin 1.3 <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'>Operations
613 : sfranklin 1.5 can be assigned one or more contexts (<span class=SpellE>IUndoContext</span>)
614 :     to which they apply.<span style='mso-spacerun:yes'>  </span>An undo context
615 :     describes the context in which the user is working when an operation is performed,
616 :     undone, or redone.<span style='mso-spacerun:yes'>  </span>Undo contexts can be
617 :     used by workbench parts to filter the operations history, so that only those
618 :     operations that have been assigned the context of interest to a particular part
619 :     are available for undo/redo when that part is active.<o:p></o:p></span></p>
620 : nick 1.1
621 :     <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></p>
622 :    
623 : sfranklin 1.3 <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'>The
624 : sfranklin 1.5 interface for undo contexts is left very general so that operation implementers
625 :     may choose the appropriate representation for their contexts.<span
626 : sfranklin 1.3 style='mso-spacerun:yes'>  </span>In some cases, a part-oriented context may be
627 :     appropriate. For example, a text editor’s context is related to the editor
628 :     itself and its life-cycle is similar to that of the editor.<span
629 : sfranklin 1.5 style='mso-spacerun:yes'>  </span>The resource navigator’s context is closely
630 :     related to the workspace model objects, and the context related to the
631 :     workspace has a life cycle to similar to that of the workspace itself.<o:p></o:p></span></p>
632 : sfranklin 1.3
633 :     <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></p>
634 : nick 1.1
635 : sfranklin 1.3 <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'>Contexts
636 :     can be assigned to operations in multiple ways:<o:p></o:p></span></p>
637 : nick 1.1
638 :     <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></p>
639 :    
640 : sfranklin 1.5 <p class=MsoNormal style='margin-left:39.0pt;text-indent:-.25in;mso-list:l11 level1 lfo5;
641 : sfranklin 1.3 tab-stops:list 39.0pt'><![if !supportLists]><span style='font-size:10.0pt;
642 :     font-family:Arial;mso-fareast-font-family:Arial'><span style='mso-list:Ignore'>1.<span
643 :     style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><![endif]><span
644 :     style='font-size:10.0pt;font-family:Arial'>The context can be assigned
645 :     initially when the operation is created.<span style='mso-spacerun:yes'> 
646 :     </span>For example, text operations are triggered by typing in the editor, and
647 :     the editor can assign its context to the operation before adding it to the
648 :     history.<span style='mso-spacerun:yes'>  </span><o:p></o:p></span></p>
649 :    
650 : sfranklin 1.5 <p class=MsoNormal style='margin-left:39.0pt;text-indent:-.25in;mso-list:l11 level1 lfo5;
651 : sfranklin 1.3 tab-stops:list 39.0pt'><![if !supportLists]><span style='font-size:10.0pt;
652 :     font-family:Arial;mso-fareast-font-family:Arial'><span style='mso-list:Ignore'>2.<span
653 :     style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><![endif]><span
654 :     style='font-size:10.0pt;font-family:Arial'>A listener interface on the
655 :     operations history allows listeners to detect when an operation is added to the
656 :     history.<span style='mso-spacerun:yes'>  </span>Listeners can decide if their
657 :     context should be added to the operation.<span style='mso-spacerun:yes'> 
658 : nick 1.1 </span><o:p></o:p></span></p>
659 :    
660 : sfranklin 1.5 <p class=MsoNormal style='margin-left:39.0pt;text-indent:-.25in;mso-list:l11 level1 lfo5;
661 :     tab-stops:list 39.0pt'><![if !supportLists]><span style='font-size:10.0pt;
662 :     font-family:Arial;mso-fareast-font-family:Arial'><span style='mso-list:Ignore'>3.<span
663 :     style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><![endif]><span
664 :     style='font-size:10.0pt;font-family:Arial'>Operations can be executed in a
665 :     batch mode.<span style='mso-spacerun:yes'>  </span>When a batching operation is
666 :     being executed, any other operations that execute have their contexts assigned
667 :     to the batch operation.<o:p></o:p></span></p>
668 :    
669 : sfranklin 1.3 <p class=MsoNormal style='margin-left:21.0pt'><span style='font-size:10.0pt;
670 :     font-family:Arial'><o:p>&nbsp;</o:p></span></p>
671 :    
672 :     <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'>An
673 :     operation may have more than one context.<span style='mso-spacerun:yes'> 
674 :     </span>For example, an operation may affect many elements in the workspace,
675 :     including one that is currently open in an editor.<span
676 :     style='mso-spacerun:yes'>  </span>That operation could be assigned two
677 :     independent contexts, so that it can be undone from both the editor and the
678 :     view manipulating the model.<span style='mso-spacerun:yes'>   </span><o:p></o:p></span></p>
679 :    
680 : nick 1.1 <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></p>
681 :    
682 : sfranklin 1.3 <h2>Levels of Integration and Migration</h2>
683 :    
684 :     <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'>Many
685 :     plug-ins have already invested heavily in building objects that describe
686 :     undoable user commands or operations.<span style='mso-spacerun:yes'>  </span>It
687 :     is not expected that all plug-ins will adopt the framework completely, given
688 :     the individual schedules and other constraints for each plug-in.<span
689 :     style='mso-spacerun:yes'>  </span>However, the integration can be achieved in
690 :     phases that will immediately provide value to dependent plug-ins.<span
691 :     style='mso-spacerun:yes'>  </span>The following adoption strategy is strongly
692 :     encouraged:<o:p></o:p></span></p>
693 : nick 1.1
694 :     <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></p>
695 :    
696 :     <ol style='margin-top:0in' start=1 type=1>
697 : sfranklin 1.5 <li class=MsoNormal style='mso-list:l10 level1 lfo8;tab-stops:list .5in'><span
698 :     style='font-size:10.0pt;font-family:Arial'>Existing command/undo
699 :     frameworks can implement the <span class=SpellE>IUndoableOperation</span>
700 :     interface on their existing command objects, while still maintaining their
701 :     individual strategies for managing undo stacks or histories.<span
702 : sfranklin 1.4 style='mso-spacerun:yes'>  </span>If there is a substantial investment in
703 :     an existing model-based operation or command framework, wrappers could be
704 : sfranklin 1.5 used to map <span class=SpellE>IUndoableOperation</span> protocol to the
705 :     existing protocol.<span style='mso-spacerun:yes'>  </span>The
706 :     commands/operations need not be assigned a context or added to a common
707 :     operation history.<span style='mso-spacerun:yes'>  </span>This level of
708 :     integration allows command hierarchies built in different frameworks to be
709 :     treated the same by plug-ins that depend upon these different
710 :     frameworks.<span style='mso-spacerun:yes'>  </span>Clients of existing
711 :     command frameworks may then use the workbench operation history, assign
712 :     contexts to operations as needed, and even add operations to the history,
713 :     while still using commands built on earlier frameworks.<o:p></o:p></span></li>
714 :     <li class=MsoNormal style='mso-list:l10 level1 lfo8;tab-stops:list .5in'><span
715 : sfranklin 1.3 style='font-size:10.0pt;font-family:Arial'>Existing command/undo
716 :     frameworks may use the listener interfaces provided by the operations
717 :     history to listen for operations that are of interest.<span
718 :     style='mso-spacerun:yes'>  </span>These commands may be wrapped or
719 :     otherwise recorded so that they can be undone from privately maintained
720 :     undo implementations.<span style='mso-spacerun:yes'>  </span>This level of
721 :     integration allows views and editors to appear more tightly integrated
722 :     with the operations framework, since workbench operations of interest can
723 :     be undone or redone from private undo implementations.<o:p></o:p></span></li>
724 : sfranklin 1.5 <li class=MsoNormal style='mso-list:l10 level1 lfo8;tab-stops:list .5in'><span
725 : sfranklin 1.3 style='font-size:10.0pt;font-family:Arial'>Full integration is achieved by
726 :     using the workbench operation history to record the undo and redo history
727 :     as operations occur.<span style='mso-spacerun:yes'>  </span>Once all
728 :     plug-ins share an operation history, clients will be able to use unified
729 :     listeners and handlers to track execution of operations, undo, and redo
730 :     them.<span style='mso-spacerun:yes'>  </span><o:p></o:p></span></li>
731 : nick 1.1 </ol>
732 :    
733 :     <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></p>
734 :    
735 : sfranklin 1.3 <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'>Framework
736 : sfranklin 1.5 interfaces will be defined in the <span class=SpellE>org.eclipse.core.commands.operations</span>
737 :     package in the <span class=SpellE>org.eclipse.core.commands</span>
738 :     plug-in.<span style='mso-spacerun:yes'>  </span>This plug-in has no
739 :     dependencies on the Eclipse runtime architecture (apart from some runtime classes
740 :     such as <span class=SpellE>IProgressMonitor</span>, <span class=SpellE>IStatus</span>,
741 :     <span class=SpellE><span class=GramE>IAdaptable</span></span>), so raw <span
742 :     class=SpellE>JFace</span> clients may make use of it.<o:p></o:p></span></p>
743 :    
744 :     <h2>Operations and Concurrency</h2>
745 :    
746 :     <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'>The
747 :     operations framework relies on the notion of sequential execution of undoable
748 :     operations.<span style='mso-spacerun:yes'>  </span>For R3.1, there will be no
749 :     specific support built into the framework for concurrent operations that
750 :     execute inside platform Jobs.<span style='mso-spacerun:yes'>  </span>Actions whose
751 :     work is currently executed inside a Job may be converted to <span class=SpellE>IUndoableOperation</span>,
752 :     but they should not be added to the operation history until after they have
753 :     finished their execution.<span style='mso-spacerun:yes'>  </span>The undo and
754 :     redo behavior for these kinds of <span class=SpellE>IUndoableOperation</span> must
755 :     be implemented in a synchronous manner for R3.1, since the validity of other
756 :     operations in the operation history may not be properly determined if an undo
757 :     or redo is executing asynchronously in a Job.<span style='mso-spacerun:yes'> 
758 :     </span>More robust support for concurrent, undoable operations may be
759 :     considered in future releases as requirements are discovered.<o:p></o:p></span></p>
760 : sfranklin 1.3
761 :     <h2>Framework interfaces</h2>
762 :    
763 : sfranklin 1.5 <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'>Initial
764 :     implementations of the proposed framework interfaces appear in R3.1 M5.<span
765 :     style='mso-spacerun:yes'>  </span>See the <span class=SpellE>Javadoc</span> for
766 :     the described classes for the complete specification.<span
767 :     style='mso-spacerun:yes'>   </span>Please note that the specification is still
768 :     evolving and early adopters should be prepared for API changes throughout the
769 :     R3.1 development cycle.<o:p></o:p></span></p>
770 :    
771 :     <h3><span class=SpellE>IUndoableOperation</span></h3>
772 : sfranklin 1.3
773 : sfranklin 1.4 <p class=MsoNormal><span class=SpellE><span style='font-size:10.0pt;font-family:
774 : sfranklin 1.5 Arial'>IUndoableOperation</span></span><span style='font-size:10.0pt;
775 :     font-family:Arial'> defines an operation that can be executed, undone, and
776 :     redone.<span style='mso-spacerun:yes'>  </span>Operations typically have fully
777 :     defined parameters. That is, they are usually created after the user has been
778 :     queried for any input needed to define the operation.<o:p></o:p></span></p>
779 : nick 1.1
780 : sfranklin 1.3 <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></p>
781 : nick 1.1
782 : sfranklin 1.3 <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'>Operations
783 :     determine their ability to execute, undo, or redo according to the current
784 :     state of the application. They do not make decisions about their validity based
785 :     on where they occur in the operation history. That is left to the particular
786 :     operation history.<o:p></o:p></span></p>
787 : nick 1.1
788 :     <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></p>
789 :    
790 : sfranklin 1.4 <h3><span class=SpellE>IOperationHistory</span></h3>
791 : nick 1.1
792 : sfranklin 1.4 <p class=MsoNormal><span class=SpellE><span style='font-size:10.0pt;font-family:
793 :     Arial'>IOperationHistory</span></span><span style='font-size:10.0pt;font-family:
794 :     Arial'> tracks a history of operations that can be undone or redone. Operations
795 : sfranklin 1.5 are added to the history after they have been initially executed. Clients may
796 : sfranklin 1.4 choose whether to have the operations history perform the initial execution or
797 :     simply add the operation to the history. Once operations are added to the
798 : sfranklin 1.5 history, the methods <span class=SpellE><span class=GramE>canRedo</span></span><span
799 :     class=GramE>(</span>) and <span class=SpellE>canUndo</span>() are used to
800 :     determine whether there is an operation available for undo and redo in a given undo
801 :     context.<span style='mso-spacerun:yes'>  </span>The context-based protocol
802 :     implies that there is only one operation that can be undone or redone at a
803 :     given time in a given context. This is typical of a linear undo model, when
804 :     only the most recently executed operation is available for undo. When this
805 :     protocol is used, a linear model is enforced by the history. It is up to
806 :     clients to determine how to maintain a history that is invalid or stale. For
807 :     example, when the most recent operation for a context cannot be performed,
808 :     clients may wish to flush the history for that context.<o:p></o:p></span></p>
809 : nick 1.1
810 :     <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></p>
811 :    
812 : sfranklin 1.3 <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'>Additional
813 :     protocol allows direct undo and redo of a specified operation, regardless of
814 :     its position in the history. When a more flexible undo model is supported,
815 :     these methods can be implemented to undo and redo directly specified
816 : sfranklin 1.4 operations. If an implementer of <span class=SpellE>IOperationHistory</span>
817 :     does not allow direct undo and redo, these methods can return a status
818 :     indicating that it is not allowed.<o:p></o:p></span></p>
819 : sfranklin 1.3
820 : nick 1.1 <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></p>
821 :    
822 : sfranklin 1.4 <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'>Listeners (<span
823 :     class=SpellE>IOperationHistoryListener</span>) can listen for notifications
824 :     about changes in the history (operations added or removed), and for
825 :     notification before and after any operation is executed, undone or redone.
826 :     Notification of operation execution only occurs when clients direct the history
827 :     to execute the operation. If the operation is added after it is executed, there
828 :     can be no notification of its execution.<o:p></o:p></span></p>
829 : nick 1.1
830 :     <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></p>
831 :    
832 : sfranklin 1.4 <p class=MsoNormal><span class=SpellE><span style='font-size:10.0pt;font-family:
833 :     Arial'>IOperationApprover</span></span><span style='font-size:10.0pt;
834 :     font-family:Arial'> defines an interface for approving an undo or redo before
835 :     it occurs. This is useful for injecting policy-decisions into the model -
836 :     whether direct undo and redo are supported, or warning the user about certain
837 :     kinds of operations. It can also be used when objects have state related to the
838 :     operation and need to determine whether an undo or redo will cause any
839 :     conflicts with their local state.<o:p></o:p></span></p>
840 : nick 1.1
841 : sfranklin 1.4 <h3><span class=SpellE>IOperationApprover</span></h3>
842 : nick 1.1
843 : sfranklin 1.4 <p class=MsoNormal><span class=SpellE><span style='font-size:10.0pt;font-family:
844 :     Arial'>IOperationApprover</span></span><span style='font-size:10.0pt;
845 :     font-family:Arial'> defines an interface for approving the undo or redo of a
846 :     particular operation within an operation history. Operations that are
847 :     candidates for undo or redo have already been validated against their current
848 :     state and according to the rules of the history.<o:p></o:p></span></p>
849 : nick 1.1
850 :     <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></p>
851 :    
852 : sfranklin 1.3 <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'>By the time
853 : sfranklin 1.4 an <span class=SpellE>IOperationApprover</span> is consulted, the undo has
854 :     already been requested. Approvers should true if the operation should proceed,
855 :     and false if it should not. When an operation is rejected, it is expected that
856 :     the object rejecting the operation has already consulted the user if necessary
857 :     or otherwise provided any necessary information to the user about the
858 : sfranklin 1.5 rejection.<span style='mso-spacerun:yes'>  </span>If an undo or redo is
859 :     triggered from the UI, clients provide UI info (such as an <span class=SpellE>org.eclipse.swt.Shell</span>)
860 :     to assist in prompting the user where necessary.<o:p></o:p></span></p>
861 : nick 1.1
862 : sfranklin 1.4 <h3><span class=SpellE>IOperationHistoryListener</span></h3>
863 : nick 1.1
864 : sfranklin 1.5 <p class=MsoNormal><span class=SpellE><span style='font-size:10.0pt;font-family:
865 :     Arial'>IOperationHistoryListener</span></span><span style='font-size:10.0pt;
866 :     font-family:Arial'> defines the interface for being notified about particular
867 :     events that take place inside the operation history.<o:p></o:p></span></p>
868 : nick 1.1
869 : sfranklin 1.5 <h3><span class=SpellE>OperationHistoryEvent</span></h3>
870 : nick 1.1
871 : sfranklin 1.5 <p class=MsoNormal><span class=SpellE><span style='font-size:10.0pt;font-family:
872 :     Arial'>OperationHistoryEvent</span></span><span style='font-size:10.0pt;
873 :     font-family:Arial'> defines the different types of events that occur inside an
874 :     operation history.<span style='mso-spacerun:yes'>  </span><span class=GramE>Listeners
875 :     are notified before and after an operation is</span> executed, undone, or
876 :     redone.<span style='mso-spacerun:yes'>  </span>Listeners are also notified when
877 :     operations are added or removed from the history.<o:p></o:p></span></p>
878 : nick 1.1
879 : sfranklin 1.5 <h3><span class=SpellE>OperationHistoryFactory</span></h3>
880 : nick 1.1
881 : sfranklin 1.5 <p class=MsoNormal><span class=SpellE><span style='font-size:10.0pt;font-family:
882 :     Arial'>OperationHistoryFactory</span></span><span style='font-size:10.0pt;
883 :     font-family:Arial'> provides access to a singleton instance of an operation
884 :     history.<span style='mso-spacerun:yes'>  </span>This factory will provide a
885 :     default implementation for an operation history if one is not set by a
886 :     caller.<span style='mso-spacerun:yes'>  </span>Once the singleton is obtained
887 :     by any client, the instance cannot be reset.<o:p></o:p></span></p>
888 : nick 1.1
889 : sfranklin 1.3 <h2>UI Support Classes<span style='font-size:10.0pt'><o:p></o:p></span></h2>
890 :    
891 : sfranklin 1.4 <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'>Additional
892 : sfranklin 1.5 support classes are provided in the package <span class=SpellE>org.eclipse.ui.operations</span>.<span
893 : sfranklin 1.3 style='mso-spacerun:yes'>  </span>These classes handle policy decisions about
894 :     the undo model to be used by the workbench.<span style='mso-spacerun:yes'> 
895 : sfranklin 1.5 </span>Access to the undo and redo handlers, as well as the operations history,
896 : sfranklin 1.3 will be provided through workbench.<o:p></o:p></span></p>
897 : nick 1.1
898 : sfranklin 1.3 <h3>Workbench Operation History</h3>
899 :    
900 :     <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'>The
901 : sfranklin 1.5 workbench will configure the default operation history supplied by the <span
902 :     class=SpellE>OperationHistoryFactory</span> and register an <span class=SpellE>IUndoContext</span>
903 :     adapter onto the workspace.<span style='mso-spacerun:yes'> 
904 :     </span>Configuration of the operation history includes setting an undo limit
905 :     for the workspace undo context and adding an <span class=SpellE>IOperationApprover</span>
906 :     that enforces a per-context linear undo model.<span style='mso-spacerun:yes'> 
907 :     </span><o:p></o:p></span></p>
908 : nick 1.1
909 : sfranklin 1.3 <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></p>
910 : nick 1.1
911 : sfranklin 1.5 <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'>Undo
912 :     contexts will be defined for text editors and for the workspace.<span
913 :     style='mso-spacerun:yes'>  </span>Throughout the development of R3.1, plug-ins
914 :     will be encouraged to define operations that represent their existing actions
915 :     or command handlers.<span style='mso-spacerun:yes'>  </span>Additional contexts
916 :     may be defined by plug-ins as necessary.<span style='mso-spacerun:yes'> 
917 :     </span>Undoable operations will be added incrementally once the framework is in
918 : sfranklin 1.3 place.<span style='mso-spacerun:yes'>  </span><o:p></o:p></span></p>
919 : nick 1.1
920 : sfranklin 1.5 <h3><span class=SpellE>IWorkbenchOperationSupport</span></h3>
921 : nick 1.1
922 : sfranklin 1.5 <p class=MsoNormal><span class=SpellE><span style='font-size:10.0pt;font-family:
923 :     Arial'>IWorkbenchOperationSupport</span></span><span style='font-size:10.0pt;
924 :     font-family:Arial'> provides access to the workbench operation history and the
925 :     workspace undo context.<span style='mso-spacerun:yes'>  </span>Although these objects
926 :     are actually managed elsewhere (in the <span class=SpellE>OperationHistoryFactory</span>
927 :     and as an adapter on the workspace), <span class=SpellE>IWorkbenchOperationSupport</span>
928 :     provides integrated access to all undo facilities used by the workbench.<span
929 :     style='mso-spacerun:yes'>  </span>Plug-ins aware of the workbench will typically
930 :     get the <span class=SpellE>IWorkbenchOperationSupport</span> from the workbench
931 :     to obtain the appropriate context and operation history.<span
932 :     style='mso-spacerun:yes'>  </span>Lower-level (headless) plug-ins that implement
933 :     undo support will use the lower level constructs, such as the <span
934 :     class=SpellE>OperationHistoryFactory</span>, to obtain these objects.</span><o:p></o:p></p>
935 : nick 1.1
936 : sfranklin 1.5 <h3><span class=SpellE>UndoActionHandler</span> and <span class=SpellE>RedoActionHandler</span></h3>
937 : nick 1.1
938 : sfranklin 1.3 <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'>The
939 :     Edit&gt;Undo and Edit&gt;Redo commands should be handled by any parts that wish
940 :     to support undo.<span style='mso-spacerun:yes'>  </span>Common handlers for the
941 :     undo and redo commands will be provided.<span style='mso-spacerun:yes'> 
942 : sfranklin 1.5 </span>These handlers can be assigned an undo context that should be used to
943 :     filter the undo and redo history.<span style='mso-spacerun:yes'>  </span>The
944 :     handlers are responsible for the following:<o:p></o:p></span></p>
945 : sfranklin 1.3
946 :     <ul style='margin-top:0in' type=disc>
947 : sfranklin 1.5 <li class=MsoNormal style='mso-list:l9 level1 lfo11;tab-stops:list .5in'><span
948 : sfranklin 1.3 style='font-size:10.0pt;font-family:Arial'>Undo and Redo commands will be
949 :     enabled based on the status of the history.<o:p></o:p></span></li>
950 : sfranklin 1.5 <li class=MsoNormal style='mso-list:l9 level1 lfo11;tab-stops:list .5in'><span
951 : sfranklin 1.3 style='font-size:10.0pt;font-family:Arial'>The Undo and Redo commands will
952 :     be appended with the label of the operation for the handler’s context.<o:p></o:p></span></li>
953 : sfranklin 1.5 <li class=MsoNormal style='mso-list:l9 level1 lfo11;tab-stops:list .5in'><span
954 :     style='font-size:10.0pt;font-family:Arial'>The handlers can be configured
955 :     to flush the undo and redo history for their context whenever the most
956 :     recent operation in the history is invalid.<span
957 :     style='mso-spacerun:yes'>  </span>This aggressive maintenance of the
958 :     history is the most conservative approach for ensuring that the history
959 :     contains valid operations, and this strategy may evolve with experience.<span
960 :     style='mso-spacerun:yes'>  </span>Localized undo contexts, such as text
961 :     edits, may not need this aggressive pruning of the history.<o:p></o:p></span></li>
962 : sfranklin 1.3 </ul>
963 :    
964 :     <h3>Undo and Redo Toolbar Items</h3>
965 :    
966 :     <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'>Time
967 :     permitting, classes that support toolbar dropdown items for undo and redo will
968 :     be developed.<span style='mso-spacerun:yes'>  </span>These will also be
969 :     assigned a context.<span style='mso-spacerun:yes'>  </span>By clicking on the
970 :     drop-down arrow, the user will see the history for that particular
971 :     context.<span style='mso-spacerun:yes'>  </span>The user will only be able to
972 :     select a range, starting from the top item, to be undone or redone.<span
973 :     style='mso-spacerun:yes'>  </span>It is expected that the ability to view the
974 :     history is more valuable to the user than the ability to multi-select
975 :     operations for undo.<o:p></o:p></span></p>
976 : nick 1.1
977 : sfranklin 1.3 <h3>Operation Approvers</h3>
978 : nick 1.1
979 : sfranklin 1.5 <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'>The <span
980 :     class=SpellE>IOperationApprover</span> installed by the workbench enforces a
981 :     per-context linear undo model by consulting all contexts of an operation to
982 :     determine whether undo or redo should proceed.<span style='mso-spacerun:yes'> 
983 :     </span>The policy is described as follows:<o:p></o:p></span></p>
984 : nick 1.1
985 :     <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></p>
986 :    
987 : sfranklin 1.3 <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'>The
988 :     workbench will allow undo or redo of any valid operation in the history, <i
989 :     style='mso-bidi-font-style:normal'>as long as there are no more recent
990 :     operations in the history that share a context with the operation to be
991 : sfranklin 1.4 executed.</i><span style='mso-spacerun:yes'>   </span>If the operation to be
992 : sfranklin 1.3 undone or redone has contexts that are also present in operations appearing
993 :     later in the history, then the undo or redo of the operation will not be
994 :     permitted.<o:p></o:p></span></p>
995 : nick 1.1
996 :     <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></p>
997 :    
998 : sfranklin 1.3 <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'>A concrete
999 :     example will help explain this.<span style='mso-spacerun:yes'>  </span><o:p></o:p></span></p>
1000 :    
1001 :     <ol style='margin-top:0in' start=1 type=1>
1002 : sfranklin 1.5 <li class=MsoNormal style='mso-list:l4 level1 lfo14;tab-stops:list .5in'><span
1003 : sfranklin 1.3 style='font-size:10.0pt;font-family:Arial'>The user makes local edits in
1004 :     editor A.<o:p></o:p></span></li>
1005 : sfranklin 1.5 <li class=MsoNormal style='mso-list:l4 level1 lfo14;tab-stops:list .5in'><span
1006 : sfranklin 1.3 style='font-size:10.0pt;font-family:Arial'>The user initiates a
1007 :     refactoring operation whose context is “A” and “workspace.”<o:p></o:p></span></li>
1008 : sfranklin 1.5 <li class=MsoNormal style='mso-list:l4 level1 lfo14;tab-stops:list .5in'><span
1009 : sfranklin 1.3 style='font-size:10.0pt;font-family:Arial'>The user makes additional local
1010 :     edits to editor A.<o:p></o:p></span></li>
1011 : sfranklin 1.5 <li class=MsoNormal style='mso-list:l4 level1 lfo14;tab-stops:list .5in'><span
1012 : sfranklin 1.3 style='font-size:10.0pt;font-family:Arial'>The user goes to the navigator
1013 :     and selects Undo.<o:p></o:p></span></li>
1014 :     </ol>
1015 : nick 1.1
1016 :     <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></p>
1017 :    
1018 : sfranklin 1.4 <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'>In the
1019 :     proposed implementation, the navigator requests an undo for the workspace
1020 :     context.<span style='mso-spacerun:yes'>  </span>The refactoring operation
1021 :     triggered in the editor is the most recent operation that has the workspace
1022 :     context, but it also contains context “A.”<span style='mso-spacerun:yes'> 
1023 :     </span>Since subsequent operations in the history also have context “A,”, the
1024 :     operation will not be allowed.<span style='mso-spacerun:yes'>  </span>An
1025 :     explanation will be provided to the user after the fact:<span
1026 :     style='mso-spacerun:yes'>  </span>“Cannot undo the refactoring operation
1027 :     because there have been subsequent changes to A.”<span
1028 :     style='mso-spacerun:yes'>  </span><o:p></o:p></span></p>
1029 : nick 1.1
1030 : sfranklin 1.3 <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></p>
1031 :    
1032 :     <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'>Future
1033 :     releases may warn the user or provide a preference to determine whether the
1034 :     undo should proceed anyway, and whether the subsequent changes to “A” should
1035 :     also be undone, or be flushed from the history. Early prototypes of the
1036 :     framework showed that such warnings interrupt workflow and can be very
1037 :     difficult to understand, so the initial UI will be to prohibit the undo,
1038 :     explaining why.<span style='mso-spacerun:yes'>   </span><o:p></o:p></span></p>
1039 :    
1040 :     <h2>Migration Examples</h2>
1041 : nick 1.1
1042 : sfranklin 1.3 <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'>The
1043 :     following examples explain how existing code can be migrated to use the
1044 :     operations framework.<span style='mso-spacerun:yes'>  </span>An early prototype
1045 :     used these techniques to integrate the SDK text editor, refactoring framework,
1046 :     and sample applications into a common undo framework.<span
1047 :     style='mso-spacerun:yes'>  </span></span></p>
1048 :    
1049 :     <h3>Mapping existing actions or command handlers to operations</h3>
1050 :    
1051 : sfranklin 1.5 <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'>Converting an
1052 :     existing action to use operations is straightforward, apart from implementing
1053 :     the undo and redo behavior for the action.<span style='mso-spacerun:yes'> 
1054 :     </span>The run() or <span class=SpellE>runWithEvent</span> method inside the
1055 :     action should create an operation, execute it, and add it to the operations
1056 :     history, rather than run the code inside the method.<span
1057 : sfranklin 1.3 style='mso-spacerun:yes'>  </span>The following code shows the existing run()
1058 : sfranklin 1.4 method in the <span class=SpellE>EditorAction</span> of the <span class=SpellE>readme</span>
1059 :     tool example (<span class=SpellE>org.eclipse.ui.examples.readmetool</span>):<o:p></o:p></span></p>
1060 : nick 1.1
1061 :     <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></p>
1062 :    
1063 : sfranklin 1.4 <pre>public void run() {</pre><pre><span style='mso-spacerun:yes'>            </span>String <span
1064 :     class=SpellE>editorName</span> = <span class=SpellE>MessageUtil.getString</span>(&quot;<span
1065 :     class=SpellE>Empty_Editor_Name</span>&quot;); </pre><pre><span style='mso-spacerun:yes'>            </span>if (<span
1066 : sfranklin 1.5 class=SpellE>activeEditor</span> != null)</pre><pre><span style='mso-spacerun:yes'>                </span><span
1067 : sfranklin 1.4 class=SpellE>editorName</span> = <span class=SpellE>activeEditor.getTitle</span>();</pre><pre><span style='mso-spacerun:yes'>            </span><span
1068 :     class=SpellE>MessageDialog</span></pre><pre><span style='mso-spacerun:yes'>                    </span>.<span
1069 :     class=SpellE>openInformation</span>(</pre><pre><span style='mso-spacerun:yes'>                            </span>shell,</pre><pre><span style='mso-spacerun:yes'>                            </span><span
1070 :     class=SpellE>MessageUtil.getString</span>(&quot;<span class=SpellE>Readme_Editor</span>&quot;), </pre><pre><span style='mso-spacerun:yes'>                            </span><span
1071 :     class=SpellE>MessageUtil.format</span>(&quot;<span class=SpellE>ReadmeEditorActionExecuted</span>&quot;, </pre><pre><span
1072 :     style='mso-tab-count:4'>                               </span>new Object[] { <span
1073 :     class=SpellE>getText</span>(), <span class=SpellE>editorName</span> })); </pre><pre><span style='mso-spacerun:yes'>        </span>}</pre><pre><span
1074 : sfranklin 1.3 style='font-family:Arial'>Using operations, the run method simplifies:<o:p></o:p></span></pre><pre><span
1075 : sfranklin 1.4 style='font-family:Arial'><o:p>&nbsp;</o:p></span></pre><pre><span style='mso-spacerun:yes'>        </span>public void run() {</pre><pre><span style='mso-spacerun:yes'>            </span>String <span
1076 :     class=SpellE>editorName</span> = <span class=SpellE>MessageUtil.getString</span>(&quot;<span
1077 : sfranklin 1.5 class=SpellE>Empty_Editor_Name</span>&quot;); </pre><pre><span style='mso-spacerun:yes'>            </span>if (<span
1078 : sfranklin 1.4 class=SpellE>activeEditor</span> != null)</pre><pre><span style='mso-spacerun:yes'>                </span><span
1079 :     class=SpellE>editorName</span> = <span class=SpellE>activeEditor.getTitle</span>();</pre><pre><span style='mso-spacerun:yes'>            </span>// create the operation</pre><pre><span style='mso-spacerun:yes'>            </span><span
1080 : sfranklin 1.5 class=SpellE>IUndoableOperation</span> operation = new <span class=SpellE><span
1081 :     class=GramE>EditorOperation</span></span><span class=GramE>(</span></pre><pre><span
1082 : sfranklin 1.4 style='mso-tab-count:2'>               </span><span class=SpellE>getText</span>(),shell, <span
1083 : sfranklin 1.5 class=SpellE>editorName</span>);</pre><pre><span style='mso-spacerun:yes'>            </span>// execute (and add to the history)</pre><pre><span style='mso-spacerun:yes'>            </span><span
1084 :     class=SpellE>history.execute</span>(operation, null, null);<span style='mso-spacerun:yes'>  </span></pre><pre><span style='mso-spacerun:yes'>        </span>}</pre><pre><span
1085 : sfranklin 1.3 style='font-family:Arial'>The operation encapsulates the old run behavior, as well as the undo and redo for the operation:<o:p></o:p></span></pre><pre><span
1086 : sfranklin 1.4 style='font-family:Arial'><o:p>&nbsp;</o:p></span></pre><pre>class <span
1087 :     class=SpellE>EditorOperation</span> extends <span class=SpellE>AbstractOperation</span> {</pre><pre><span style='mso-spacerun:yes'>        </span>Shell <span
1088 :     class=SpellE>fShell</span>;</pre><pre><span style='mso-spacerun:yes'>        </span>String <span
1089 : sfranklin 1.5 class=SpellE>fEditorName</span>;</pre><pre><span style='mso-spacerun:yes'>        </span>public <span
1090 : sfranklin 1.4 class=SpellE>EditorOperation</span>(String label, Shell <span class=SpellE>shell</span>, String <span
1091 :     class=SpellE>editorName</span>) {</pre><pre><span style='mso-spacerun:yes'>            </span>super(label);</pre><pre><span style='mso-spacerun:yes'>            </span><span
1092 :     class=SpellE>fShell</span> = shell;</pre><pre><span style='mso-spacerun:yes'>            </span><span
1093 : sfranklin 1.5 class=SpellE>fEditorName</span> = <span class=SpellE>editorName</span>;</pre><pre><span style='mso-spacerun:yes'>            </span></pre><pre><span style='mso-spacerun:yes'>   </span><span style='mso-spacerun:yes'>     </span>}</pre><pre><span style='mso-spacerun:yes'>        </span>public <span
1094 :     class=SpellE>IStatus</span> execute(<span class=SpellE>IProgressMonitor</span> monitor) {</pre><pre><span style='mso-spacerun:yes'>            </span><span
1095 : sfranklin 1.4 class=SpellE>MessageDialog.openInformation</span>(</pre><pre><span style='mso-spacerun:yes'>                    </span><span
1096 :     class=SpellE>fShell</span>,</pre><pre><span style='mso-spacerun:yes'>                    </span><span
1097 :     class=SpellE>MessageUtil.getString</span>(&quot;<span class=SpellE>Readme_Editor</span>&quot;), </pre><pre><span style='mso-spacerun:yes'>                    </span><span
1098 :     class=SpellE>MessageUtil.format</span>(&quot;<span class=SpellE>ReadmeEditorActionExecuted</span>&quot;, </pre><pre><span
1099 :     style='mso-tab-count:3'>                       </span>new Object[] { <span
1100 :     class=SpellE>getLabel</span>(), <span class=SpellE>fEditorName</span> }));<span style='mso-spacerun:yes'>  </span></pre><pre><span style='mso-spacerun:yes'>            </span>return <span
1101 :     class=SpellE>Status.OK_STATUS</span>;</pre><pre><span style='mso-spacerun:yes'>        </span>}</pre><pre><span style='mso-spacerun:yes'>        </span>public <span
1102 :     class=SpellE>IStatus</span> undo(<span class=SpellE>IProgressMonitor</span> monitor) {</pre><pre><span style='mso-spacerun:yes'>            </span>// implement the undo here</pre><pre><span style='mso-spacerun:yes'>            </span>return <span
1103 : sfranklin 1.5 class=SpellE>Status.OK_STATUS</span>;</pre><pre><span style='mso-spacerun:yes'>        </span>}</pre><pre><span style='mso-spacerun:yes'>      </span><span style='mso-spacerun:yes'>  </span>public <span
1104 : sfranklin 1.4 class=SpellE>IStatus</span> redo(<span class=SpellE>IProgressMonitor</span> monitor) {</pre><pre><span style='mso-spacerun:yes'>            </span>// implement the redo here</pre><pre><span style='mso-spacerun:yes'>            </span>return <span
1105 :     class=SpellE>Status.OK_STATUS</span>;</pre><pre><span style='mso-spacerun:yes'>        </span>}</pre><pre><span style='mso-spacerun:yes'>    </span>}</pre><pre><o:p>&nbsp;</o:p></pre><pre><span
1106 :     style='font-family:Arial'>If an <span class=SpellE>IHandler</span> is provided for a command instead of using actions, the execute method of the handler is mapped similarly to the run method in an action:<o:p></o:p></span></pre><pre><span
1107 :     style='font-family:Arial'><o:p>&nbsp;</o:p></span></pre><pre><span style='mso-spacerun:yes'>        </span>public Object execute(Map <span
1108 :     class=SpellE>params</span>) throws <span class=SpellE>ExecutionException</span> {</pre><pre><span style='mso-spacerun:yes'>        </span>try {</pre><pre><span
1109 :     style='mso-tab-count:1'>        </span><span style='mso-spacerun:yes'>    </span><span
1110 :     class=SpellE>IEditorPart</span> <span class=SpellE>activeEditor</span> = <span
1111 :     class=SpellE>params.get</span>(&quot;ACTIVE_EDITOR&quot;);</pre><pre><span
1112 :     style='mso-tab-count:1'>        </span><span style='mso-spacerun:yes'>    </span>Shell <span
1113 :     class=SpellE>shell</span> = <span class=SpellE>params.get</span>(&quot;SHELL&quot;);</pre><pre><span
1114 :     style='mso-tab-count:1'>        </span><span style='mso-spacerun:yes'>    </span>String label = <span
1115 :     class=SpellE>params.get</span>(&quot;NAME&quot;);</pre><pre><span
1116 :     style='mso-tab-count:1'>        </span><span style='mso-spacerun:yes'>    </span>String <span
1117 :     class=SpellE>editorName</span> = <span class=SpellE>MessageUtil.getString</span>(&quot;<span
1118 :     class=SpellE>Empty_Editor_Name</span>&quot;); </pre><pre><span style='mso-spacerun:yes'>            </span>if (<span
1119 :     class=SpellE>activeEditor</span> != null)</pre><pre><span style='mso-spacerun:yes'>                </span><span
1120 :     class=SpellE>editorName</span> = <span class=SpellE>activeEditor.getTitle</span>();</pre><pre><span style='mso-spacerun:yes'>            </span>// create the operation</pre><pre><span style='mso-spacerun:yes'>            </span><span
1121 : sfranklin 1.5 class=SpellE>IUndoableOperation</span> operation =new <span class=SpellE><span
1122 :     class=GramE>EditorOperation</span></span><span class=GramE>(</span>label, shell, <span
1123 : sfranklin 1.4 class=SpellE>editorName</span>);</pre><pre><o:p>&nbsp;</o:p></pre><pre><span style='mso-spacerun:yes'>            </span>// execute (and add to the history)</pre><pre><span style='mso-spacerun:yes'>            </span><span
1124 : sfranklin 1.5 class=SpellE><span class=GramE>history.execute</span></span><span class=GramE>(</span>operation, null, null);</pre><pre><span style='mso-spacerun:yes'>        </span>} catch (Exception e) {</pre><pre><span style='mso-spacerun:yes'>            </span>throw new <span
1125 : sfranklin 1.4 class=SpellE>ExecutionException</span>(</pre><pre><span style='mso-spacerun:yes'>                    </span>&quot;While executing the operation, an exception occurred&quot;, e); </pre><pre><span style='mso-spacerun:yes'>        </span>}</pre><pre><span style='mso-spacerun:yes'>        </span>return null;</pre><pre><span style='mso-spacerun:yes'>    </span>}</pre><pre><span
1126 :     style='font-family:Arial'><o:p>&nbsp;</o:p></span></pre>
1127 :    
1128 :     <p class=MsoNormal><span class=GramE><span style='font-size:10.0pt;font-family:
1129 :     Arial'>When an action launches a wizard.</span></span><span style='font-size:
1130 :     10.0pt;font-family:Arial'> <span class=GramE>then</span> the operation is
1131 :     typically created as part of processing the “Finish” button in the wizard.<span
1132 :     style='mso-spacerun:yes'>  </span>Some restructuring may be required.<span
1133 :     style='mso-spacerun:yes'>  </span>For example, wizards are often implemented in
1134 :     hierarchies and make use of convenience methods in the wizard hierarchy.<span
1135 :     style='mso-spacerun:yes'>  </span>Some of these methods may have to move to a
1136 :     corresponding hierarchy of operations. <o:p></o:p></span></p>
1137 : sfranklin 1.3
1138 :     <h3>Refactoring example:<span style='mso-spacerun:yes'>  </span>mapping
1139 : sfranklin 1.5 existing protocol to <span class=SpellE>IUndoableOperation</span></h3>
1140 : sfranklin 1.3
1141 : sfranklin 1.5 <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'>In the
1142 :     current SDK implementation, <span class=SpellE>org.eclipse.ltk.core.refactoring</span>
1143 : sfranklin 1.4 provides an undo framework for undoing refactoring operations.<span
1144 :     style='mso-spacerun:yes'>  </span>This framework is based on the notion of
1145 :     “Change” objects.<span style='mso-spacerun:yes'>  </span>Change objects that
1146 :     can be undone are responsible for returning the undo version of a change when
1147 :     they are executed.<span style='mso-spacerun:yes'>  </span>An undo stack is
1148 :     maintained by an internal undo manager.<span style='mso-spacerun:yes'> 
1149 :     </span>This undo manager invalidates the history whenever an unknown workspace
1150 :     change occurs.<span style='mso-spacerun:yes'>  </span>Undo-aware objects send
1151 :     signals to the undo manager as they perform operations, so that the undo
1152 :     manager will not invalidate the history.<o:p></o:p></span></p>
1153 : nick 1.1
1154 :     <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></p>
1155 :    
1156 : sfranklin 1.3 <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'>A prototype
1157 :     integrated the refactoring change framework with the operations framework as
1158 :     follows:<o:p></o:p></span></p>
1159 : nick 1.1
1160 : sfranklin 1.5 <p class=MsoNormal style='margin-left:39.0pt;text-indent:-.25in;mso-list:l5 level1 lfo16;
1161 : sfranklin 1.3 tab-stops:list 39.0pt'><![if !supportLists]><span style='font-size:10.0pt;
1162 :     font-family:Arial;mso-fareast-font-family:Arial'><span style='mso-list:Ignore'>1.<span
1163 :     style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><![endif]><span
1164 : sfranklin 1.5 style='font-size:10.0pt;font-family:Arial'>The change objects are <span
1165 :     class=SpellE>wrappered</span> with a class that implements <span class=SpellE>IUndoableOperation</span>
1166 :     and maps the operation protocol to the Change protocol.<o:p></o:p></span></p>
1167 : sfranklin 1.3
1168 : sfranklin 1.5 <p class=MsoNormal style='margin-left:39.0pt;text-indent:-.25in;mso-list:l5 level1 lfo16;
1169 : sfranklin 1.3 tab-stops:list 39.0pt'><![if !supportLists]><span style='font-size:10.0pt;
1170 :     font-family:Arial;mso-fareast-font-family:Arial'><span style='mso-list:Ignore'>2.<span
1171 :     style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><![endif]><span
1172 : sfranklin 1.5 style='font-size:10.0pt;font-family:Arial'>The refactoring undo manager is
1173 : sfranklin 1.3 replaced with an alternate implementation that uses the operations history to
1174 :     maintain the undo and redo history.<o:p></o:p></span></p>
1175 : nick 1.1
1176 : sfranklin 1.5 <p class=MsoNormal style='margin-left:39.0pt;text-indent:-.25in;mso-list:l5 level1 lfo16;
1177 : sfranklin 1.3 tab-stops:list 39.0pt'><![if !supportLists]><span style='font-size:10.0pt;
1178 :     font-family:Arial;mso-fareast-font-family:Arial'><span style='mso-list:Ignore'>3.<span
1179 :     style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><![endif]><span
1180 : sfranklin 1.5 style='font-size:10.0pt;font-family:Arial'>The workspace listener and
1181 :     validation strategy used in the Change framework is maintained, since the
1182 :     timing of the notifications was critical.<span style='mso-spacerun:yes'> 
1183 :     </span>Additional integration work could be done to use the operations history
1184 :     listeners for the same purpose, or to change the validation strategy as more
1185 :     workspace operations are supported outside of refactoring.<o:p></o:p></span></p>
1186 : nick 1.1
1187 : sfranklin 1.5 <p class=MsoNormal style='margin-left:39.0pt;text-indent:-.25in;mso-list:l5 level1 lfo16;
1188 : sfranklin 1.3 tab-stops:list 39.0pt'><![if !supportLists]><span style='font-size:10.0pt;
1189 :     font-family:Arial;mso-fareast-font-family:Arial'><span style='mso-list:Ignore'>4.<span
1190 :     style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><![endif]><span
1191 : sfranklin 1.5 style='font-size:10.0pt;font-family:Arial'>When a refactoring change is
1192 :     executed, an operation is “opened” in the operations history.<span
1193 :     style='mso-spacerun:yes'>  </span>Subsequent operations added to the history
1194 :     are considered part of the open operation, and their contexts are assigned to
1195 :     the original operation.<span style='mso-spacerun:yes'>  </span>When the
1196 :     refactoring change is finished, the operation is closed.<span
1197 :     style='mso-spacerun:yes'>  </span><o:p></o:p></span></p>
1198 : nick 1.1
1199 : sfranklin 1.5 <p class=MsoNormal style='margin-left:39.0pt;text-indent:-.25in;mso-list:l5 level1 lfo16;
1200 : sfranklin 1.3 tab-stops:list 39.0pt'><![if !supportLists]><span style='font-size:10.0pt;
1201 :     font-family:Arial;mso-fareast-font-family:Arial'><span style='mso-list:Ignore'>5.<span
1202 :     style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><![endif]><span
1203 :     style='font-size:10.0pt;font-family:Arial'>Refactoring operations could be
1204 :     undone and redone from any view or editor that installed the undo and redo
1205 :     handlers on the workspace context.<o:p></o:p></span></p>
1206 :    
1207 : sfranklin 1.4 <h3>Text editor example:<span style='mso-spacerun:yes'>  </span>implementing <span
1208 : sfranklin 1.5 class=SpellE>IUndoableOperation</span> in preexisting commands</h3>
1209 : sfranklin 1.3
1210 : sfranklin 1.4 <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'>The <span
1211 :     class=SpellE>JFace</span> text framework supports undo and redo of text editing
1212 :     operations.<span style='mso-spacerun:yes'>  </span>This implementation relies
1213 :     on private undo stacks that are maintained by each editor.<span
1214 :     style='mso-spacerun:yes'>  </span>The <span class=SpellE>JFace</span> <span
1215 :     class=SpellE>IUndoManager</span> listens to text changes coming from the
1216 :     underlying widget, and builds a <span class=SpellE>TextCommand</span> for each
1217 :     undoable edit.<span style='mso-spacerun:yes'>  </span><o:p></o:p></span></p>
1218 : nick 1.1
1219 : sfranklin 1.3 <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></p>
1220 : nick 1.1
1221 : sfranklin 1.3 <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial'>A prototype
1222 : sfranklin 1.4 integrated the text undo in <span class=SpellE>JFace</span> with the operations
1223 :     framework as follows:<o:p></o:p></span></p>
1224 : nick 1.1
1225 : sfranklin 1.3 <ol style='margin-top:0in' start=1 type=1>
1226 : sfranklin 1.5 <li class=MsoNormal style='mso-list:l8 level1 lfo19;tab-stops:list .5in'><span
1227 : sfranklin 1.4 style='font-size:10.0pt;font-family:Arial'>The existing <span
1228 :     class=SpellE>TextCommand</span> was altered to implement the <span
1229 : sfranklin 1.5 class=SpellE>IUndoableOperation</span> interface.<o:p></o:p></span></li>
1230 :     <li class=MsoNormal style='mso-list:l8 level1 lfo19;tab-stops:list .5in'><span
1231 : sfranklin 1.3 style='font-size:10.0pt;font-family:Arial'>Specialized contexts (one
1232 :     instance for each text editor) are assigned to the operations.<o:p></o:p></span></li>
1233 : sfranklin 1.5 <li class=MsoNormal style='mso-list:l8 level1 lfo19;tab-stops:list .5in'><span
1234 : sfranklin 1.4 style='font-size:10.0pt;font-family:Arial'>The existing <span
1235 :     class=SpellE>UndoManager</span> was replaced with an alternate
1236 :     implementation that added text commands to the operations history instead
1237 :     of a local stack, and used the operation history protocol when handling
1238 :     undo and redo commands.<o:p></o:p></span></li>
1239 : sfranklin 1.3 </ol>
1240 : nick 1.1
1241 : sfranklin 1.3 <p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt;
1242 :     font-family:Arial'><o:p>&nbsp;</o:p></span></p>
1243 : nick 1.1
1244 :     </div>
1245 :    
1246 :     </body>
1247 :    
1248 :     </html>