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
;
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
;
18 import eu
.etaxonomy
.cdm
.api
.service
.IVocabularyService
;
19 import eu
.etaxonomy
.cdm
.model
.common
.TermVocabulary
;
20 import eu
.etaxonomy
.taxeditor
.editor
.definedterm
.input
.TermEditorInput
;
21 import eu
.etaxonomy
.taxeditor
.operation
.AbstractPostTaxonOperation
;
22 import eu
.etaxonomy
.taxeditor
.operation
.IPostOperationEnabled
;
23 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
30 public class CreateTermVocabularyOperation
extends AbstractPostTaxonOperation
{
32 private TermEditorInput definedEditorInput
;
37 * @param postOperationEnabled
39 public CreateTermVocabularyOperation(String label
,
40 IUndoContext undoContext
,
41 TermEditorInput definedEditorInput
,
42 IPostOperationEnabled postOperationEnabled
) {
43 super(label
, undoContext
, postOperationEnabled
);
44 this.definedEditorInput
= definedEditorInput
;
48 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
51 public IStatus
execute(IProgressMonitor monitor
, IAdaptable info
)
52 throws ExecutionException
{
54 TermVocabulary termVocabulary
=
55 TermVocabulary
.NewInstance(definedEditorInput
.getTermType(),
61 CdmStore
.getService(IVocabularyService
.class).save(termVocabulary
);
62 definedEditorInput
.getVocabularies().add(termVocabulary
);
64 return postExecute(termVocabulary
);
68 * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
71 public IStatus
redo(IProgressMonitor monitor
, IAdaptable info
)
72 throws ExecutionException
{
73 // TODO Auto-generated method stub
78 * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
81 public IStatus
undo(IProgressMonitor monitor
, IAdaptable info
)
82 throws ExecutionException
{
83 // TODO Auto-generated method stub