changes for move descriptions and description elements
[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 import org.eclipse.swt.widgets.Display;
21 import org.eclipse.ui.PartInitException;
22
23 import eu.etaxonomy.cdm.api.service.IDescriptionService;
24 import eu.etaxonomy.cdm.model.common.CdmBase;
25 import eu.etaxonomy.cdm.model.description.DescriptionBase;
26 import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
27 import eu.etaxonomy.taxeditor.editor.EditorUtil;
28 import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
29 import eu.etaxonomy.taxeditor.model.AbstractUtility;
30 import eu.etaxonomy.taxeditor.model.MessagingUtils;
31 import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;
32 import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
33 import eu.etaxonomy.taxeditor.store.CdmStore;
34
35 /**
36 * @author n.hoffmann
37 * @created Feb 8, 2011
38 * @version 1.0
39 */
40 public class MoveDescriptionElementsOperation extends AbstractPostTaxonOperation{
41
42 private Collection<DescriptionElementBase> descriptionElements;
43 private DescriptionBase targetDescription;
44 private IDescriptionService service;
45 private boolean isCopy;
46
47 /**
48 *
49 * @param label
50 * @param undoContext
51 * @param targetDescription
52 * @param descriptionElements
53 * @param isCopy
54 * @param postOperationEnabled
55 */
56 public MoveDescriptionElementsOperation(String label,
57 IUndoContext undoContext, DescriptionBase targetDescription,
58 Collection<DescriptionElementBase> descriptionElements, boolean isCopy,
59 IPostOperationEnabled postOperationEnabled) {
60 super(label, undoContext, postOperationEnabled);
61 this.targetDescription = targetDescription;
62 this.descriptionElements = descriptionElements;
63 this.isCopy = isCopy;
64
65 service = CdmStore.getService(IDescriptionService.class);
66 }
67
68 /* (non-Javadoc)
69 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
70 */
71 @Override
72 public IStatus execute(IProgressMonitor monitor, IAdaptable info)
73 throws ExecutionException {
74
75
76 service.moveDescriptionElementsToDescription(descriptionElements, targetDescription, isCopy);
77
78
79 return postExecute(targetDescription);
80 }
81
82 /* (non-Javadoc)
83 * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
84 */
85 @Override
86 public IStatus redo(IProgressMonitor monitor, IAdaptable info)
87 throws ExecutionException {
88 // TODO Auto-generated method stub
89 return null;
90 }
91
92 /* (non-Javadoc)
93 * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
94 */
95 @Override
96 public IStatus undo(IProgressMonitor monitor, IAdaptable info)
97 throws ExecutionException {
98 // TODO Auto-generated method stub
99 return null;
100 }
101
102
103
104 }