1
|
/**
|
2
|
* Copyright (C) 2009 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.navigation.navigator.e4.handler;
|
10
|
|
11
|
import javax.inject.Named;
|
12
|
|
13
|
import org.eclipse.e4.core.di.annotations.CanExecute;
|
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.taxeditor.navigation.navigator.e4.TaxonNavigatorE4;
|
20
|
|
21
|
/**
|
22
|
*
|
23
|
* @author pplitzner
|
24
|
* @date 05.09.2017
|
25
|
*
|
26
|
*/
|
27
|
public class LinkWithTaxonHandlerE4 {
|
28
|
|
29
|
@Execute
|
30
|
public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart) {
|
31
|
TaxonNavigatorE4 taxonNavigator = (TaxonNavigatorE4) activePart.getObject();
|
32
|
taxonNavigator.setLinkWithTaxon(!taxonNavigator.isLinkWithTaxon());
|
33
|
}
|
34
|
|
35
|
@CanExecute
|
36
|
public boolean canExecute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
|
37
|
MHandledMenuItem menuItem){
|
38
|
boolean canExecute = false;
|
39
|
canExecute = activePart.getObject() instanceof TaxonNavigatorE4;
|
40
|
menuItem.setVisible(canExecute);
|
41
|
return canExecute;
|
42
|
}
|
43
|
}
|