Revision d3334540
Added by Katja Luther over 3 years ago
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/LinkWithTaxonHandlerE4.java | ||
---|---|---|
8 | 8 |
*/ |
9 | 9 |
package eu.etaxonomy.taxeditor.navigation.navigator.e4.handler; |
10 | 10 |
|
11 |
import javax.inject.Inject; |
|
11 | 12 |
import javax.inject.Named; |
12 | 13 |
|
13 | 14 |
import org.eclipse.e4.core.di.annotations.CanExecute; |
14 | 15 |
import org.eclipse.e4.core.di.annotations.Execute; |
16 |
import org.eclipse.e4.core.services.events.IEventBroker; |
|
15 | 17 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
16 | 18 |
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem; |
17 | 19 |
import org.eclipse.e4.ui.services.IServiceConstants; |
18 | 20 |
|
19 |
import eu.etaxonomy.taxeditor.event.EventUtility;
|
|
21 |
import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
|
|
20 | 22 |
import eu.etaxonomy.taxeditor.navigation.navigator.e4.TaxonNavigatorE4; |
21 | 23 |
|
22 | 24 |
/** |
... | ... | |
26 | 28 |
* |
27 | 29 |
*/ |
28 | 30 |
public class LinkWithTaxonHandlerE4 { |
31 |
@Inject |
|
32 |
private IEventBroker eventBroker; |
|
29 | 33 |
|
30 | 34 |
@Execute |
31 | 35 |
public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart) { |
32 |
if (activePart!=null && activePart.getObject() instanceof TaxonNavigatorE4) { |
|
33 |
TaxonNavigatorE4 taxonNavigator = (TaxonNavigatorE4) activePart.getObject(); |
|
34 |
taxonNavigator.setLinkWithTaxon(!taxonNavigator.isLinkWithTaxon()); |
|
35 |
if(taxonNavigator.isLinkWithTaxon()){ |
|
36 |
taxonNavigator.updateCurrentTaxon(EventUtility.getTaxonEditor()); |
|
37 |
} |
|
38 |
} |
|
36 |
eventBroker.post(WorkbenchEventConstants.UPDATE_LINK_WITH_TAXON, true); |
|
39 | 37 |
} |
40 | 38 |
|
41 | 39 |
@CanExecute |
Also available in: Unified diff
fix #9264: use eventbus for updating link with taxon