Project

General

Profile

Download (2.29 KB) Statistics
| Branch: | Tag: | Revision:
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.apache.log4j.Logger;
14
import org.eclipse.core.commands.ExecutionException;
15
import org.eclipse.core.commands.operations.IUndoContext;
16
import org.eclipse.core.runtime.IAdaptable;
17
import org.eclipse.core.runtime.IProgressMonitor;
18
import org.eclipse.core.runtime.IStatus;
19

    
20
import eu.etaxonomy.cdm.model.name.NameRelationship;
21
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
22

    
23
/**
24
 * @author n.hoffmann
25
 * @created Mar 30, 2010
26
 * @version 1.0
27
 */
28
public class DeleteNameRelationOperation extends AbstractPostOperation {
29

    
30

    
31
	private static final Logger logger = Logger
32
			.getLogger(DeleteNameRelationOperation.class);
33
	private NameRelationship nameRelationship;
34

    
35
	public DeleteNameRelationOperation(String label, IUndoContext undoContext, NameRelationship nameRelationship,
36
			IPostOperationEnabled postOperationEnabled) {
37
		super(label, undoContext, postOperationEnabled);
38
		this.nameRelationship = nameRelationship;
39
	}
40
	
41
	/* (non-Javadoc)
42
	 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
43
	 */
44
	@Override
45
	public IStatus execute(IProgressMonitor monitor, IAdaptable info)
46
			throws ExecutionException {
47
		
48
		TaxonNameBase fromName = nameRelationship.getFromName();
49
		
50
		fromName.removeRelationToTaxonName(nameRelationship.getToName());
51
		
52
		return postExecute(null);
53
	}
54

    
55
	/* (non-Javadoc)
56
	 * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
57
	 */
58
	@Override
59
	public IStatus redo(IProgressMonitor monitor, IAdaptable info)
60
			throws ExecutionException {
61
		return execute(monitor, info);
62
	}
63

    
64
	/* (non-Javadoc)
65
	 * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
66
	 */
67
	@Override
68
	public IStatus undo(IProgressMonitor monitor, IAdaptable info)
69
			throws ExecutionException {
70
		// TODO Auto-generated method stub
71
		return null;
72
	}
73
}
(27-27/40)