Project

General

Profile

Download (1.14 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2017 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.event;
10

    
11
import javax.annotation.PostConstruct;
12
import javax.inject.Inject;
13

    
14
import org.eclipse.e4.core.di.annotations.Optional;
15
import org.eclipse.e4.ui.di.UIEventTopic;
16

    
17
import eu.etaxonomy.cdm.model.taxon.Taxon;
18
import eu.etaxonomy.taxeditor.editor.ITaxonEditor;
19

    
20
/**
21
 * @author pplitzner
22
 * @since Sep 4, 2017
23
 *
24
 */
25
public class EventUtility {
26

    
27
    private static ITaxonEditor editor;
28

    
29
    @PostConstruct
30
    public void create(){
31
        //nothing
32
    }
33

    
34
    @Inject
35
    @Optional
36
    private void updateCurrentTaxon(@UIEventTopic(WorkbenchEventConstants.CURRENT_ACTIVE_EDITOR)ITaxonEditor editor){
37
        EventUtility.editor = editor;
38
    }
39

    
40
    public static Taxon getCurrentTaxon() {
41
        if(editor!=null){
42
            return editor.getTaxon();
43
        }
44
        return null;
45
    }
46

    
47
    public static ITaxonEditor getEditor() {
48
        return editor;
49
    }
50

    
51
}
(1-1/2)