Project

General

Profile

Download (1.65 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
import org.eclipse.jface.viewers.IStructuredSelection;
19

    
20
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
21
import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
22
import eu.etaxonomy.taxeditor.editor.name.operation.ChangeHomotypicalGroupBasionymOperation;
23
import eu.etaxonomy.taxeditor.model.AbstractUtility;
24
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
25

    
26
/**
27
 *
28
 * @author pplitzner
29
 * @since Aug 28, 2017
30
 *
31
 */
32
public class SetBasionymHandlerE4 {
33

    
34
    @Execute
35
    public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
36
            @Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
37
            MHandledMenuItem menuItem) {
38

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

    
41
		TaxonBase selectedTaxonBase = (TaxonBase) selection.getFirstElement();
42

    
43
		AbstractPostOperation operation;
44

    
45
		operation = new ChangeHomotypicalGroupBasionymOperation(menuItem.getLocalizedLabel(), editor.getUndoContext(),
46
        					editor.getTaxon(), selectedTaxonBase, editor);
47
        AbstractUtility.executeOperation(operation);
48
	}
49
}
(11-11/12)