Project

General

Profile

« Previous | Next » 

Revision 3be6ef3e

Added by Niels Hoffmann over 13 years ago

performed javacscript:fix and worked on documentation

View differences:

taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/operations/RemoveHomotypicalGroupBasionymOperation.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.eclipse.core.commands.ExecutionException;
13
import org.eclipse.core.commands.operations.IUndoContext;
14
import org.eclipse.core.runtime.IAdaptable;
15
import org.eclipse.core.runtime.IProgressMonitor;
16
import org.eclipse.core.runtime.IStatus;
17

  
18
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
19
import eu.etaxonomy.cdm.model.taxon.Taxon;
20
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
21

  
22
/**
23
 * @author p.ciardelli
24
 * @created 15.01.2009
25
 * @version 1.0
26
 */
27
public class RemoveHomotypicalGroupBasionymOperation extends
28
		AbstractPostOperation {
29

  
30
	private TaxonBase taxonBase;
31

  
32
	public RemoveHomotypicalGroupBasionymOperation(String text,
33
			IUndoContext undoContext, Taxon taxon, TaxonBase taxonBase, IPostOperationEnabled postOperationEnabled) {
34
		super(text, undoContext, taxon, postOperationEnabled);
35
		
36
		this.taxonBase = taxonBase;
37
	}
38

  
39
	/* (non-Javadoc)
40
	 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
41
	 */
42
	@Override
43
	public IStatus execute(IProgressMonitor monitor, IAdaptable info)
44
			throws ExecutionException {
45
		
46
		TaxonNameBase<?, ?> name = taxonBase.getName();
47
		monitor.worked(20);
48

  
49
		name.removeAsGroupsBasionym();
50
		monitor.worked(40);
51

  
52
		return postExecute(taxonBase);
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
		taxonBase.getName().setAsGroupsBasionym();
71
				
72
		return postExecute(taxonBase);
73
	}
74
}
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.eclipse.core.commands.ExecutionException;
13
import org.eclipse.core.commands.operations.IUndoContext;
14
import org.eclipse.core.runtime.IAdaptable;
15
import org.eclipse.core.runtime.IProgressMonitor;
16
import org.eclipse.core.runtime.IStatus;
17

  
18
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
19
import eu.etaxonomy.cdm.model.taxon.Taxon;
20
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
21

  
22
/**
23
 * <p>RemoveHomotypicalGroupBasionymOperation class.</p>
24
 *
25
 * @author p.ciardelli
26
 * @created 15.01.2009
27
 * @version 1.0
28
 */
29
public class RemoveHomotypicalGroupBasionymOperation extends
30
		AbstractPostOperation {
31

  
32
	private TaxonBase taxonBase;
33

  
34
	/**
35
	 * <p>Constructor for RemoveHomotypicalGroupBasionymOperation.</p>
36
	 *
37
	 * @param text a {@link java.lang.String} object.
38
	 * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
39
	 * @param taxon a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.
40
	 * @param taxonBase a {@link eu.etaxonomy.cdm.model.taxon.TaxonBase} object.
41
	 * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operations.IPostOperationEnabled} object.
42
	 */
43
	public RemoveHomotypicalGroupBasionymOperation(String text,
44
			IUndoContext undoContext, Taxon taxon, TaxonBase taxonBase, IPostOperationEnabled postOperationEnabled) {
45
		super(text, undoContext, taxon, postOperationEnabled);
46
		
47
		this.taxonBase = taxonBase;
48
	}
49

  
50
	/* (non-Javadoc)
51
	 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
52
	 */
53
	/** {@inheritDoc} */
54
	@Override
55
	public IStatus execute(IProgressMonitor monitor, IAdaptable info)
56
			throws ExecutionException {
57
		
58
		TaxonNameBase<?, ?> name = taxonBase.getName();
59
		monitor.worked(20);
60

  
61
		name.removeAsGroupsBasionym();
62
		monitor.worked(40);
63

  
64
		return postExecute(taxonBase);
65
	}
66

  
67
	/* (non-Javadoc)
68
	 * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
69
	 */
70
	/** {@inheritDoc} */
71
	@Override
72
	public IStatus redo(IProgressMonitor monitor, IAdaptable info)
73
			throws ExecutionException {
74
		return execute(monitor, info);
75
	}
76

  
77
	/* (non-Javadoc)
78
	 * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
79
	 */
80
	/** {@inheritDoc} */
81
	@Override
82
	public IStatus undo(IProgressMonitor monitor, IAdaptable info)
83
			throws ExecutionException {
84
		taxonBase.getName().setAsGroupsBasionym();
85
				
86
		return postExecute(taxonBase);
87
	}
88
}

Also available in: Unified diff