1 /*******************************************************************************
2  * Copyright (c) 2003, 2015 IBM Corporation and others.
3  *
4  * This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License 2.0
6  * which accompanies this distribution, and is available at
7  * https://www.eclipse.org/legal/epl-2.0/
8  *
9  * SPDX-License-Identifier: EPL-2.0
10  *
11  * Contributors:
12  *     IBM Corporation - initial API and implementation
13  *     Tobias Baumann <tobbaumann@gmail.com> - Bug 428323 - Correct lock tool bar action definition
14  *******************************************************************************/
15 package org.eclipse.ui.actions;
16 
17 import org.eclipse.core.runtime.IProduct;
18 import org.eclipse.core.runtime.Platform;
19 import org.eclipse.jface.action.IAction;
20 import org.eclipse.osgi.util.NLS;
21 import org.eclipse.ui.ISharedImages;
22 import org.eclipse.ui.IWorkbenchCommandConstants;
23 import org.eclipse.ui.IWorkbenchWindow;
24 import org.eclipse.ui.internal.CloseAllSavedAction;
25 import org.eclipse.ui.internal.IWorkbenchGraphicConstants;
26 import org.eclipse.ui.internal.IWorkbenchHelpContextIds;
27 import org.eclipse.ui.internal.NavigationHistoryAction;
28 import org.eclipse.ui.internal.OpenPreferencesAction;
29 import org.eclipse.ui.internal.ToggleEditorsVisibilityAction;
30 import org.eclipse.ui.internal.Workbench;
31 import org.eclipse.ui.internal.WorkbenchImages;
32 import org.eclipse.ui.internal.WorkbenchMessages;
33 import org.eclipse.ui.internal.actions.CommandAction;
34 import org.eclipse.ui.internal.actions.DynamicHelpAction;
35 import org.eclipse.ui.internal.actions.HelpContentsAction;
36 import org.eclipse.ui.internal.actions.HelpSearchAction;
37 import org.eclipse.ui.internal.intro.IntroDescriptor;
38 import org.eclipse.ui.internal.intro.IntroMessages;
39 
40 /**
41  * Access to standard actions provided by the workbench.
42  * <p>
43  * Most of the functionality of this class is provided by static methods and
44  * fields. Example usage:
45  * </p>
46  *
47  * <pre>
48  * MenuManager menu = ...;
49  * ActionFactory.IWorkbenchAction closeEditorAction = ActionFactory.CLOSE.create(window);
50  * menu.add(closeEditorAction);
51  * </pre>
52  * <p>
53  * Clients may declare other classes that provide additional
54  * application-specific action factories.
55  * </p>
56  *
57  * @since 3.0
58  */
59 public abstract class ActionFactory {
60 
61 	/**
62 	 * Interface for a workbench action.
63 	 */
64 	public interface IWorkbenchAction extends IAction {
65 		/**
66 		 * Disposes of this action. Once disposed, this action cannot be used. This
67 		 * operation has no effect if the action has already been disposed.
68 		 */
dispose()69 		void dispose();
70 	}
71 
72 	private static class WorkbenchCommandAction extends CommandAction implements IWorkbenchAction {
73 		/**
74 		 * Creates the action backed by a command. For commands that don't take
75 		 * parameters.
76 		 *
77 		 * @param commandIdIn the command id. Must not be null.
78 		 * @param window      the workbench window
79 		 */
WorkbenchCommandAction(String commandIdIn, IWorkbenchWindow window)80 		public WorkbenchCommandAction(String commandIdIn, IWorkbenchWindow window) {
81 			super(window, commandIdIn);
82 		}
83 	}
84 
85 	/**
86 	 * Workbench action (id: "about", commandId: "org.eclipse.ui.help.aboutAction"):
87 	 * Displays the About dialog. This action maintains its enablement state.
88 	 */
89 	public static final ActionFactory ABOUT = new ActionFactory("about", //$NON-NLS-1$
90 			IWorkbenchCommandConstants.HELP_ABOUT) {
91 
92 		@Override
93 		public IWorkbenchAction create(IWorkbenchWindow window) {
94 			if (window == null) {
95 				throw new IllegalArgumentException();
96 			}
97 
98 			WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
99 
100 			action.setId(getId());
101 			IProduct product = Platform.getProduct();
102 			String productName = null;
103 			if (product != null) {
104 				productName = product.getName();
105 			}
106 			if (productName == null) {
107 				productName = ""; //$NON-NLS-1$
108 			}
109 
110 			action.setText(NLS.bind(WorkbenchMessages.AboutAction_text, productName));
111 			action.setToolTipText(NLS.bind(WorkbenchMessages.AboutAction_toolTip, productName));
112 			window.getWorkbench().getHelpSystem().setHelp(action, IWorkbenchHelpContextIds.ABOUT_ACTION);
113 			return action;
114 		}
115 	};
116 
117 	/**
118 	 * Workbench action (id: "activateEditor", commandId:
119 	 * "org.eclipse.ui.window.activateEditor"): Activate the most recently used
120 	 * editor. This action maintains its enablement state.
121 	 */
122 	public static final ActionFactory ACTIVATE_EDITOR = new ActionFactory("activateEditor", //$NON-NLS-1$
123 			IWorkbenchCommandConstants.WINDOW_ACTIVATE_EDITOR) {
124 
125 		@Override
126 		public IWorkbenchAction create(IWorkbenchWindow window) {
127 			if (window == null) {
128 				throw new IllegalArgumentException();
129 			}
130 			WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
131 			action.setId(getId());
132 			action.setText(WorkbenchMessages.ActivateEditorAction_text);
133 			action.setToolTipText(WorkbenchMessages.ActivateEditorAction_toolTip);
134 			return action;
135 		}
136 	};
137 
138 	/**
139 	 * Workbench action (id: "back", commandId: "org.eclipse.ui.navigate.back"):
140 	 * Back. This action is a {@link RetargetAction} with id "back". This action
141 	 * maintains its enablement state.
142 	 */
143 	public static final ActionFactory BACK = new ActionFactory("back", //$NON-NLS-1$
144 			IWorkbenchCommandConstants.NAVIGATE_BACK) {
145 
146 		@Override
147 		public IWorkbenchAction create(IWorkbenchWindow window) {
148 			if (window == null) {
149 				throw new IllegalArgumentException();
150 			}
151 			RetargetAction action = new LabelRetargetAction(getId(), WorkbenchMessages.Workbench_back);
152 			action.setToolTipText(WorkbenchMessages.Workbench_backToolTip);
153 			window.getPartService().addPartListener(action);
154 			action.setActionDefinitionId(getCommandId());
155 			return action;
156 		}
157 	};
158 
159 	/**
160 	 * Workbench action (id: "backardHistory", commandId:
161 	 * "org.eclipse.ui.navigate.backwardHistory"): Backward in the navigation
162 	 * history. This action maintains its enablement state.
163 	 */
164 	public static final ActionFactory BACKWARD_HISTORY = new ActionFactory("backardHistory", //$NON-NLS-1$
165 			IWorkbenchCommandConstants.NAVIGATE_BACKWARD_HISTORY) {
166 		@Override
167 		public IWorkbenchAction create(IWorkbenchWindow window) {
168 			if (window == null) {
169 				throw new IllegalArgumentException();
170 			}
171 			IWorkbenchAction action = new NavigationHistoryAction(window, false);
172 			action.setId(getId());
173 			return action;
174 		}
175 	};
176 
177 	/**
178 	 * Workbench action (id: "close", commandId: "org.eclipse.ui.file.close"): Close
179 	 * the active editor. This action maintains its enablement state.
180 	 */
181 	public static final ActionFactory CLOSE = new ActionFactory("close", //$NON-NLS-1$
182 			IWorkbenchCommandConstants.FILE_CLOSE) {
183 
184 		@Override
185 		public IWorkbenchAction create(IWorkbenchWindow window) {
186 			if (window == null) {
187 				throw new IllegalArgumentException();
188 			}
189 			WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
190 			action.setId(getId());
191 			action.setText(WorkbenchMessages.CloseEditorAction_text);
192 			action.setToolTipText(WorkbenchMessages.CloseEditorAction_toolTip);
193 			return action;
194 		}
195 	};
196 
197 	/**
198 	 * Workbench action (id: "closeAll", commandId: "org.eclipse.ui.file.closeAll"):
199 	 * Close all open editors. This action maintains its enablement state.
200 	 */
201 	public static final ActionFactory CLOSE_ALL = new ActionFactory("closeAll", //$NON-NLS-1$
202 			IWorkbenchCommandConstants.FILE_CLOSE_ALL) {
203 
204 		@Override
205 		public IWorkbenchAction create(IWorkbenchWindow window) {
206 			if (window == null) {
207 				throw new IllegalArgumentException();
208 			}
209 			WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
210 			action.setId(getId());
211 			action.setText(WorkbenchMessages.CloseAllAction_text);
212 			action.setToolTipText(WorkbenchMessages.CloseAllAction_toolTip);
213 			return action;
214 		}
215 	};
216 
217 	/**
218 	 * Workbench action (id: "closeOthers", commandId:
219 	 * "org.eclipse.ui.file.closeOthers"): Close all editors except the one that is
220 	 * active. This action maintains its enablement state.
221 	 *
222 	 * @since 3.2
223 	 */
224 	public static final ActionFactory CLOSE_OTHERS = new ActionFactory("closeOthers", //$NON-NLS-1$
225 			IWorkbenchCommandConstants.FILE_CLOSE_OTHERS) {
226 
227 		@Override
228 		public IWorkbenchAction create(IWorkbenchWindow window) {
229 			if (window == null) {
230 				throw new IllegalArgumentException();
231 			}
232 			WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
233 			action.setId(getId());
234 			action.setText(WorkbenchMessages.CloseOthersAction_text);
235 			action.setToolTipText(WorkbenchMessages.CloseOthersAction_toolTip);
236 			return action;
237 		}
238 	};
239 
240 	/**
241 	 * Workbench action (id: "closeAllPerspectives", commandId:
242 	 * "org.eclipse.ui.window.closeAllPerspectives"): Closes all perspectives. This
243 	 * action maintains its enablement state.
244 	 */
245 	public static final ActionFactory CLOSE_ALL_PERSPECTIVES = new ActionFactory("closeAllPerspectives", //$NON-NLS-1$
246 			IWorkbenchCommandConstants.WINDOW_CLOSE_ALL_PERSPECTIVES) {
247 
248 		@Override
249 		public IWorkbenchAction create(IWorkbenchWindow window) {
250 			if (window == null) {
251 				throw new IllegalArgumentException();
252 			}
253 			WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
254 
255 			action.setId(getId());
256 			action.setText(WorkbenchMessages.CloseAllPerspectivesAction_text);
257 			action.setToolTipText(WorkbenchMessages.CloseAllPerspectivesAction_toolTip);
258 			window.getWorkbench().getHelpSystem().setHelp(action, IWorkbenchHelpContextIds.CLOSE_ALL_PAGES_ACTION);
259 
260 			return action;
261 		}
262 	};
263 
264 	/**
265 	 * Workbench action (id: "closeAllSaved"): Close all open editors except those
266 	 * with unsaved changes. This action maintains its enablement state.
267 	 */
268 	public static final ActionFactory CLOSE_ALL_SAVED = new ActionFactory("closeAllSaved") {//$NON-NLS-1$
269 		@Override
270 		public IWorkbenchAction create(IWorkbenchWindow window) {
271 			if (window == null) {
272 				throw new IllegalArgumentException();
273 			}
274 			IWorkbenchAction action = new CloseAllSavedAction(window);
275 			action.setId(getId());
276 			return action;
277 		}
278 	};
279 
280 	/**
281 	 * Workbench action (id: "closePerspective", commandId:
282 	 * "org.eclipse.ui.window.closePerspective"): Closes the current perspective.
283 	 * This action maintains its enablement state.
284 	 */
285 	public static final ActionFactory CLOSE_PERSPECTIVE = new ActionFactory("closePerspective", //$NON-NLS-1$
286 			IWorkbenchCommandConstants.WINDOW_CLOSE_PERSPECTIVE) {
287 
288 		@Override
289 		public IWorkbenchAction create(IWorkbenchWindow window) {
290 			if (window == null) {
291 				throw new IllegalArgumentException();
292 			}
293 			WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
294 
295 			action.setId(getId());
296 			action.setText(WorkbenchMessages.ClosePerspectiveAction_text);
297 			action.setToolTipText(WorkbenchMessages.ClosePerspectiveAction_toolTip);
298 			window.getWorkbench().getHelpSystem().setHelp(action, IWorkbenchHelpContextIds.CLOSE_PAGE_ACTION);
299 			return action;
300 		}
301 	};
302 
303 	/**
304 	 * Workbench action (id: "intro", commandId:
305 	 * "org.eclipse.ui.help.quickStartAction"): Activate the introduction extension.
306 	 * This action should not be instantiated if no intro is provided. Use code
307 	 * like:
308 	 *
309 	 * <pre>
310 	 * if (window.getWorkbench().getIntroManager().hasIntro()) {
311 	 * 	introAction = ActionFactory.INTRO.create(window);
312 	 * 	register(introAction);
313 	 * }
314 	 * </pre>
315 	 */
316 	public static final ActionFactory INTRO = new ActionFactory("intro", //$NON-NLS-1$
317 			IWorkbenchCommandConstants.HELP_WELCOME) {
318 
319 		@Override
320 		public IWorkbenchAction create(IWorkbenchWindow window) {
321 			if (window == null) {
322 				throw new IllegalArgumentException();
323 			}
324 
325 			WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
326 
327 			action.setId(getId());
328 			action.setText(IntroMessages.Intro_action_text);
329 			window.getWorkbench().getHelpSystem().setHelp(action, IWorkbenchHelpContextIds.INTRO_ACTION);
330 			IntroDescriptor introDescriptor = ((Workbench) window.getWorkbench()).getIntroDescriptor();
331 			if (introDescriptor != null) {
332 				action.setImageDescriptor(introDescriptor.getImageDescriptor());
333 				String labelOverride = introDescriptor.getLabelOverride();
334 				if (labelOverride != null) {
335 					action.setText(labelOverride);
336 				}
337 			}
338 
339 			return action;
340 		}
341 	};
342 
343 	/**
344 	 * Workbench action (id: "copy", commandId: "org.eclipse.ui.edit.copy"): Copy.
345 	 * This action is a {@link RetargetAction} with id "copy". This action maintains
346 	 * its enablement state.
347 	 */
348 	public static final ActionFactory COPY = new ActionFactory("copy", //$NON-NLS-1$
349 			IWorkbenchCommandConstants.EDIT_COPY) {
350 
351 		@Override
352 		public IWorkbenchAction create(IWorkbenchWindow window) {
353 			if (window == null) {
354 				throw new IllegalArgumentException();
355 			}
356 			RetargetAction action = new RetargetAction(getId(), WorkbenchMessages.Workbench_copy);
357 			action.setToolTipText(WorkbenchMessages.Workbench_copyToolTip);
358 			window.getPartService().addPartListener(action);
359 			action.setActionDefinitionId(getCommandId());
360 			ISharedImages sharedImages = window.getWorkbench().getSharedImages();
361 			action.setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_COPY));
362 			action.setDisabledImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_COPY_DISABLED));
363 			return action;
364 		}
365 	};
366 
367 	/**
368 	 * Workbench action (id: "cut", commandId: "org.eclipse.ui.edit.cut"): Cut. This
369 	 * action is a {@link RetargetAction} with id "cut". This action maintains its
370 	 * enablement state.
371 	 */
372 	public static final ActionFactory CUT = new ActionFactory("cut", //$NON-NLS-1$
373 			IWorkbenchCommandConstants.EDIT_CUT) {
374 
375 		@Override
376 		public IWorkbenchAction create(IWorkbenchWindow window) {
377 			if (window == null) {
378 				throw new IllegalArgumentException();
379 			}
380 			RetargetAction action = new RetargetAction(getId(), WorkbenchMessages.Workbench_cut);
381 			action.setToolTipText(WorkbenchMessages.Workbench_cutToolTip);
382 			window.getPartService().addPartListener(action);
383 			action.setActionDefinitionId(getCommandId());
384 			ISharedImages sharedImages = window.getWorkbench().getSharedImages();
385 			action.setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_CUT));
386 			action.setDisabledImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_CUT_DISABLED));
387 			return action;
388 		}
389 	};
390 
391 	/**
392 	 * Workbench action (id: "delete", commandId: "org.eclipse.ui.edit.delete"):
393 	 * Delete. This action is a {@link RetargetAction} with id "delete". This action
394 	 * maintains its enablement state.
395 	 */
396 	public static final ActionFactory DELETE = new ActionFactory("delete", //$NON-NLS-1$
397 			IWorkbenchCommandConstants.EDIT_DELETE) {
398 
399 		@Override
400 		public IWorkbenchAction create(IWorkbenchWindow window) {
401 			if (window == null) {
402 				throw new IllegalArgumentException();
403 			}
404 			RetargetAction action = new RetargetAction(getId(), WorkbenchMessages.Workbench_delete);
405 			action.setToolTipText(WorkbenchMessages.Workbench_deleteToolTip);
406 			window.getPartService().addPartListener(action);
407 			action.setActionDefinitionId(getCommandId());
408 			action.enableAccelerator(false);
409 			window.getWorkbench().getHelpSystem().setHelp(action, IWorkbenchHelpContextIds.DELETE_RETARGET_ACTION);
410 			ISharedImages sharedImages = window.getWorkbench().getSharedImages();
411 			action.setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
412 			action.setDisabledImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE_DISABLED));
413 			return action;
414 		}
415 	};
416 
417 	/**
418 	 * Workbench action (id: "editActionSets", commandId:
419 	 * "org.eclipse.ui.window.customizePerspective"): Edit the action sets. This
420 	 * action maintains its enablement state.
421 	 */
422 	public static final ActionFactory EDIT_ACTION_SETS = new ActionFactory("editActionSets", //$NON-NLS-1$
423 			IWorkbenchCommandConstants.WINDOW_CUSTOMIZE_PERSPECTIVE) {
424 
425 		@Override
426 		public IWorkbenchAction create(IWorkbenchWindow window) {
427 			if (window == null) {
428 				throw new IllegalArgumentException();
429 			}
430 			WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
431 			action.setId(getId());
432 			action.setText(WorkbenchMessages.EditActionSetsAction_text);
433 			action.setToolTipText(WorkbenchMessages.EditActionSetsAction_toolTip);
434 			window.getWorkbench().getHelpSystem().setHelp(action, IWorkbenchHelpContextIds.EDIT_ACTION_SETS_ACTION);
435 
436 			return action;
437 		}
438 	};
439 
440 	/**
441 	 * Workbench action (id: "export", commandId: "org.eclipse.ui.file.export"):
442 	 * Opens the export wizard. This action maintains its enablement state.
443 	 */
444 	public static final ActionFactory EXPORT = new ActionFactory("export", //$NON-NLS-1$
445 			IWorkbenchCommandConstants.FILE_EXPORT) {
446 
447 		@Override
448 		public IWorkbenchAction create(IWorkbenchWindow window) {
449 			if (window == null) {
450 				throw new IllegalArgumentException();
451 			}
452 
453 			WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
454 			action.setId(getId());
455 			action.setText(WorkbenchMessages.ExportResourcesAction_fileMenuText);
456 			action.setToolTipText(WorkbenchMessages.ExportResourcesAction_toolTip);
457 			window.getWorkbench().getHelpSystem().setHelp(action, IWorkbenchHelpContextIds.EXPORT_ACTION);
458 			action.setImageDescriptor(
459 					WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_ETOOL_EXPORT_WIZ));
460 			return action;
461 		}
462 
463 	};
464 
465 	/**
466 	 * Workbench action (id: "find", commandId: "org.eclipse.ui.edit.findReplace"):
467 	 * Find. This action is a {@link RetargetAction} with id "find". This action
468 	 * maintains its enablement state.
469 	 */
470 	public static final ActionFactory FIND = new ActionFactory("find", //$NON-NLS-1$
471 			IWorkbenchCommandConstants.EDIT_FIND_AND_REPLACE) {
472 
473 		@Override
474 		public IWorkbenchAction create(IWorkbenchWindow window) {
475 			if (window == null) {
476 				throw new IllegalArgumentException();
477 			}
478 			RetargetAction action = new RetargetAction(getId(), WorkbenchMessages.Workbench_findReplace);
479 			action.setToolTipText(WorkbenchMessages.Workbench_findReplaceToolTip);
480 			window.getPartService().addPartListener(action);
481 			action.setActionDefinitionId(getCommandId());
482 			// Find's images are commented out due to a conflict with Search.
483 			// See bug 16412.
484 			// action.setImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_ETOOL_SEARCH_SRC));
485 			// action.setDisabledImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_ETOOL_SEARCH_SRC_DISABLED));
486 			return action;
487 		}
488 	};
489 
490 	/**
491 	 * Workbench action (id: "forward", commandId:
492 	 * "org.eclipse.ui.navigate.forward"): Forward. This action is a
493 	 * {@link RetargetAction} with id "forward". This action maintains its
494 	 * enablement state.
495 	 */
496 	public static final ActionFactory FORWARD = new ActionFactory("forward", //$NON-NLS-1$
497 			IWorkbenchCommandConstants.NAVIGATE_FORWARD) {
498 
499 		@Override
500 		public IWorkbenchAction create(IWorkbenchWindow window) {
501 			if (window == null) {
502 				throw new IllegalArgumentException();
503 			}
504 			RetargetAction action = new LabelRetargetAction(getId(), WorkbenchMessages.Workbench_forward);
505 			action.setToolTipText(WorkbenchMessages.Workbench_forwardToolTip);
506 			window.getPartService().addPartListener(action);
507 			action.setActionDefinitionId(getCommandId());
508 			return action;
509 		}
510 	};
511 
512 	/**
513 	 * Workbench action (id: "forwardHistory", commandId:
514 	 * "org.eclipse.ui.navigate.forwardHistory"): Forward in the navigation history.
515 	 * This action maintains its enablement state.
516 	 */
517 	public static final ActionFactory FORWARD_HISTORY = new ActionFactory("forwardHistory", //$NON-NLS-1$
518 			IWorkbenchCommandConstants.NAVIGATE_FORWARD_HISTORY) {
519 
520 		@Override
521 		public IWorkbenchAction create(IWorkbenchWindow window) {
522 			if (window == null) {
523 				throw new IllegalArgumentException();
524 			}
525 			IWorkbenchAction action = new NavigationHistoryAction(window, true);
526 			action.setId(getId());
527 			return action;
528 		}
529 	};
530 
531 	/**
532 	 * Workbench action (id: "goInto", commandId: "org.eclipse.ui.navigate.goInto"):
533 	 * Go Into. This action is a {@link RetargetAction} with id "goInto". This
534 	 * action maintains its enablement state.
535 	 */
536 	public static final ActionFactory GO_INTO = new ActionFactory("goInto", //$NON-NLS-1$
537 			IWorkbenchCommandConstants.NAVIGATE_GO_INTO) {
538 
539 		@Override
540 		public IWorkbenchAction create(IWorkbenchWindow window) {
541 			if (window == null) {
542 				throw new IllegalArgumentException();
543 			}
544 			RetargetAction action = new LabelRetargetAction(getId(), WorkbenchMessages.Workbench_goInto);
545 			action.setToolTipText(WorkbenchMessages.Workbench_goIntoToolTip);
546 			window.getPartService().addPartListener(action);
547 			action.setActionDefinitionId(getCommandId());
548 			return action;
549 		}
550 	};
551 
552 	/**
553 	 * Workbench action (id: "import", commandId: "org.eclipse.ui.file.import"):
554 	 * Opens the import wizard. This action maintains its enablement state.
555 	 */
556 	public static final ActionFactory IMPORT = new ActionFactory("import", //$NON-NLS-1$
557 			IWorkbenchCommandConstants.FILE_IMPORT) {
558 
559 		@Override
560 		public IWorkbenchAction create(IWorkbenchWindow window) {
561 			if (window == null) {
562 				throw new IllegalArgumentException();
563 			}
564 
565 			WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
566 			action.setId(getId());
567 			action.setText(WorkbenchMessages.ImportResourcesAction_text);
568 			action.setToolTipText(WorkbenchMessages.ImportResourcesAction_toolTip);
569 			window.getWorkbench().getHelpSystem().setHelp(action, IWorkbenchHelpContextIds.IMPORT_ACTION);
570 			action.setImageDescriptor(
571 					WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_ETOOL_IMPORT_WIZ));
572 			return action;
573 
574 		}
575 	};
576 
577 	/**
578 	 * Workbench action (id: "lockToolBar"): Lock/unlock the workbench window tool
579 	 * bar. This action maintains its enablement state.
580 	 */
581 	public static final ActionFactory LOCK_TOOL_BAR = new ActionFactory("lockToolBar", //$NON-NLS-1$
582 			IWorkbenchCommandConstants.WINDOW_LOCK_TOOLBAR) {
583 
584 		@Override
585 		public IWorkbenchAction create(IWorkbenchWindow window) {
586 			if (window == null) {
587 				throw new IllegalArgumentException();
588 			}
589 			WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
590 			action.setId(getId());
591 			action.setToolTipText(WorkbenchMessages.LockToolBarAction_toolTip);
592 			window.getWorkbench().getHelpSystem().setHelp(action, IWorkbenchHelpContextIds.LOCK_TOOLBAR_ACTION);
593 			return action;
594 		}
595 	};
596 
597 	/**
598 	 * Workbench action (id: "maximize", commandId:
599 	 * "org.eclipse.ui.window.maximizePart"): Maximize/restore the active part. This
600 	 * action maintains its enablement state.
601 	 *
602 	 * @deprecated you should not use this field, kept for compatibility reasons.
603 	 *             use instead the command
604 	 *             {@code org.eclipse.ui.window.maximizePart}.
605 	 */
606 	@Deprecated
607 	public static final ActionFactory MAXIMIZE = new ActionFactory("maximize", //$NON-NLS-1$
608 			IWorkbenchCommandConstants.WINDOW_MAXIMIZE_ACTIVE_VIEW_OR_EDITOR) {
609 
610 		@Override
611 		public IWorkbenchAction create(IWorkbenchWindow window) {
612 			if (window == null) {
613 				throw new IllegalArgumentException();
614 			}
615 			WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
616 			action.setId(getId());
617 			action.setToolTipText(WorkbenchMessages.MaximizePartAction_toolTip);
618 			window.getWorkbench().getHelpSystem().setHelp(action, IWorkbenchHelpContextIds.MAXIMIZE_PART_ACTION);
619 
620 			return action;
621 		}
622 	};
623 
624 	/**
625 	 * Workbench action (id: "minimize", commandId:
626 	 * "org.eclipse.ui.window.minimizePart"): Minimizes the active part. This action
627 	 * maintains its enablement state.
628 	 *
629 	 * @since 3.1
630 	 * @deprecated you should not use this field, that is kept for compatibility
631 	 *             reasons. use instead the command
632 	 *             {@code org.eclipse.ui.window.minimizePart}.
633 	 */
634 	@Deprecated
635 	public static final ActionFactory MINIMIZE = new ActionFactory("minimize", //$NON-NLS-1$
636 			IWorkbenchCommandConstants.WINDOW_MINIMIZE_ACTIVE_VIEW_OR_EDITOR) {
637 
638 		@Override
639 		public IWorkbenchAction create(IWorkbenchWindow window) {
640 			if (window == null) {
641 				throw new IllegalArgumentException();
642 			}
643 			WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
644 			action.setId(getId());
645 			action.setToolTipText(WorkbenchMessages.MinimizePartAction_toolTip);
646 			window.getWorkbench().getHelpSystem().setHelp(action, IWorkbenchHelpContextIds.MINIMIZE_PART_ACTION);
647 			return action;
648 		}
649 	};
650 
651 	/**
652 	 * Workbench action (id: "move", commandId: "org.eclipse.ui.edit.move"): Move.
653 	 * This action is a {@link RetargetAction} with id "move". This action maintains
654 	 * its enablement state.
655 	 */
656 	public static final ActionFactory MOVE = new ActionFactory("move", //$NON-NLS-1$
657 			IWorkbenchCommandConstants.FILE_MOVE) {
658 
659 		@Override
660 		public IWorkbenchAction create(IWorkbenchWindow window) {
661 			if (window == null) {
662 				throw new IllegalArgumentException();
663 			}
664 			RetargetAction action = new RetargetAction(getId(), WorkbenchMessages.Workbench_move);
665 			action.setToolTipText(WorkbenchMessages.Workbench_moveToolTip);
666 			window.getPartService().addPartListener(action);
667 			action.setActionDefinitionId(getCommandId());
668 			return action;
669 		}
670 	};
671 
672 	/**
673 	 * Workbench action (id: "new", commandId: "org.eclipse.ui.newWizard"): Opens
674 	 * the new wizard dialog. This action maintains its enablement state.
675 	 */
676 	public static final ActionFactory NEW = new ActionFactory("new", //$NON-NLS-1$
677 			IWorkbenchCommandConstants.FILE_NEW) {
678 
679 		@Override
680 		public IWorkbenchAction create(IWorkbenchWindow window) {
681 			if (window == null) {
682 				throw new IllegalArgumentException();
683 			}
684 			WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
685 			action.setId(getId());
686 			ISharedImages images = window.getWorkbench().getSharedImages();
687 			action.setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_NEW_WIZARD));
688 			action.setDisabledImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_NEW_WIZARD_DISABLED));
689 			action.setText(WorkbenchMessages.NewWizardAction_text);
690 			action.setToolTipText(WorkbenchMessages.NewWizardAction_toolTip);
691 			window.getWorkbench().getHelpSystem().setHelp(action, IWorkbenchHelpContextIds.NEW_ACTION);
692 			return action;
693 		}
694 	};
695 
696 	/**
697 	 * Workbench action (id: "newWizardDropDown"): Drop-down action which shows
698 	 * shows the new wizard drop down, or opens the new wizard dialog when pressed.
699 	 * For use in the toolbar. This action maintains its enablement state.
700 	 *
701 	 * @since 3.1
702 	 */
703 	public static final ActionFactory NEW_WIZARD_DROP_DOWN = new ActionFactory("newWizardDropDown") { //$NON-NLS-1$
704 
705 		@Override
706 		public IWorkbenchAction create(IWorkbenchWindow window) {
707 			if (window == null) {
708 				throw new IllegalArgumentException();
709 			}
710 			IWorkbenchAction action = new NewWizardDropDownAction(window);
711 			action.setId(getId());
712 			return action;
713 		}
714 	};
715 
716 	/**
717 	 * Workbench action (id: "next", commandId: "org.eclipse.ui.navigate.next"):
718 	 * Next. This action is a {@link RetargetAction} with id "next". This action
719 	 * maintains its enablement state.
720 	 */
721 	public static final ActionFactory NEXT = new ActionFactory("next", //$NON-NLS-1$
722 			IWorkbenchCommandConstants.NAVIGATE_NEXT) {
723 
724 		@Override
725 		public IWorkbenchAction create(IWorkbenchWindow window) {
726 			if (window == null) {
727 				throw new IllegalArgumentException();
728 			}
729 			RetargetAction action = new LabelRetargetAction(getId(), WorkbenchMessages.Workbench_next);
730 			action.setToolTipText(WorkbenchMessages.Workbench_nextToolTip);
731 			window.getPartService().addPartListener(action);
732 			action.setActionDefinitionId(getCommandId());
733 			return action;
734 		}
735 	};
736 
737 	/**
738 	 * Workbench action (id: "nextEditor", commandId:
739 	 * "org.eclipse.ui.window.nextEditor"): Next editor. This action maintains its
740 	 * enablement state.
741 	 * <p>
742 	 * <code>NEXT_EDITOR</code> and <code>PREVIOUS_EDITOR</code> form a cycle action
743 	 * pair. For a given window, use {@link ActionFactory#linkCycleActionPair
744 	 * ActionFactory.linkCycleActionPair} to connect the two.
745 	 * </p>
746 	 */
747 	public static final ActionFactory NEXT_EDITOR = new ActionFactory("nextEditor", //$NON-NLS-1$
748 			IWorkbenchCommandConstants.WINDOW_NEXT_EDITOR) {
749 
750 		@Override
751 		public IWorkbenchAction create(IWorkbenchWindow window) {
752 			if (window == null) {
753 				throw new IllegalArgumentException();
754 			}
755 			IWorkbenchAction action = new WorkbenchCommandAction(getCommandId(), window);
756 
757 			action.setId(getId());
758 			action.setText(WorkbenchMessages.CycleEditorAction_next_text);
759 			action.setToolTipText(WorkbenchMessages.CycleEditorAction_next_toolTip);
760 			// @issue missing action ids
761 			window.getWorkbench().getHelpSystem().setHelp(action, IWorkbenchHelpContextIds.CYCLE_EDITOR_FORWARD_ACTION);
762 
763 			return action;
764 		}
765 	};
766 
767 	/**
768 	 * Workbench action (id: "nextPart", commandId:
769 	 * "org.eclipse.ui.window.nextView"): Next part. This action maintains its
770 	 * enablement state.
771 	 * <p>
772 	 * <code>NEXT_PART</code> and <code>PREVIOUS_PART</code> form a cycle action
773 	 * pair. For a given window, use {@link ActionFactory#linkCycleActionPair
774 	 * ActionFactory.linkCycleActionPair} to connect the two.
775 	 * </p>
776 	 */
777 	public static final ActionFactory NEXT_PART = new ActionFactory("nextPart", //$NON-NLS-1$
778 			IWorkbenchCommandConstants.WINDOW_NEXT_VIEW) {
779 
780 		@Override
781 		public IWorkbenchAction create(IWorkbenchWindow window) {
782 			if (window == null) {
783 				throw new IllegalArgumentException();
784 			}
785 			WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
786 			action.setId(getId());
787 			action.setText(WorkbenchMessages.CyclePartAction_next_text);
788 			action.setToolTipText(WorkbenchMessages.CyclePartAction_next_toolTip);
789 			// @issue missing action ids
790 			window.getWorkbench().getHelpSystem().setHelp(action, IWorkbenchHelpContextIds.CYCLE_PART_FORWARD_ACTION);
791 			return action;
792 		}
793 	};
794 
795 	/**
796 	 * Workbench action (id: "nextPerspective", commandId:
797 	 * "org.eclipse.ui.window.nextPerspective"): Next perspective. This action
798 	 * maintains its enablement state.
799 	 * <p>
800 	 * <code>NEXT_PERSPECTIVE</code> and <code>PREVIOUS_PERSPECTIVE</code> form a
801 	 * cycle action pair. For a given window, use
802 	 * {@link ActionFactory#linkCycleActionPair ActionFactory.linkCycleActionPair}
803 	 * to connect the two.
804 	 * </p>
805 	 */
806 	public static final ActionFactory NEXT_PERSPECTIVE = new ActionFactory("nextPerspective", //$NON-NLS-1$
807 			IWorkbenchCommandConstants.WINDOW_NEXT_PERSPECTIVE) {
808 
809 		@Override
810 		public IWorkbenchAction create(IWorkbenchWindow window) {
811 			if (window == null) {
812 				throw new IllegalArgumentException();
813 			}
814 			WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
815 			action.setId(getId());
816 			action.setText(WorkbenchMessages.CyclePerspectiveAction_next_text);
817 			action.setToolTipText(WorkbenchMessages.CyclePerspectiveAction_next_toolTip);
818 			// @issue missing action ids
819 			window.getWorkbench().getHelpSystem().setHelp(action,
820 					IWorkbenchHelpContextIds.CYCLE_PERSPECTIVE_FORWARD_ACTION);
821 			return action;
822 		}
823 	};
824 
825 	/**
826 	 * Workbench action (id: "openNewWindow", commandId:
827 	 * "org.eclipse.ui.window.newWindow"): Open a new workbench window. This action
828 	 * maintains its enablement state.
829 	 */
830 	public static final ActionFactory OPEN_NEW_WINDOW = new ActionFactory("openNewWindow", //$NON-NLS-1$
831 			IWorkbenchCommandConstants.WINDOW_NEW_WINDOW) {
832 
833 		@Override
834 		public IWorkbenchAction create(IWorkbenchWindow window) {
835 			if (window == null) {
836 				throw new IllegalArgumentException();
837 			}
838 			WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
839 			action.setId(getId());
840 			action.setText(WorkbenchMessages.OpenInNewWindowAction_text);
841 			action.setToolTipText(WorkbenchMessages.OpenInNewWindowAction_toolTip);
842 			window.getWorkbench().getHelpSystem().setHelp(action, IWorkbenchHelpContextIds.OPEN_NEW_WINDOW_ACTION);
843 			return action;
844 		}
845 
846 	};
847 
848 	/**
849 	 * Workbench action (id: "paste", commandId: "org.eclipse.ui.edit.paste"):
850 	 * Paste. This action is a {@link RetargetAction} with id "paste". This action
851 	 * maintains its enablement state.
852 	 */
853 	public static final ActionFactory PASTE = new ActionFactory("paste", //$NON-NLS-1$
854 			IWorkbenchCommandConstants.EDIT_PASTE) {
855 
856 		@Override
857 		public IWorkbenchAction create(IWorkbenchWindow window) {
858 			if (window == null) {
859 				throw new IllegalArgumentException();
860 			}
861 			RetargetAction action = new RetargetAction(getId(), WorkbenchMessages.Workbench_paste);
862 			action.setToolTipText(WorkbenchMessages.Workbench_pasteToolTip);
863 			window.getPartService().addPartListener(action);
864 			action.setActionDefinitionId(getCommandId());
865 			ISharedImages sharedImages = window.getWorkbench().getSharedImages();
866 			action.setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE));
867 			action.setDisabledImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE_DISABLED));
868 			return action;
869 		}
870 	};
871 
872 	/**
873 	 * Workbench action (id: "preferences", commandId:
874 	 * "org.eclipse.ui.window.preferences"): Displays the Preferences dialog. This
875 	 * action maintains its enablement state.
876 	 */
877 	public static final ActionFactory PREFERENCES = new ActionFactory("preferences", //$NON-NLS-1$
878 			IWorkbenchCommandConstants.WINDOW_PREFERENCES) {
879 
880 		@Override
881 		public IWorkbenchAction create(IWorkbenchWindow window) {
882 			if (window == null) {
883 				throw new IllegalArgumentException();
884 			}
885 			IWorkbenchAction action = new OpenPreferencesAction(window);
886 			action.setId(getId());
887 			return action;
888 		}
889 	};
890 
891 	/**
892 	 * Workbench action (id: "previous", commandId:
893 	 * "org.eclipse.ui.navigate.previous"): Previous. This action is a
894 	 * {@link RetargetAction} with id "previous". This action maintains its
895 	 * enablement state.
896 	 */
897 	public static final ActionFactory PREVIOUS = new ActionFactory("previous", //$NON-NLS-1$
898 			IWorkbenchCommandConstants.NAVIGATE_PREVIOUS) {
899 
900 		@Override
901 		public IWorkbenchAction create(IWorkbenchWindow window) {
902 			if (window == null) {
903 				throw new IllegalArgumentException();
904 			}
905 			RetargetAction action = new LabelRetargetAction(getId(), WorkbenchMessages.Workbench_previous);
906 			action.setToolTipText(WorkbenchMessages.Workbench_previousToolTip);
907 			window.getPartService().addPartListener(action);
908 			action.setActionDefinitionId(getCommandId());
909 			return action;
910 		}
911 	};
912 
913 	/**
914 	 * Workbench action (id: "previousEditor", commandId:
915 	 * "org.eclipse.ui.window.previousEditor"): Previous editor. This action
916 	 * maintains its enablement state.
917 	 * <p>
918 	 * <code>NEXT_EDITOR</code> and <code>PREVIOUS_EDITOR</code> form a cycle action
919 	 * pair. For a given window, use {@link ActionFactory#linkCycleActionPair
920 	 * ActionFactory.linkCycleActionPair} to connect the two.
921 	 * </p>
922 	 */
923 	public static final ActionFactory PREVIOUS_EDITOR = new ActionFactory("previousEditor", //$NON-NLS-1$
924 			IWorkbenchCommandConstants.WINDOW_PREVIOUS_EDITOR) {
925 
926 		@Override
927 		public IWorkbenchAction create(IWorkbenchWindow window) {
928 			if (window == null) {
929 				throw new IllegalArgumentException();
930 			}
931 			IWorkbenchAction action = new WorkbenchCommandAction(getCommandId(), window);
932 			action.setId(getId());
933 			action.setText(WorkbenchMessages.CycleEditorAction_prev_text);
934 			action.setToolTipText(WorkbenchMessages.CycleEditorAction_prev_toolTip);
935 			// @issue missing action ids
936 			window.getWorkbench().getHelpSystem().setHelp(action,
937 					IWorkbenchHelpContextIds.CYCLE_EDITOR_BACKWARD_ACTION);
938 
939 			return action;
940 		}
941 	};
942 
943 	/**
944 	 * Workbench action (id: "previousPart", commandId:
945 	 * "org.eclipse.ui.window.previousView"): Previous part. This action maintains
946 	 * its enablement state.
947 	 * <p>
948 	 * <code>NEXT_PART</code> and <code>PREVIOUS_PART</code> form a cycle action
949 	 * pair. For a given window, use {@link ActionFactory#linkCycleActionPair
950 	 * ActionFactory.linkCycleActionPair} to connect the two.
951 	 * </p>
952 	 */
953 	public static final ActionFactory PREVIOUS_PART = new ActionFactory("previousPart", //$NON-NLS-1$
954 			IWorkbenchCommandConstants.WINDOW_PREVIOUS_VIEW) {
955 
956 		@Override
957 		public IWorkbenchAction create(IWorkbenchWindow window) {
958 			if (window == null) {
959 				throw new IllegalArgumentException();
960 			}
961 			WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
962 			action.setId(getId());
963 			action.setText(WorkbenchMessages.CyclePartAction_prev_text);
964 			action.setToolTipText(WorkbenchMessages.CyclePartAction_prev_toolTip);
965 			// @issue missing action ids
966 			window.getWorkbench().getHelpSystem().setHelp(action, IWorkbenchHelpContextIds.CYCLE_PART_BACKWARD_ACTION);
967 			return action;
968 		}
969 	};
970 
971 	/**
972 	 * Workbench action (id: "previousPerspective", commandId:
973 	 * "org.eclipse.ui.window.previousPerspective"): Previous perspective. This
974 	 * action maintains its enablement state.
975 	 * <p>
976 	 * <code>NEXT_PERSPECTIVE</code> and <code>PREVIOUS_PERSPECTIVE</code> form a
977 	 * cycle action pair. For a given window, use
978 	 * {@link ActionFactory#linkCycleActionPair ActionFactory.linkCycleActionPair}
979 	 * to connect the two.
980 	 * </p>
981 	 */
982 	public static final ActionFactory PREVIOUS_PERSPECTIVE = new ActionFactory("previousPerspective", //$NON-NLS-1$
983 			IWorkbenchCommandConstants.WINDOW_PREVIOUS_PERSPECTIVE) {
984 
985 		@Override
986 		public IWorkbenchAction create(IWorkbenchWindow window) {
987 			if (window == null) {
988 				throw new IllegalArgumentException();
989 			}
990 			WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
991 			action.setId(getId());
992 			action.setText(WorkbenchMessages.CyclePerspectiveAction_prev_text);
993 			action.setToolTipText(WorkbenchMessages.CyclePerspectiveAction_prev_toolTip);
994 			// @issue missing action ids
995 			window.getWorkbench().getHelpSystem().setHelp(action,
996 					IWorkbenchHelpContextIds.CYCLE_PERSPECTIVE_BACKWARD_ACTION);
997 			return action;
998 		}
999 	};
1000 
1001 	/**
1002 	 * Workbench action (id: "print", commandId: "org.eclipse.ui.file.print"):
1003 	 * Print. This action is a {@link RetargetAction} with id "print". This action
1004 	 * maintains its enablement state.
1005 	 */
1006 	public static final ActionFactory PRINT = new ActionFactory("print", //$NON-NLS-1$
1007 			IWorkbenchCommandConstants.FILE_PRINT) {
1008 
1009 		@Override
1010 		public IWorkbenchAction create(IWorkbenchWindow window) {
1011 			if (window == null) {
1012 				throw new IllegalArgumentException();
1013 			}
1014 			RetargetAction action = new RetargetAction(getId(), WorkbenchMessages.Workbench_print);
1015 			action.setToolTipText(WorkbenchMessages.Workbench_printToolTip);
1016 			window.getPartService().addPartListener(action);
1017 			action.setActionDefinitionId(getCommandId());
1018 			action.setImageDescriptor(WorkbenchImages.getImageDescriptor(ISharedImages.IMG_ETOOL_PRINT_EDIT));
1019 			action.setDisabledImageDescriptor(
1020 					WorkbenchImages.getImageDescriptor(ISharedImages.IMG_ETOOL_PRINT_EDIT_DISABLED));
1021 			return action;
1022 		}
1023 	};
1024 
1025 	/**
1026 	 * Workbench action (id: "properties", commandId:
1027 	 * "org.eclipse.ui.file.properties"): Properties. This action is a
1028 	 * {@link RetargetAction} with id "properties". This action maintains its
1029 	 * enablement state.
1030 	 */
1031 	public static final ActionFactory PROPERTIES = new ActionFactory("properties", //$NON-NLS-1$
1032 			IWorkbenchCommandConstants.FILE_PROPERTIES) {
1033 
1034 		@Override
1035 		public IWorkbenchAction create(IWorkbenchWindow window) {
1036 			if (window == null) {
1037 				throw new IllegalArgumentException();
1038 			}
1039 			RetargetAction action = new RetargetAction(getId(), WorkbenchMessages.Workbench_properties);
1040 			action.setToolTipText(WorkbenchMessages.Workbench_propertiesToolTip);
1041 			window.getPartService().addPartListener(action);
1042 			action.setActionDefinitionId(getCommandId());
1043 			return action;
1044 		}
1045 	};
1046 
1047 	/**
1048 	 * Workbench action (id: "quit", commandId: "org.eclipse.ui.file.exit"): Quit
1049 	 * (close the workbench). This action maintains its enablement state.
1050 	 */
1051 	public static final ActionFactory QUIT = new ActionFactory("quit", //$NON-NLS-1$
1052 			IWorkbenchCommandConstants.FILE_EXIT) {
1053 
1054 		@Override
1055 		public IWorkbenchAction create(IWorkbenchWindow window) {
1056 			if (window == null) {
1057 				throw new IllegalArgumentException();
1058 			}
1059 			WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
1060 			action.setId(getId());
1061 			action.setText(WorkbenchMessages.Exit_text);
1062 			action.setToolTipText(WorkbenchMessages.Exit_toolTip);
1063 			window.getWorkbench().getHelpSystem().setHelp(action, IWorkbenchHelpContextIds.QUIT_ACTION);
1064 			return action;
1065 		}
1066 	};
1067 
1068 	/**
1069 	 * Workbench action (id: "redo", commandId: "org.eclipse.ui.edit.redo"): Redo.
1070 	 * This action is a {@link RetargetAction} with id "redo". This action maintains
1071 	 * its enablement state.
1072 	 */
1073 	public static final ActionFactory REDO = new ActionFactory("redo", //$NON-NLS-1$
1074 			IWorkbenchCommandConstants.EDIT_REDO) {
1075 
1076 		@Override
1077 		public IWorkbenchAction create(IWorkbenchWindow window) {
1078 			if (window == null) {
1079 				throw new IllegalArgumentException();
1080 			}
1081 			LabelRetargetAction action = new LabelRetargetAction(getId(), WorkbenchMessages.Workbench_redo);
1082 			action.setToolTipText(WorkbenchMessages.Workbench_redoToolTip);
1083 			window.getPartService().addPartListener(action);
1084 			action.setActionDefinitionId(getCommandId());
1085 			ISharedImages sharedImages = window.getWorkbench().getSharedImages();
1086 			action.setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_REDO));
1087 			action.setDisabledImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_REDO_DISABLED));
1088 			return action;
1089 		}
1090 	};
1091 
1092 	/**
1093 	 * Workbench action (id: "refresh", commandId: "org.eclipse.ui.file.refresh"):
1094 	 * Refresh. This action is a {@link RetargetAction} with id "refresh". This
1095 	 * action maintains its enablement state.
1096 	 */
1097 	public static final ActionFactory REFRESH = new ActionFactory("refresh", //$NON-NLS-1$
1098 			IWorkbenchCommandConstants.FILE_REFRESH) {
1099 
1100 		@Override
1101 		public IWorkbenchAction create(IWorkbenchWindow window) {
1102 			if (window == null) {
1103 				throw new IllegalArgumentException();
1104 			}
1105 			RetargetAction action = new RetargetAction(getId(), WorkbenchMessages.Workbench_refresh);
1106 			action.setToolTipText(WorkbenchMessages.Workbench_refreshToolTip);
1107 			window.getPartService().addPartListener(action);
1108 			action.setActionDefinitionId(getCommandId());
1109 			return action;
1110 		}
1111 	};
1112 
1113 	/**
1114 	 * Workbench action (id: "rename", commandId: "org.eclipse.ui.edit.rename"):
1115 	 * Rename. This action is a {@link RetargetAction} with id "rename". This action
1116 	 * maintains its enablement state.
1117 	 */
1118 	public static final ActionFactory RENAME = new ActionFactory("rename", //$NON-NLS-1$
1119 			IWorkbenchCommandConstants.FILE_RENAME) {
1120 
1121 		@Override
1122 		public IWorkbenchAction create(IWorkbenchWindow window) {
1123 			if (window == null) {
1124 				throw new IllegalArgumentException();
1125 			}
1126 			RetargetAction action = new RetargetAction(getId(), WorkbenchMessages.Workbench_rename);
1127 			action.setToolTipText(WorkbenchMessages.Workbench_renameToolTip);
1128 			window.getPartService().addPartListener(action);
1129 			action.setActionDefinitionId(getCommandId());
1130 			return action;
1131 		}
1132 	};
1133 
1134 	/**
1135 	 * Workbench action (id: "resetPerspective", commandId:
1136 	 * "org.eclipse.ui.window.resetPerspective"): Resets the current perspective.
1137 	 * This action maintains its enablement state.
1138 	 */
1139 	public static final ActionFactory RESET_PERSPECTIVE = new ActionFactory("resetPerspective", //$NON-NLS-1$
1140 			IWorkbenchCommandConstants.WINDOW_RESET_PERSPECTIVE) {
1141 
1142 		@Override
1143 		public IWorkbenchAction create(IWorkbenchWindow window) {
1144 			if (window == null) {
1145 				throw new IllegalArgumentException();
1146 			}
1147 			WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
1148 
1149 			action.setId(getId());
1150 			action.setText(WorkbenchMessages.ResetPerspective_text);
1151 			action.setToolTipText(WorkbenchMessages.ResetPerspective_toolTip);
1152 			window.getWorkbench().getHelpSystem().setHelp(action, IWorkbenchHelpContextIds.RESET_PERSPECTIVE_ACTION);
1153 			return action;
1154 		}
1155 	};
1156 
1157 	/**
1158 	 * Workbench action (id: "revert", commandId: "org.eclipse.ui.file.revert"):
1159 	 * Revert. This action is a {@link RetargetAction} with id "revert". This action
1160 	 * maintains its enablement state.
1161 	 */
1162 	public static final ActionFactory REVERT = new ActionFactory("revert", //$NON-NLS-1$
1163 			IWorkbenchCommandConstants.FILE_REVERT) {
1164 
1165 		@Override
1166 		public IWorkbenchAction create(IWorkbenchWindow window) {
1167 			if (window == null) {
1168 				throw new IllegalArgumentException();
1169 			}
1170 			RetargetAction action = new RetargetAction(getId(), WorkbenchMessages.Workbench_revert);
1171 			action.setToolTipText(WorkbenchMessages.Workbench_revertToolTip);
1172 			window.getPartService().addPartListener(action);
1173 			action.setActionDefinitionId(getCommandId());
1174 			return action;
1175 		}
1176 	};
1177 
1178 	/**
1179 	 * Workbench action (id: "save", commandId: "org.eclipse.ui.file.save"): Save
1180 	 * the active editor. This action maintains its enablement state.
1181 	 */
1182 	public static final ActionFactory SAVE = new ActionFactory("save", //$NON-NLS-1$
1183 			IWorkbenchCommandConstants.FILE_SAVE) {
1184 
1185 		@Override
1186 		public IWorkbenchAction create(IWorkbenchWindow window) {
1187 			if (window == null) {
1188 				throw new IllegalArgumentException();
1189 			}
1190 			WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
1191 			action.setText(WorkbenchMessages.SaveAction_text);
1192 			action.setToolTipText(WorkbenchMessages.SaveAction_toolTip);
1193 			action.setId(getId());
1194 			window.getWorkbench().getHelpSystem().setHelp(action, IWorkbenchHelpContextIds.SAVE_ACTION);
1195 			return action;
1196 		}
1197 	};
1198 
1199 	/**
1200 	 * Workbench action (id: "saveAll", commandId: "org.eclipse.ui.file.saveAll"):
1201 	 * Save all open editors with unsaved changes. This action maintains its
1202 	 * enablement state.
1203 	 */
1204 	public static final ActionFactory SAVE_ALL = new ActionFactory("saveAll", //$NON-NLS-1$
1205 			IWorkbenchCommandConstants.FILE_SAVE_ALL) {
1206 
1207 		@Override
1208 		public IWorkbenchAction create(IWorkbenchWindow window) {
1209 			if (window == null) {
1210 				throw new IllegalArgumentException();
1211 			}
1212 			IWorkbenchAction action = new WorkbenchCommandAction(getCommandId(), window);
1213 			action.setText(WorkbenchMessages.SaveAll_text);
1214 			action.setToolTipText(WorkbenchMessages.SaveAll_toolTip);
1215 			window.getWorkbench().getHelpSystem().setHelp(action, IWorkbenchHelpContextIds.SAVE_ALL_ACTION);
1216 			action.setId(getId());
1217 			return action;
1218 		}
1219 	};
1220 
1221 	/**
1222 	 * Workbench action (id: "saveAs", commandId: "org.eclipse.ui.file.saveAs"):
1223 	 * Save As for the active editor. This action maintains its enablement state.
1224 	 */
1225 	public static final ActionFactory SAVE_AS = new ActionFactory("saveAs", //$NON-NLS-1$
1226 			IWorkbenchCommandConstants.FILE_SAVE_AS) {
1227 
1228 		@Override
1229 		public IWorkbenchAction create(IWorkbenchWindow window) {
1230 			if (window == null) {
1231 				throw new IllegalArgumentException();
1232 			}
1233 			IWorkbenchAction action = new WorkbenchCommandAction(getCommandId(), window);
1234 			action.setText(WorkbenchMessages.SaveAs_text);
1235 			action.setToolTipText(WorkbenchMessages.SaveAs_toolTip);
1236 			window.getWorkbench().getHelpSystem().setHelp(action, IWorkbenchHelpContextIds.SAVE_AS_ACTION);
1237 			action.setId(getId());
1238 			return action;
1239 		}
1240 	};
1241 
1242 	/**
1243 	 * Workbench action (id: "savePerspective", commandId:
1244 	 * "org.eclipse.ui.window.savePerspective"): Save the current perspective. This
1245 	 * action maintains its enablement state.
1246 	 */
1247 	public static final ActionFactory SAVE_PERSPECTIVE = new ActionFactory("savePerspective", //$NON-NLS-1$
1248 			IWorkbenchCommandConstants.WINDOW_SAVE_PERSPECTIVE_AS) {
1249 
1250 		@Override
1251 		public IWorkbenchAction create(IWorkbenchWindow window) {
1252 			if (window == null) {
1253 				throw new IllegalArgumentException();
1254 			}
1255 			WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
1256 
1257 			action.setId(getId());
1258 			action.setText(WorkbenchMessages.SavePerspective_text);
1259 			action.setToolTipText(WorkbenchMessages.SavePerspective_toolTip);
1260 			window.getWorkbench().getHelpSystem().setHelp(action, IWorkbenchHelpContextIds.SAVE_PERSPECTIVE_ACTION);
1261 			return action;
1262 		}
1263 	};
1264 
1265 	/**
1266 	 * Workbench action (id: "selectAll", commandId:
1267 	 * "org.eclipse.ui.edit.selectAll"): Select All. This action is a
1268 	 * {@link RetargetAction} with id "selectAll". This action maintains its
1269 	 * enablement state.
1270 	 */
1271 	public static final ActionFactory SELECT_ALL = new ActionFactory("selectAll", //$NON-NLS-1$
1272 			IWorkbenchCommandConstants.EDIT_SELECT_ALL) {
1273 
1274 		@Override
1275 		public IWorkbenchAction create(IWorkbenchWindow window) {
1276 			if (window == null) {
1277 				throw new IllegalArgumentException();
1278 			}
1279 			RetargetAction action = new RetargetAction(getId(), WorkbenchMessages.Workbench_selectAll);
1280 			action.setToolTipText(WorkbenchMessages.Workbench_selectAllToolTip);
1281 			window.getPartService().addPartListener(action);
1282 			action.setActionDefinitionId(getCommandId());
1283 			return action;
1284 		}
1285 	};
1286 
1287 	/**
1288 	 * Workbench action (id: "showEditor"): Show/hide the editor area. This action
1289 	 * maintains its enablement state.
1290 	 */
1291 	public static final ActionFactory SHOW_EDITOR = new ActionFactory("showEditor") {//$NON-NLS-1$
1292 
1293 		@Override
1294 		public IWorkbenchAction create(IWorkbenchWindow window) {
1295 			if (window == null) {
1296 				throw new IllegalArgumentException();
1297 			}
1298 			IWorkbenchAction action = new ToggleEditorsVisibilityAction(window);
1299 			action.setId(getId());
1300 			return action;
1301 		}
1302 	};
1303 
1304 	/**
1305 	 * Workbench action (id: "showOpenEditors"): Show a list of open (and recently
1306 	 * closed) editors. This action maintains its enablement state.
1307 	 */
1308 	public static final ActionFactory SHOW_OPEN_EDITORS = new ActionFactory("showOpenEditors") {//$NON-NLS-1$
1309 
1310 		@Override
1311 		public IWorkbenchAction create(IWorkbenchWindow window) {
1312 			if (window == null) {
1313 				throw new IllegalArgumentException();
1314 			}
1315 			WorkbenchCommandAction action = new WorkbenchCommandAction("org.eclipse.ui.window.switchToEditor", window); //$NON-NLS-1$
1316 			action.setId(getId());
1317 			action.setText(WorkbenchMessages.WorkbenchEditorsAction_label);
1318 			// @issue missing action id
1319 			window.getWorkbench().getHelpSystem().setHelp(action, IWorkbenchHelpContextIds.WORKBENCH_EDITORS_ACTION);
1320 			return action;
1321 		}
1322 	};
1323 
1324 	/**
1325 	 * Workbench action (id: "showWorkbookEditors"): Shows a list of open editors in
1326 	 * the current or last active workbook.
1327 	 */
1328 	public static final ActionFactory SHOW_WORKBOOK_EDITORS = new ActionFactory("showWorkBookEditors") {//$NON-NLS-1$
1329 
1330 		@Override
1331 		public IWorkbenchAction create(IWorkbenchWindow window) {
1332 			if (window == null) {
1333 				throw new IllegalArgumentException();
1334 			}
1335 
1336 			WorkbenchCommandAction action = new WorkbenchCommandAction("org.eclipse.ui.window.openEditorDropDown", //$NON-NLS-1$
1337 					window);
1338 			action.setId(getId());
1339 			action.setText(WorkbenchMessages.WorkbookEditorsAction_label);
1340 
1341 			return action;
1342 		}
1343 	};
1344 
1345 	/**
1346 	 * Workbench action (id: "showQuickAccess"): Shows a list of UI elements like
1347 	 * editors, views, perspectives etc.
1348 	 *
1349 	 * @since 3.3
1350 	 */
1351 	public static final ActionFactory SHOW_QUICK_ACCESS = new ActionFactory("showQuickAccess") { //$NON-NLS-1$
1352 
1353 		@Override
1354 		public IWorkbenchAction create(IWorkbenchWindow window) {
1355 			WorkbenchCommandAction action = new WorkbenchCommandAction("org.eclipse.ui.window.quickAccess", window); //$NON-NLS-1$
1356 			action.setId(getId());
1357 			action.setText(WorkbenchMessages.QuickAccessAction_text);
1358 			action.setToolTipText(WorkbenchMessages.QuickAccessAction_toolTip);
1359 			return action;
1360 		}
1361 
1362 	};
1363 
1364 	/**
1365 	 * Workbench action (id: "showPartPaneMenu"): Show the part pane menu. This
1366 	 * action maintains its enablement state.
1367 	 */
1368 	public static final ActionFactory SHOW_PART_PANE_MENU = new ActionFactory("showPartPaneMenu") {//$NON-NLS-1$
1369 
1370 		@Override
1371 		public IWorkbenchAction create(IWorkbenchWindow window) {
1372 			if (window == null) {
1373 				throw new IllegalArgumentException();
1374 			}
1375 			WorkbenchCommandAction action = new WorkbenchCommandAction("org.eclipse.ui.window.showSystemMenu", window); //$NON-NLS-1$
1376 			action.setId(getId());
1377 			action.setText(WorkbenchMessages.ShowPartPaneMenuAction_text);
1378 			action.setToolTipText(WorkbenchMessages.ShowPartPaneMenuAction_toolTip);
1379 			return action;
1380 		}
1381 	};
1382 
1383 	/**
1384 	 * Workbench action (id: "showViewMenu", commandId:
1385 	 * "org.eclipse.ui.window.showViewMenu"): Show the view menu. This action
1386 	 * maintains its enablement state.
1387 	 */
1388 	public static final ActionFactory SHOW_VIEW_MENU = new ActionFactory("showViewMenu", //$NON-NLS-1$
1389 			IWorkbenchCommandConstants.WINDOW_SHOW_VIEW_MENU) {
1390 
1391 		@Override
1392 		public IWorkbenchAction create(IWorkbenchWindow window) {
1393 			if (window == null) {
1394 				throw new IllegalArgumentException();
1395 			}
1396 			WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
1397 			action.setId(getId());
1398 			action.setText(WorkbenchMessages.ShowViewMenuAction_text);
1399 			action.setToolTipText(WorkbenchMessages.ShowViewMenuAction_toolTip);
1400 			return action;
1401 		}
1402 	};
1403 
1404 	/**
1405 	 * Workbench action (id: "undo", commandId: "org.eclipse.ui.edit.undo"): Undo.
1406 	 * This action is a {@link RetargetAction} with id "undo". This action maintains
1407 	 * its enablement state.
1408 	 */
1409 	public static final ActionFactory UNDO = new ActionFactory("undo", //$NON-NLS-1$
1410 			IWorkbenchCommandConstants.EDIT_UNDO) {
1411 
1412 		@Override
1413 		public IWorkbenchAction create(IWorkbenchWindow window) {
1414 			if (window == null) {
1415 				throw new IllegalArgumentException();
1416 			}
1417 			LabelRetargetAction action = new LabelRetargetAction(getId(), WorkbenchMessages.Workbench_undo);
1418 			action.setToolTipText(WorkbenchMessages.Workbench_undoToolTip);
1419 			window.getPartService().addPartListener(action);
1420 			action.setActionDefinitionId(getCommandId());
1421 			ISharedImages sharedImages = window.getWorkbench().getSharedImages();
1422 			action.setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_UNDO));
1423 			action.setDisabledImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_UNDO_DISABLED));
1424 			return action;
1425 		}
1426 	};
1427 
1428 	/**
1429 	 * Workbench action (id: "up", commandId: "org.eclipse.ui.navigate.up"): Up.
1430 	 * This action is a {@link RetargetAction} with id "up". This action maintains
1431 	 * its enablement state.
1432 	 */
1433 	public static final ActionFactory UP = new ActionFactory("up", //$NON-NLS-1$
1434 			IWorkbenchCommandConstants.NAVIGATE_UP) {
1435 
1436 		@Override
1437 		public IWorkbenchAction create(IWorkbenchWindow window) {
1438 			if (window == null) {
1439 				throw new IllegalArgumentException();
1440 			}
1441 			RetargetAction action = new LabelRetargetAction(getId(), WorkbenchMessages.Workbench_up);
1442 			action.setToolTipText(WorkbenchMessages.Workbench_upToolTip);
1443 			window.getPartService().addPartListener(action);
1444 			action.setActionDefinitionId(getCommandId());
1445 			return action;
1446 		}
1447 	};
1448 
1449 	/**
1450 	 * Workbench action (id: "helpContents", commandId:
1451 	 * "org.eclipse.ui.help.helpContents"): Open the help contents. This action is
1452 	 * always enabled.
1453 	 */
1454 	public static final ActionFactory HELP_CONTENTS = new ActionFactory("helpContents", //$NON-NLS-1$
1455 			IWorkbenchCommandConstants.HELP_HELP_CONTENTS) {
1456 
1457 		@Override
1458 		public IWorkbenchAction create(IWorkbenchWindow window) {
1459 			if (window == null) {
1460 				throw new IllegalArgumentException();
1461 			}
1462 			IWorkbenchAction action = new HelpContentsAction(window);
1463 			action.setId(getId());
1464 			return action;
1465 		}
1466 	};
1467 
1468 	/**
1469 	 * Workbench action (id: "helpSearch", commandId:
1470 	 * "org.eclipse.ui.help.helpSearch"): Open the help search. This action is
1471 	 * always enabled.
1472 	 *
1473 	 * @since 3.1
1474 	 */
1475 	public static final ActionFactory HELP_SEARCH = new ActionFactory("helpSearch", //$NON-NLS-1$
1476 			IWorkbenchCommandConstants.HELP_HELP_SEARCH) {
1477 
1478 		@Override
1479 		public IWorkbenchAction create(IWorkbenchWindow window) {
1480 			if (window == null) {
1481 				throw new IllegalArgumentException();
1482 			}
1483 			IWorkbenchAction action = new HelpSearchAction(window);
1484 			action.setId(getId());
1485 			return action;
1486 		}
1487 	};
1488 
1489 	/**
1490 	 * Workbench action (id: "dynamicHelp", commandId:
1491 	 * "org.eclipse.ui.help.dynamicHelp"): Open the dynamic help. This action is
1492 	 * always enabled.
1493 	 *
1494 	 * @since 3.1
1495 	 */
1496 	public static final ActionFactory DYNAMIC_HELP = new ActionFactory("dynamicHelp", //$NON-NLS-1$
1497 			IWorkbenchCommandConstants.HELP_DYNAMIC_HELP) {
1498 
1499 		@Override
1500 		public IWorkbenchAction create(IWorkbenchWindow window) {
1501 			if (window == null) {
1502 				throw new IllegalArgumentException();
1503 			}
1504 			IWorkbenchAction action = new DynamicHelpAction(window);
1505 			action.setId(getId());
1506 			return action;
1507 		}
1508 	};
1509 
1510 	/**
1511 	 * Workbench action (id: "openPerspectiveDialog", commandId:
1512 	 * "org.eclipse.ui.perspectives.showPerspective"): Open the Open Perspective
1513 	 * dialog. This action is always enabled.
1514 	 *
1515 	 * @since 3.1
1516 	 */
1517 	public static final ActionFactory OPEN_PERSPECTIVE_DIALOG = new ActionFactory("openPerspectiveDialog", //$NON-NLS-1$
1518 			IWorkbenchCommandConstants.PERSPECTIVES_SHOW_PERSPECTIVE) {
1519 
1520 		@Override
1521 		public IWorkbenchAction create(IWorkbenchWindow window) {
1522 			if (window == null) {
1523 				throw new IllegalArgumentException();
1524 			}
1525 
1526 			WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
1527 			action.setId(getId());
1528 			action.setText(WorkbenchMessages.OpenPerspectiveDialogAction_text);
1529 			action.setToolTipText(WorkbenchMessages.OpenPerspectiveDialogAction_tooltip);
1530 			action.setImageDescriptor(
1531 					WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_ETOOL_NEW_PAGE));
1532 
1533 			return action;
1534 		}
1535 	};
1536 
1537 	/**
1538 	 * Workbench action (id: "newEditor", commandId:
1539 	 * "org.eclipse.ui.window.newEditor"): Open a new editor on the active editor's
1540 	 * input. This action maintains its enablement state.
1541 	 *
1542 	 * @since 3.1
1543 	 */
1544 	public static final ActionFactory NEW_EDITOR = new ActionFactory("newEditor", //$NON-NLS-1$
1545 			IWorkbenchCommandConstants.WINDOW_NEW_EDITOR) {
1546 
1547 		@Override
1548 		public IWorkbenchAction create(IWorkbenchWindow window) {
1549 			if (window == null) {
1550 				throw new IllegalArgumentException();
1551 			}
1552 
1553 			WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
1554 			action.setId(getId());
1555 			action.setText(WorkbenchMessages.NewEditorAction_text);
1556 			action.setToolTipText(WorkbenchMessages.NewEditorAction_tooltip);
1557 
1558 			return action;
1559 		}
1560 	};
1561 
1562 	/**
1563 	 * Workbench action (id: "toggleCoolbar"): Toggle the visibility of the coolbar
1564 	 * and perspective switcher. This will only enable visibility of the coolbar and
1565 	 * perspective bar if the window advisor creating the window allowed for their
1566 	 * visibility initially.
1567 	 *
1568 	 * @since 3.3
1569 	 */
1570 	public static final ActionFactory TOGGLE_COOLBAR = new ActionFactory("toggleCoolbar") { //$NON-NLS-1$
1571 
1572 		@Override
1573 		public IWorkbenchAction create(IWorkbenchWindow window) {
1574 			if (window == null) {
1575 				throw new IllegalArgumentException();
1576 			}
1577 			WorkbenchCommandAction action = new WorkbenchCommandAction("org.eclipse.ui.ToggleCoolbarAction", window); //$NON-NLS-1$
1578 			action.setId(getId());
1579 			// set the default text - this will be updated by the handler
1580 			action.setText(WorkbenchMessages.ToggleCoolbarVisibilityAction_hide_text);
1581 			action.setToolTipText(WorkbenchMessages.ToggleCoolbarVisibilityAction_toolTip);
1582 			return action;
1583 		}
1584 	};
1585 
1586 	/**
1587 	 * Establishes bi-direction connections between the forward and backward actions
1588 	 * of a cycle pair.
1589 	 * <p>
1590 	 * Example usage:
1591 	 * </p>
1592 	 *
1593 	 * <pre>
1594 	 * ActionFactory.IWorkbenchAction nextEditorAction = ActionFactory.NEXT_EDITOR.create(window);
1595 	 * ActionFactory.IWorkbenchAction previousEditorAction = ActionFactory.PREVIOUS_EDITOR.create(window);
1596 	 * ActionFactory.linkCycleActionPair(nextEditorAction, previousEditorAction);
1597 	 * </pre>
1598 	 *
1599 	 * @param next     the action that moves forward
1600 	 * @param previous the action that moves backward
1601 	 */
linkCycleActionPair(IWorkbenchAction next, IWorkbenchAction previous)1602 	public static void linkCycleActionPair(IWorkbenchAction next, IWorkbenchAction previous) {
1603 	}
1604 
1605 	/**
1606 	 * Id of actions created by this action factory.
1607 	 */
1608 	private final String actionId;
1609 
1610 	/**
1611 	 * Optional ID for this action.
1612 	 */
1613 	private final String commandId;
1614 
1615 	/**
1616 	 * Creates a new workbench action factory with the given id.
1617 	 *
1618 	 * @param actionId the id of actions created by this action factory
1619 	 */
ActionFactory(String actionId)1620 	protected ActionFactory(String actionId) {
1621 		this(actionId, null);
1622 	}
1623 
1624 	/**
1625 	 * Create a new workbench action factory with the given IDs.
1626 	 *
1627 	 * @param actionId  the id of actions created by this action factory
1628 	 * @param commandId the matching command id
1629 	 * @since 3.5
1630 	 */
ActionFactory(String actionId, String commandId)1631 	protected ActionFactory(String actionId, String commandId) {
1632 		this.actionId = actionId;
1633 		this.commandId = commandId;
1634 	}
1635 
1636 	/**
1637 	 * Creates a new standard action for the given workbench window. The action has
1638 	 * an id as specified by the particular factory.
1639 	 * <p>
1640 	 * Actions automatically register listeners against the workbench window so that
1641 	 * they can keep their enablement state up to date. Ordinarily, the window's
1642 	 * references to these listeners will be dropped automatically when the window
1643 	 * closes. However, if the client needs to get rid of an action while the window
1644 	 * is still open, the client must call {@link IWorkbenchAction#dispose
1645 	 * dispose}to give the action an opportunity to deregister its listeners and to
1646 	 * perform any other cleanup.
1647 	 * </p>
1648 	 *
1649 	 * @param window the workbench window
1650 	 * @return the workbench action
1651 	 */
create(IWorkbenchWindow window)1652 	public abstract IWorkbenchAction create(IWorkbenchWindow window);
1653 
1654 	/**
1655 	 * Returns the id of this action factory.
1656 	 *
1657 	 * @return the id of actions created by this action factory
1658 	 */
getId()1659 	public String getId() {
1660 		return actionId;
1661 	}
1662 
1663 	/**
1664 	 * Return the command id of this action factory.
1665 	 *
1666 	 * @return the command id of the action created by this action factory. May be
1667 	 *         <code>null</code>.
1668 	 * @since 3.5
1669 	 */
getCommandId()1670 	public String getCommandId() {
1671 		return commandId;
1672 	}
1673 }
1674