started to refactor action delegation
[taxeditor.git] / eclipseprojects / eu.etaxonomy.taxeditor / src / eu / etaxonomy / taxeditor / actions / TaxEditorActionFactory.java
1 /**
2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
5 *
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
8 */
9
10 package eu.etaxonomy.taxeditor.actions;
11
12 import org.apache.log4j.Logger;
13 import org.eclipse.ui.IWorkbenchWindow;
14 import org.eclipse.ui.actions.ActionFactory;
15 import org.eclipse.ui.actions.NewWizardAction;
16 import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
17
18 import eu.etaxonomy.taxeditor.actions.ui.OpenTaxonEditorAction;
19
20 /**
21 * This class is an extension to the standard ActionFactory. Any useful
22 * functionality already implemented in ActionFactory may be used or
23 * overwritten by more suitable implementations.
24 *
25 * @author n.hoffmann
26 * @created 03.02.2009
27 * @version 1.0
28 */
29 public abstract class TaxEditorActionFactory extends ActionFactory {
30 private static final Logger logger = Logger
31 .getLogger(TaxEditorActionFactory.class);
32
33 /**
34 * Workbench action (id "new"): Opens the new wizard dialog. This action maintains
35 * its enablement state.
36 */
37 public static final ActionFactory NEW = new ActionFactory("new") {//$NON-NLS-1$
38
39 /* (non-Javadoc)
40 * @see org.eclipse.ui.actions.ActionFactory#create(org.eclipse.ui.IWorkbenchWindow)
41 */
42 public IWorkbenchAction create(IWorkbenchWindow window) {
43 if (window == null) {
44 throw new IllegalArgumentException();
45 }
46 IWorkbenchAction action = new OpenTaxonEditorAction();
47 action.setId(getId());
48 return action;
49 }
50 };
51
52 /**
53 * Creates a new workbench action factory with the given id.
54 *
55 * @param actionId
56 * the id of actions created by this action factory
57 */
58 protected TaxEditorActionFactory(String actionId) {
59 super(actionId);
60 }
61 }