2 * Copyright (C) 2009 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
9 package eu
.etaxonomy
.taxeditor
.editor
.definedterm
.operation
;
11 import org
.eclipse
.core
.commands
.ExecutionException
;
12 import org
.eclipse
.core
.commands
.operations
.IUndoContext
;
13 import org
.eclipse
.core
.runtime
.IAdaptable
;
14 import org
.eclipse
.core
.runtime
.IProgressMonitor
;
15 import org
.eclipse
.core
.runtime
.IStatus
;
17 import eu
.etaxonomy
.cdm
.api
.service
.IVocabularyService
;
18 import eu
.etaxonomy
.cdm
.model
.common
.TermVocabulary
;
19 import eu
.etaxonomy
.taxeditor
.editor
.definedterm
.input
.TermEditorInput
;
20 import eu
.etaxonomy
.taxeditor
.operation
.AbstractPostTaxonOperation
;
21 import eu
.etaxonomy
.taxeditor
.operation
.IPostOperationEnabled
;
22 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
29 public class CreateTermVocabularyOperation
extends AbstractPostTaxonOperation
{
31 private final TermEditorInput definedEditorInput
;
36 * @param postOperationEnabled
38 public CreateTermVocabularyOperation(String label
,
39 IUndoContext undoContext
,
40 TermEditorInput definedEditorInput
,
41 IPostOperationEnabled postOperationEnabled
) {
42 super(label
, undoContext
, postOperationEnabled
);
43 this.definedEditorInput
= definedEditorInput
;
47 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
50 public IStatus
execute(IProgressMonitor monitor
, IAdaptable info
)
51 throws ExecutionException
{
53 TermVocabulary termVocabulary
=
54 TermVocabulary
.NewInstance(definedEditorInput
.getTermType(),
60 termVocabulary
= CdmStore
.getService(IVocabularyService
.class).save(termVocabulary
);
61 definedEditorInput
.getVocabularies().add(termVocabulary
);
63 return postExecute(termVocabulary
);
67 * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
70 public IStatus
redo(IProgressMonitor monitor
, IAdaptable info
)
71 throws ExecutionException
{
72 // TODO Auto-generated method stub
77 * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
80 public IStatus
undo(IProgressMonitor monitor
, IAdaptable info
)
81 throws ExecutionException
{
82 // TODO Auto-generated method stub