minor
[taxeditor.git] / eu.etaxonomy.taxeditor.editor / src / main / java / eu / etaxonomy / taxeditor / editor / view / descriptive / operation / MoveDescriptionElementsOperation.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.editor.view.descriptive.operation;
12
13 import java.util.Collection;
14
15 import org.eclipse.core.commands.ExecutionException;
16 import org.eclipse.core.commands.operations.IUndoContext;
17 import org.eclipse.core.runtime.IAdaptable;
18 import org.eclipse.core.runtime.IProgressMonitor;
19 import org.eclipse.core.runtime.IStatus;
20
21 import eu.etaxonomy.cdm.api.service.IDescriptionService;
22 import eu.etaxonomy.cdm.model.description.DescriptionBase;
23 import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
24 import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;
25 import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
26 import eu.etaxonomy.taxeditor.store.CdmStore;
27
28 /**
29 * @author n.hoffmann
30 * @created Feb 8, 2011
31 * @version 1.0
32 */
33 public class MoveDescriptionElementsOperation extends AbstractPostTaxonOperation {
34
35 private Collection<DescriptionElementBase> descriptionElements;
36 private DescriptionBase targetDescription;
37 private IDescriptionService service;
38 private boolean isCopy;
39
40 /**
41 *
42 * @param label
43 * @param undoContext
44 * @param targetDescription
45 * @param descriptionElements
46 * @param isCopy
47 * @param postOperationEnabled
48 */
49 public MoveDescriptionElementsOperation(String label,
50 IUndoContext undoContext, DescriptionBase targetDescription,
51 Collection<DescriptionElementBase> descriptionElements, boolean isCopy,
52 IPostOperationEnabled postOperationEnabled) {
53 super(label, undoContext, postOperationEnabled);
54 this.targetDescription = targetDescription;
55 this.descriptionElements = descriptionElements;
56 this.isCopy = isCopy;
57
58 service = CdmStore.getService(IDescriptionService.class);
59 }
60
61 /* (non-Javadoc)
62 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
63 */
64 @Override
65 public IStatus execute(IProgressMonitor monitor, IAdaptable info)
66 throws ExecutionException {
67
68
69 service.moveDescriptionElementsToDescription(descriptionElements, targetDescription, isCopy);
70
71 return postExecute(targetDescription);
72 }
73
74 /* (non-Javadoc)
75 * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
76 */
77 @Override
78 public IStatus redo(IProgressMonitor monitor, IAdaptable info)
79 throws ExecutionException {
80 // TODO Auto-generated method stub
81 return null;
82 }
83
84 /* (non-Javadoc)
85 * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
86 */
87 @Override
88 public IStatus undo(IProgressMonitor monitor, IAdaptable info)
89 throws ExecutionException {
90 // TODO Auto-generated method stub
91 return null;
92 }
93
94 }