3 * Copyright (C) 2009 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.taxeditor
.editor
.definedterm
.operation
;
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
;
20 import eu
.etaxonomy
.cdm
.api
.service
.IVocabularyService
;
21 import eu
.etaxonomy
.cdm
.model
.common
.DefinedTerm
;
22 import eu
.etaxonomy
.cdm
.model
.common
.OrderedTermVocabulary
;
23 import eu
.etaxonomy
.cdm
.model
.common
.TermType
;
24 import eu
.etaxonomy
.cdm
.model
.common
.TermVocabulary
;
25 import eu
.etaxonomy
.taxeditor
.editor
.definedterm
.DefinedTermEditor
;
26 import eu
.etaxonomy
.taxeditor
.editor
.definedterm
.input
.TermEditorInput
;
27 import eu
.etaxonomy
.taxeditor
.operation
.AbstractPostOperation
;
28 import eu
.etaxonomy
.taxeditor
.operation
.IPostOperationEnabled
;
29 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
36 public class CreateTermVocabularyOperation
extends AbstractPostOperation
{
38 private TermEditorInput definedEditorInput
;
43 * @param postOperationEnabled
45 public CreateTermVocabularyOperation(String label
,
46 IUndoContext undoContext
,
47 TermEditorInput definedEditorInput
,
48 IPostOperationEnabled postOperationEnabled
) {
49 super(label
, undoContext
, postOperationEnabled
);
50 this.definedEditorInput
= definedEditorInput
;
54 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
57 public IStatus
execute(IProgressMonitor monitor
, IAdaptable info
)
58 throws ExecutionException
{
60 TermVocabulary termVocabulary
=
61 TermVocabulary
.NewInstance(definedEditorInput
.getTermType(),
67 CdmStore
.getService(IVocabularyService
.class).save(termVocabulary
);
68 definedEditorInput
.getVocabularies().add(termVocabulary
);
70 return postExecute(termVocabulary
);
74 * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
77 public IStatus
redo(IProgressMonitor monitor
, IAdaptable info
)
78 throws ExecutionException
{
79 // TODO Auto-generated method stub
84 * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
87 public IStatus
undo(IProgressMonitor monitor
, IAdaptable info
)
88 throws ExecutionException
{
89 // TODO Auto-generated method stub