Project

General

Profile

Download (1.96 KB) Statistics
| Branch: | Tag: | Revision:
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
package eu.etaxonomy.taxeditor.editor.view.uses.e4.handler;
10

    
11

    
12
import javax.inject.Named;
13

    
14
import org.eclipse.e4.core.di.annotations.CanExecute;
15
import org.eclipse.e4.ui.services.IServiceConstants;
16

    
17
import eu.etaxonomy.cdm.model.description.DescriptionBase;
18
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
19
import eu.etaxonomy.cdm.model.description.Feature;
20
import eu.etaxonomy.taxeditor.editor.EditorUtil;
21
import eu.etaxonomy.taxeditor.editor.view.descriptive.e4.handler.CreateDescriptionElementHandlerE4;
22
import eu.etaxonomy.taxeditor.editor.view.uses.operation.CreateUseSummaryOperation;
23
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
24
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
25
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
26
import eu.etaxonomy.taxeditor.store.UseObjectStore;
27

    
28
/**
29
 *
30
 * @author pplitzner
31
 * @since Sep 8, 2017
32
 *
33
 */
34
public class CreateUseSummaryHandlerE4 extends CreateDescriptionElementHandlerE4 {
35

    
36
	/** {@inheritDoc} */
37
	@Override
38
	protected AbstractPostOperation operationCreationInstance(String label, Feature feature, DescriptionBase<?> description, IPostOperationEnabled postOperationEnabled) {
39
		//Use Record Feature retrieval below
40
		Feature useSummarFeature = UseObjectStore.getUseSummaryFeature();
41

    
42
		useSummarFeature.setSupportsTextData(true);
43
		return new CreateUseSummaryOperation(label,	EditorUtil.getUndoContext(), description, useSummarFeature, postOperationEnabled);
44
	}
45

    
46
	@CanExecute
47
	public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)Object selection){
48
	    return selection instanceof DescriptionBase
49
	            || selection instanceof DescriptionElementBase
50
	            || selection instanceof FeatureNodeContainer;
51
	}
52

    
53
}
(3-3/3)