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
.OrderedTermVocabulary
;
20 import eu
.etaxonomy
.cdm
.model
.common
.TermVocabulary
;
21 import eu
.etaxonomy
.taxeditor
.editor
.definedterm
.DefinedTermEditor
;
22 import eu
.etaxonomy
.taxeditor
.operation
.AbstractPostOperation
;
23 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
30 public class CreateTermVocabularyOperation
extends AbstractPostOperation
{
32 private DefinedTermEditor definedTermEditor
;
37 * @param postOperationEnabled
39 public CreateTermVocabularyOperation(String label
,
40 IUndoContext undoContext
, DefinedTermEditor definedTermEditor
) {
41 super(label
, undoContext
, definedTermEditor
);
42 this.definedTermEditor
= definedTermEditor
;
46 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
49 public IStatus
execute(IProgressMonitor monitor
, IAdaptable info
)
50 throws ExecutionException
{
52 TermVocabulary termVocabulary
= OrderedTermVocabulary
.NewInstance(null, "Untitled", null, null);
53 CdmStore
.getService(IVocabularyService
.class).save(termVocabulary
);
54 definedTermEditor
.getInMemoryVocabularies().add(termVocabulary
);
56 return postExecute(termVocabulary
);
60 * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
63 public IStatus
redo(IProgressMonitor monitor
, IAdaptable info
)
64 throws ExecutionException
{
65 // TODO Auto-generated method stub
70 * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
73 public IStatus
undo(IProgressMonitor monitor
, IAdaptable info
)
74 throws ExecutionException
{
75 // TODO Auto-generated method stub