// $Id$\r
/**\r
* Copyright (C) 2009 EDIT\r
-* European Distributed Institute of Taxonomy \r
+* European Distributed Institute of Taxonomy\r
* http://www.e-taxonomy.eu\r
-* \r
+*\r
* The contents of this file are subject to the Mozilla Public License Version 1.1\r
* See LICENSE.TXT at the top of this package for the full license terms.\r
*/\r
import eu.etaxonomy.taxeditor.model.MessagingUtils;\r
import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;\r
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;\r
+import eu.etaxonomy.taxeditor.store.CdmStore;\r
import eu.etaxonomy.taxeditor.store.StoreUtil;\r
\r
/**\r
*/\r
public class CreateDefinedTermOperation extends AbstractPostTaxonOperation {\r
\r
- \r
\r
- private TermBase parentTermBase;\r
- private TermEditorInput definedTermInput;\r
+\r
+ private final TermBase parentTermBase;\r
+ private final TermEditorInput definedTermInput;\r
\r
/**\r
* @param label\r
* @param postOperationEnabled\r
*/\r
public CreateDefinedTermOperation(String label,\r
- IUndoContext undoContext, \r
+ IUndoContext undoContext,\r
TermBase termBase,\r
TermEditorInput definedTermInput,\r
IPostOperationEnabled postOperationEnabled) {\r
@Override\r
public IStatus execute(IProgressMonitor monitor, IAdaptable info)\r
throws ExecutionException {\r
- \r
+\r
DefinedTermBase newTerm = definedTermInput.getTermType().getEmptyDefinedTermBase();\r
if (newTerm == null) {\r
- IStatus status = \r
- new Status(IStatus.CANCEL, \r
- StoreUtil.getPluginId(), \r
+ IStatus status =\r
+ new Status(IStatus.CANCEL,\r
+ StoreUtil.getPluginId(),\r
"Creation of term corresponding to type '" + definedTermInput.getTermType().getMessage() + "' is not yet supported");\r
MessagingUtils.warningDialog("Cannot create term", newTerm, status);\r
return status;\r
}\r
- \r
+ newTerm = CdmStore.getCurrentApplicationConfiguration().getTermService().save(newTerm);\r
+\r
if (parentTermBase instanceof TermVocabulary){\r
TermVocabulary vocabulary = (TermVocabulary) parentTermBase;\r
vocabulary.addTerm(newTerm);\r
} else if (parentTermBase instanceof DefinedTermBase) {\r
- DefinedTermBase parent = (DefinedTermBase) parentTermBase; \r
- parent.addIncludes(newTerm); \r
+ DefinedTermBase parent = (DefinedTermBase) parentTermBase;\r
+ parent.addIncludes(newTerm);\r
TermVocabulary vocabulary = parent.getVocabulary();\r
vocabulary.addTerm(newTerm);\r
}\r
- \r
+\r
return postExecute(newTerm);\r
}\r
\r