1 |
43e9ee3f
|
Patrick Plitzner
|
package eu.etaxonomy.taxeditor.handler.defaultHandler;
|
2 |
|
|
|
3 |
33957b86
|
Patrick Plitzner
|
import javax.inject.Named;
|
4 |
|
|
|
5 |
|
|
import org.eclipse.e4.core.di.annotations.CanExecute;
|
6 |
43e9ee3f
|
Patrick Plitzner
|
import org.eclipse.e4.core.di.annotations.Execute;
|
7 |
|
|
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
8 |
780e7696
|
Patrick Plitzner
|
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
|
9 |
33957b86
|
Patrick Plitzner
|
import org.eclipse.e4.ui.services.IServiceConstants;
|
10 |
43e9ee3f
|
Patrick Plitzner
|
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
11 |
|
|
import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
|
12 |
|
|
|
13 |
80313393
|
Patrick Plitzner
|
import eu.etaxonomy.taxeditor.bulkeditor.AppModelId;
|
14 |
|
|
|
15 |
43e9ee3f
|
Patrick Plitzner
|
public class OpenReferencingObjectsViewHandler {
|
16 |
|
|
|
17 |
|
|
@Execute
|
18 |
80313393
|
Patrick Plitzner
|
public void execute(EPartService partService) {
|
19 |
|
|
MPart part = partService.createPart(AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_BULKEDITOR_REFERENCINGOBJECTS_E4_REFERENCINGOBJECTSVIEWE4);
|
20 |
43e9ee3f
|
Patrick Plitzner
|
part = partService.showPart(part, PartState.ACTIVATE);
|
21 |
|
|
}
|
22 |
|
|
|
23 |
33957b86
|
Patrick Plitzner
|
@CanExecute
|
24 |
780e7696
|
Patrick Plitzner
|
public boolean canExecute(EPartService partService,
|
25 |
|
|
@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
|
26 |
|
|
MHandledMenuItem menuItem) {
|
27 |
|
|
boolean canExecute = false;
|
28 |
80313393
|
Patrick Plitzner
|
MPart part = partService.findPart(AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_BULKEDITOR_REFERENCINGOBJECTS_E4_REFERENCINGOBJECTSVIEWE4);
|
29 |
780e7696
|
Patrick Plitzner
|
canExecute = !part.equals(activePart);
|
30 |
|
|
menuItem.setVisible(canExecute);
|
31 |
|
|
return canExecute;
|
32 |
33957b86
|
Patrick Plitzner
|
}
|
33 |
|
|
|
34 |
43e9ee3f
|
Patrick Plitzner
|
}
|