fix NPE bug and termloading bug for Usage Records #4247
[taxeditor.git] / eu.etaxonomy.taxeditor.editor / src / main / java / eu / etaxonomy / taxeditor / editor / view / uses / handler / CreateUseRecordHandler.java
1 /**
2 * Copyright (C) 2011 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
5 *
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.
8 */
9
10 package eu.etaxonomy.taxeditor.editor.view.uses.handler;
11
12 import org.eclipse.core.commands.ExecutionEvent;
13
14 import eu.etaxonomy.cdm.api.service.ITermService;
15 import eu.etaxonomy.cdm.model.description.DescriptionBase;
16 import eu.etaxonomy.cdm.model.description.Feature;
17 import eu.etaxonomy.taxeditor.editor.EditorUtil;
18 import eu.etaxonomy.taxeditor.editor.view.descriptive.handler.CreateDescriptionElementHandler;
19 import eu.etaxonomy.taxeditor.editor.view.uses.operation.CreateUseRecordOperation;
20 import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
21 import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
22 import eu.etaxonomy.taxeditor.store.CdmStore;
23 import eu.etaxonomy.taxeditor.store.UsageTermCollection;
24 import eu.etaxonomy.taxeditor.store.UseObjectStore;
25
26 /**
27 * CreateUseRecordHandler Class
28 * @author a.theys
29 * @created mar 13, 2012
30 * @version 1.0
31 */
32 public class CreateUseRecordHandler extends CreateDescriptionElementHandler {
33 /** {@inheritDoc} */
34 @Override
35 protected AbstractPostOperation operationCreationInstance(String label, ExecutionEvent event, DescriptionBase<?> description, IPostOperationEnabled postOperationEnabled) {
36 //Use Record Feature retrieval below
37 Feature feature = UseObjectStore.getUseRecordFeature();
38 feature.setSupportsCategoricalData(true);
39 return new CreateUseRecordOperation(label,
40 EditorUtil.getUndoContext(),
41 description, feature, postOperationEnabled);
42 }
43
44
45
46 }