performed javacscript:fix and worked on documentation
[taxeditor.git] / taxeditor-store / src / main / java / eu / etaxonomy / taxeditor / operations / DeleteNameRelationOperation.java
1 // $Id$
2 /**
3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
6 *
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
9 */
10
11 package eu.etaxonomy.taxeditor.operations;
12
13 import org.eclipse.core.commands.ExecutionException;
14 import org.eclipse.core.commands.operations.IUndoContext;
15 import org.eclipse.core.runtime.IAdaptable;
16 import org.eclipse.core.runtime.IProgressMonitor;
17 import org.eclipse.core.runtime.IStatus;
18
19 import eu.etaxonomy.cdm.model.name.NameRelationship;
20 import eu.etaxonomy.cdm.model.name.TaxonNameBase;
21
22 /**
23 * <p>DeleteNameRelationOperation class.</p>
24 *
25 * @author n.hoffmann
26 * @created Mar 30, 2010
27 * @version 1.0
28 */
29 public class DeleteNameRelationOperation extends AbstractPostOperation {
30
31 private NameRelationship nameRelationship;
32
33 /**
34 * <p>Constructor for DeleteNameRelationOperation.</p>
35 *
36 * @param label a {@link java.lang.String} object.
37 * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
38 * @param nameRelationship a {@link eu.etaxonomy.cdm.model.name.NameRelationship} object.
39 * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operations.IPostOperationEnabled} object.
40 */
41 public DeleteNameRelationOperation(String label, IUndoContext undoContext, NameRelationship nameRelationship,
42 IPostOperationEnabled postOperationEnabled) {
43 super(label, undoContext, postOperationEnabled);
44 this.nameRelationship = nameRelationship;
45 }
46
47 /* (non-Javadoc)
48 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
49 */
50 /** {@inheritDoc} */
51 @Override
52 public IStatus execute(IProgressMonitor monitor, IAdaptable info)
53 throws ExecutionException {
54
55 TaxonNameBase fromName = nameRelationship.getFromName();
56
57 fromName.removeRelationToTaxonName(nameRelationship.getToName());
58
59 return postExecute(null);
60 }
61
62 /* (non-Javadoc)
63 * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
64 */
65 /** {@inheritDoc} */
66 @Override
67 public IStatus redo(IProgressMonitor monitor, IAdaptable info)
68 throws ExecutionException {
69 return execute(monitor, info);
70 }
71
72 /* (non-Javadoc)
73 * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
74 */
75 /** {@inheritDoc} */
76 @Override
77 public IStatus undo(IProgressMonitor monitor, IAdaptable info)
78 throws ExecutionException {
79 // TODO Auto-generated method stub
80 return null;
81 }
82 }