Project

General

Profile

Download (1.77 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2007 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.name.e4.handler;
11

    
12
import javax.inject.Named;
13

    
14
import org.eclipse.e4.core.di.annotations.Execute;
15
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
16
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
17
import org.eclipse.e4.ui.services.IServiceConstants;
18

    
19
import eu.etaxonomy.cdm.model.name.TaxonName;
20
import eu.etaxonomy.cdm.model.taxon.Taxon;
21
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
22
import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
23
import eu.etaxonomy.taxeditor.editor.view.concept.operation.CreateConceptRelationOperation;
24
import eu.etaxonomy.taxeditor.model.AbstractUtility;
25
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
26
import eu.etaxonomy.taxeditor.parser.ParseHandler;
27

    
28
/**
29
 *
30
 * @author pplitzner
31
 * @since Aug 28, 2017
32
 *
33
 */
34
public class CreateMisapplicationHandlerE4 {
35

    
36
    @Execute
37
    public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
38
            MHandledMenuItem menuItem) {
39

    
40
        TaxonNameEditorE4 editor = (TaxonNameEditorE4) activePart.getObject();
41

    
42
		TaxonName conceptName = ParseHandler.createEmptyName();
43
		Taxon concept = Taxon.NewInstance(conceptName, null);
44

    
45
		TaxonRelationshipType type = TaxonRelationshipType.MISAPPLIED_NAME_FOR();
46

    
47
		AbstractPostOperation<?> operation;
48
		operation = new CreateConceptRelationOperation(menuItem.getLocalizedLabel(),
49
        		editor.getUndoContext(), editor.getTaxon(), concept, type, editor);
50
        AbstractUtility.executeOperation(operation);
51
	}
52
}
(6-6/12)