refactoring actions in the treeviewer
[taxeditor.git] / eclipseprojects / eu.etaxonomy.taxeditor / src / eu / etaxonomy / taxeditor / operations / AbstractEditorOperation.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.operations;
11
12 import org.apache.log4j.Logger;
13 import org.eclipse.core.commands.operations.AbstractOperation;
14 import org.eclipse.core.commands.operations.IUndoContext;
15 import org.eclipse.core.runtime.IStatus;
16 import org.eclipse.core.runtime.Status;
17
18 import eu.etaxonomy.cdm.model.taxon.Taxon;
19 import eu.etaxonomy.taxeditor.UiUtil;
20
21 /**
22 * @author p.ciardelli
23 * @created 14.01.2009
24 * @version 1.0
25 */
26 public abstract class AbstractEditorOperation extends AbstractOperation {
27
28 @SuppressWarnings("unused")
29 private static final Logger logger = Logger
30 .getLogger(AbstractEditorOperation.class);
31
32 /**
33 * A reference to the taxon the concrete operation is working on
34 */
35 protected Taxon taxon;
36
37 public AbstractEditorOperation(String label, IUndoContext undoContext,
38 Taxon taxon) {
39 super(label);
40 addContext(undoContext);
41
42 this.taxon = taxon;
43 }
44
45 /**
46 *
47 * @return
48 */
49 protected IStatus redrawOpenEditor() {
50 return UiUtil.redrawEditor(taxon) ? Status.OK_STATUS : Status.CANCEL_STATUS;
51 }
52 }