<elements xsi:type="basic:PartDescriptor" xmi:id="_ghDAsKO6EeeWePK798pdTw" elementId="eu.etaxonomy.taxeditor.editor.key.polytomous.e4.PolytomousKeyGraphEditorE4" label="%editor.name.2" closeable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.key.polytomous.e4.PolytomousKeyGraphEditorE4">
<handlers xmi:id="_dpB_kKRbEeePufXF8uhoCw" elementId="eu.etaxonomy.taxeditor.editor.key.e4.handler.ApplyLayoutHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.key.e4.handler.ApplyLayoutHandlerE4" command="_zN-H8KO8EeeWePK798pdTw"/>
<menus xsi:type="menu:PopupMenu" xmi:id="_J8Q6AKRbEeePufXF8uhoCw" elementId="eu.etaxonomy.taxeditor.editor.popupmenu.polytomouskeygrapheditor" toBeRendered="false" visible="false">
- <children xsi:type="menu:HandledMenuItem" xmi:id="_bnPG8KRbEeePufXF8uhoCw" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.keygraph.newnode" label="%command.label.20" command="_jJ_4kKO9EeeWePK798pdTw"/>
- <children xsi:type="menu:HandledMenuItem" xmi:id="_wKd6cKRbEeePufXF8uhoCw" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.keygraph.delete" label="%command.label.21" command="_uM4zsKO8EeeWePK798pdTw"/>
- <children xsi:type="menu:MenuSeparator" xmi:id="_whq5gKRbEeePufXF8uhoCw" elementId="eu.etaxonomy.taxeditor.editor.menuseparator.18"/>
- <children xsi:type="menu:HandledMenuItem" xmi:id="_w9X-EKRbEeePufXF8uhoCw" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.keygraph.applylayout" label="%command.label.22" command="_zN-H8KO8EeeWePK798pdTw"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_bnPG8KRbEeePufXF8uhoCw" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.keygraph.newnode" toBeRendered="false" visible="false" label="%command.label.20" command="_jJ_4kKO9EeeWePK798pdTw"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_wKd6cKRbEeePufXF8uhoCw" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.keygraph.delete" toBeRendered="false" visible="false" label="%command.label.21" command="_uM4zsKO8EeeWePK798pdTw"/>
+ <children xsi:type="menu:MenuSeparator" xmi:id="_whq5gKRbEeePufXF8uhoCw" elementId="eu.etaxonomy.taxeditor.editor.menuseparator.18" toBeRendered="false" visible="false"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_w9X-EKRbEeePufXF8uhoCw" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.keygraph.applylayout" toBeRendered="false" visible="false" label="%command.label.22" command="_zN-H8KO8EeeWePK798pdTw"/>
</menus>
</elements>
<elements xsi:type="basic:PartDescriptor" xmi:id="_tJeg0KO6EeeWePK798pdTw" elementId="eu.etaxonomy.taxeditor.editor.key.polytomous.e4.PolytomousKeyListEditorE4" label="%editor.name.3" closeable="true" dirtyable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.key.polytomous.e4.PolytomousKeyListEditorE4">
<handlers xmi:id="_8DficKRREeePufXF8uhoCw" elementId="eu.etaxonomy.taxeditor.editor.key.polytomous.e4.handler.CreateChildNodeHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.key.polytomous.e4.handler.CreateChildNodeHandlerE4" command="_tyHGwKO9EeeWePK798pdTw"/>
<handlers xmi:id="_QHL6QKRSEeePufXF8uhoCw" elementId="eu.etaxonomy.taxeditor.editor.key.polytomous.e4.handler.CreateSiblingNodeHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.key.polytomous.e4.handler.CreateSiblingNodeHandlerE4" command="_rkKogKO9EeeWePK798pdTw"/>
<handlers xmi:id="_pDoJsKRSEeePufXF8uhoCw" elementId="eu.etaxonomy.taxeditor.editor.key.polytomous.e4.handler.RefreshNodeNumberingHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.key.polytomous.e4.handler.RefreshNodeNumberingHandlerE4" command="_mH1G8KRSEeePufXF8uhoCw"/>
+ <handlers xmi:id="_gCYp4KTaEeejf7ggYkp-TA" elementId="eu.etaxonomy.taxeditor.editor.handler.1" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.key.polytomous.e4.handler.OpenPolytomousGraphEditorHandler" command="_ZolPMKTaEeejf7ggYkp-TA"/>
<menus xsi:type="menu:PopupMenu" xmi:id="_2JO_8KRQEeePufXF8uhoCw" elementId="eu.etaxonomy.taxeditor.editor.popupmenu.polytomouskeylisteditor">
<children xsi:type="menu:Menu" xmi:id="_2yjpwKRQEeePufXF8uhoCw" elementId="eu.etaxonomy.taxeditor.editor.menu.polytomouskeylist.newkeynumber" label="%menu.label.4">
<children xsi:type="menu:HandledMenuItem" xmi:id="_DWtt4KRREeePufXF8uhoCw" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.polytomouskeylist.new.insertNode" label="%command.label.58" command="_jJ_4kKO9EeeWePK798pdTw"/>
</children>
<children xsi:type="menu:HandledMenuItem" xmi:id="_Iqi_AKRREeePufXF8uhoCw" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.polytomouskeylist.newAlternative" label="%command.label.24" command="_rkKogKO9EeeWePK798pdTw"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_LJ-14KRREeePufXF8uhoCw" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.polytomouskeylist.refreshNodes" label="%command.label.25" command="_mH1G8KRSEeePufXF8uhoCw"/>
+ <children xsi:type="menu:MenuSeparator" xmi:id="_Ww_XAKTaEeejf7ggYkp-TA" elementId="eu.etaxonomy.taxeditor.editor.menuseparator.19"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_TvBa0KTaEeejf7ggYkp-TA" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.opengraph" label="Open Graph" command="_ZolPMKTaEeejf7ggYkp-TA"/>
+ <children xsi:type="menu:MenuSeparator" xmi:id="_XMhccKTaEeejf7ggYkp-TA" elementId="eu.etaxonomy.taxeditor.editor.menuseparator.20"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_Rf4A8KRREeePufXF8uhoCw" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.polytomouskeylist.delete" label="%command.label.26" command="_uM4zsKO8EeeWePK798pdTw"/>
</menus>
</elements>
<elements xsi:type="commands:Command" xmi:id="_rkKogKO9EeeWePK798pdTw" elementId="eu.etaxonomy.taxeditor.key.polytomous.command.new.sibling" commandName="%command.name.29"/>
<elements xsi:type="commands:Command" xmi:id="_tyHGwKO9EeeWePK798pdTw" elementId="eu.etaxonomy.taxeditor.key.polytomous.command.new.child" commandName="%command.name.28"/>
<elements xsi:type="commands:Command" xmi:id="_mH1G8KRSEeePufXF8uhoCw" elementId="eu.etaxonomy.taxeditor.key.polytomous.command.refresh" commandName="%command.name.30"/>
+ <elements xsi:type="commands:Command" xmi:id="_ZolPMKTaEeejf7ggYkp-TA" elementId="eu.etaxonomy.taxeditor.editor.command.polytomouskeylist.openGraph" commandName="Open Graph Editor"/>
</fragments>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_pZmusEalEeeXMc6kSYO7Xg" featurename="children" parentElementId="eu.etaxonomy.taxeditor.menu.showView" positionInList="after:eu.etaxonomy.taxeditor.store.menuseparator.afterSupplemental">
<elements xsi:type="menu:MenuSeparator" xmi:id="_eAVmMJ7SEee0IagNh8pHpQ" elementId="eu.etaxonomy.taxeditor.editor.menuseparator.14"/>
public void init(PolytomousKeyEditorInput input) {
this.input = input;
+
+
+ viewer.setInput(getKey());
}
public boolean isDirty() {
--- /dev/null
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.editor.key.e4;
+
+import java.util.Vector;
+
+import eu.etaxonomy.cdm.model.description.PolytomousKey;
+import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeEvent;
+import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeEvent.EventType;
+import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
+import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyEditorInput;
+import eu.etaxonomy.taxeditor.editor.key.polytomous.e4.PolytomousKeyListEditorE4;
+import eu.etaxonomy.taxeditor.model.AbstractDataChangeBehaviour;
+
+/**
+ * @author n.hoffmann
+ * @created May 5, 2011
+ * @version 1.0
+ */
+public class KeyEditorDataChangeBehaviourE4 extends AbstractDataChangeBehaviour {
+
+ private final PolytomousKeyListEditorE4 source;
+ private PolytomousKeyEditorInput input;
+
+ public KeyEditorDataChangeBehaviourE4(PolytomousKeyListEditorE4 keyEditor) {
+ source = keyEditor;
+ }
+
+ @Override
+ public void reactOnDataChange(CdmDataChangeMap changeEvents) {
+ input = source.getEditorInput();
+
+ if(changeEvents.sizeByEventType(EventType.UPDATE) > 0){
+ reactOnUpdate(changeEvents.getEvents(EventType.UPDATE));
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void reactOnUpdate(Vector<CdmDataChangeEvent> events){
+
+ for(CdmDataChangeEvent event : events){
+
+ // update editor title
+ if(event.getEntity() instanceof PolytomousKey){
+ if(input.getKey().equals(event.getEntity())){
+ // set the name of the editor window
+ source.setPartName();
+ }
+ }
+ }
+ }
+}
import eu.etaxonomy.taxeditor.editor.key.polytomous.IPolytomousKeyEditorPage;
import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyGraphContentProvider;
import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyLabelProvider;
+import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
/**
@PostConstruct
public void createPartControl(Composite parent, EMenuService menuService,
@Named(IServiceConstants.ACTIVE_SHELL)Shell shell) {
+ if(!CdmStore.isActive()){
+ return;
+ }
+
+ formFactory = new CdmFormFactory(shell.getDisplay());
container = formFactory.createComposite(parent);
container.setLayout(new FillLayout());
//FIXME E4 migrate
// createToolbar();
- viewer.setInput(getKey());
-
container.addControlListener(new ControlListener() {
@Override
}
});
-
- formFactory = new CdmFormFactory(shell.getDisplay());
}
@Override
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.key.KeyEditorDataChangeBehaviour;
+import eu.etaxonomy.taxeditor.editor.key.e4.KeyEditorDataChangeBehaviourE4;
import eu.etaxonomy.taxeditor.editor.key.polytomous.IPolytomousKeyEditorPage;
import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyEditorInput;
import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyListContentProvider;
import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyListLabelProvider;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
+import eu.etaxonomy.taxeditor.model.DataChangeBridge;
import eu.etaxonomy.taxeditor.model.IDirtyMarkable;
import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.workbench.part.IE4SavablePart;
/**
*
*/
public class PolytomousKeyListEditorE4 implements
IConversationEnabled, IDirtyMarkable, IPartContentHasDetails,
- IPolytomousKeyEditorPage {
+ IPolytomousKeyEditorPage, IE4SavablePart{
private class LinkListener extends MouseAdapter {
private TableViewer viewer;
- private ConversationHolder conversation;
-
- private KeyEditorDataChangeBehaviour dataChangeBehavior;
+ private KeyEditorDataChangeBehaviourE4 dataChangeBehavior;
private PolytomousKeyEditorInput input;
}
@Override
- public void update(CdmDataChangeMap arg0) {
-
+ public void update(CdmDataChangeMap map) {
+ if(dataChangeBehavior == null){
+ dataChangeBehavior = new KeyEditorDataChangeBehaviourE4(this);
+ }
+ DataChangeBridge.handleDataChange(map, dataChangeBehavior);
}
@Override
return input.getConversationHolder();
}
- @Persist
- public void doSave(IProgressMonitor monitor) {
+ @Override
+ @Persist
+ public void save(IProgressMonitor monitor) {
try {
monitor.beginTask(Messages.KeyEditor_SAVING, 1);
getConversationHolder().bind();
viewer.setInput(input);
}
+ public PolytomousKeyEditorInput getEditorInput() {
+ return input;
+ }
+
public boolean isDirty() {
return dirty.isDirty();
}
@Override
public boolean postOperation(CdmBase objectAffectedByOperation) {
viewer.refresh();
- getConversationHolder().bind();
- getConversationHolder().commit(true);
- //FIXME E4 migrate/delete
-// editor.changed(objectAffectedByOperation);
+// getConversationHolder().bind();
+// getConversationHolder().commit(true);
+ changed(objectAffectedByOperation);
if (objectAffectedByOperation != null) {
viewer.setSelection(new StructuredSelection(
return true;
}
+ public void setPartName() {
+ PolytomousKey key = input.getKey();
+ thisPart.setLabel(key.getTitleCache());
+ }
+
}
+++ /dev/null
-/**
-* Copyright (C) 2016 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-package eu.etaxonomy.taxeditor.editor.key.polytomous.e4.handler;
-
-import eu.etaxonomy.taxeditor.editor.key.polytomous.IPolytomousKeyEditorPage;
-import eu.etaxonomy.taxeditor.operation.e4.RemotingCdmHandlerE4;
-
-/**
- * @author k.luther
- * @date 24.11.2016
- *
- */
-public abstract class AbstractPolytomousKeyNodeHandlerE4 extends RemotingCdmHandlerE4 {
-
-
- IPolytomousKeyEditorPage editorPage;
-
- public AbstractPolytomousKeyNodeHandlerE4(String label) {
- super(label);
- }
-
-}
import javax.inject.Named;
import org.eclipse.core.commands.operations.IUndoContext;
+import org.eclipse.e4.core.di.annotations.CanExecute;
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
}
}
+ @CanExecute
+ public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
+ MHandledMenuItem menuItem){
+ boolean canExecute = false;
+ canExecute = selection!=null && !selection.isEmpty();
+ menuItem.setVisible(canExecute);
+ return canExecute;
+ }
+
}
import eu.etaxonomy.taxeditor.editor.key.polytomous.operation.DeleteNodeOperation;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.operation.e4.RemotingCdmHandlerE4;
/**
* @author n.hoffmann
* @created Dec 6, 2010
* @version 1.0
*/
-public class DeleteNodeHandlerE4 extends AbstractPolytomousKeyNodeHandlerE4 {
+public class DeleteNodeHandlerE4 extends RemotingCdmHandlerE4 {
private static final String DO_YOU_REALLY_WANT_TO_DELETE_THE_NODE_THIS_OPERATION_IS_NOT_REVERSABLE = Messages.DeleteNodeHandler_REALLY_DELETE;
if (!proceed) {
return null;
}else{
- editor.doSave(AbstractUtility.getMonitor());
+ editor.save(AbstractUtility.getMonitor());
}
}
label = menuItem.getLocalizedLabel();
DeleteNodeOperation operation ;
if (deleteChildren){
- operation = new DeleteNodeOperation(label, undoContext, nodeToBeDeleted, editorPage, true);
+ operation = new DeleteNodeOperation(label, undoContext, nodeToBeDeleted, editor, true);
}else{
- operation = new DeleteNodeOperation(label, undoContext, nodeToBeDeleted, editorPage, false);
+ operation = new DeleteNodeOperation(label, undoContext, nodeToBeDeleted, editor, false);
}
return operation;
}
@CanExecute
- public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)Object selection,
+ public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
MHandledMenuItem menuItem){
boolean canExecute = false;
- canExecute = selection instanceof PolytomousKeyNode;
+ canExecute = selection!=null && !selection.isEmpty();
menuItem.setVisible(canExecute);
return canExecute;
}
-}
+}
\ No newline at end of file
import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyEditorLabels;
import eu.etaxonomy.taxeditor.editor.key.polytomous.e4.PolytomousKeyListEditorE4;
import eu.etaxonomy.taxeditor.editor.key.polytomous.operation.InsertPolytomousKeyNodeOperation;
+import eu.etaxonomy.taxeditor.operation.e4.RemotingCdmHandlerE4;
/**
* @author k.luther
* @date 17.11.2016
*
*/
-public class InsertNewNodeHandlerE4 extends AbstractPolytomousKeyNodeHandlerE4{
+public class InsertNewNodeHandlerE4 extends RemotingCdmHandlerE4{
private PolytomousKeyNode parentNode ;
@Named(IServiceConstants.ACTIVE_SHELL)Shell shell,
@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
MHandledMenuItem menuItem) {
- return new InsertPolytomousKeyNodeOperation(getTrigger(), false, parentNode, editorPage);
+ PolytomousKeyListEditorE4 editor = (PolytomousKeyListEditorE4) activePart.getObject();
+ return new InsertPolytomousKeyNodeOperation(getTrigger(), false, parentNode, editor);
}
@Override
}
@CanExecute
- public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)Object selection,
+ public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
MHandledMenuItem menuItem){
boolean canExecute = false;
- canExecute = selection instanceof PolytomousKeyNode;
+ canExecute = selection!=null && !selection.isEmpty();
menuItem.setVisible(canExecute);
return canExecute;
}
--- /dev/null
+
+package eu.etaxonomy.taxeditor.editor.key.polytomous.e4.handler;
+
+import javax.inject.Named;
+
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
+import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
+
+import eu.etaxonomy.taxeditor.editor.key.polytomous.e4.PolytomousKeyGraphEditorE4;
+import eu.etaxonomy.taxeditor.editor.key.polytomous.e4.PolytomousKeyListEditorE4;
+
+public class OpenPolytomousGraphEditorHandler {
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart, EPartService partService) {
+ MPart part = partService.createPart("eu.etaxonomy.taxeditor.editor.key.polytomous.e4.PolytomousKeyGraphEditorE4");
+ part = partService.showPart(part, PartState.ACTIVATE);
+ PolytomousKeyGraphEditorE4 graphEditor = (PolytomousKeyGraphEditorE4) part.getObject();
+ PolytomousKeyListEditorE4 listEditor = (PolytomousKeyListEditorE4) activePart.getObject();
+ graphEditor.init(listEditor.getEditorInput());
+ }
+
+}
\ No newline at end of file
<handlers xmi:id="_tvg9wKQVEeeTrq_CRrR-jg" elementId="eu.etaxonomy.taxeditor.navigation.key.polytomous.e4.handler.RemotingEditPolytomousKeyNodesHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.navigation/eu.etaxonomy.taxeditor.navigation.key.polytomous.e4.handler.RemotingEditPolytomousKeyNodesHandlerE4" command="_BrgnkKQVEeeTrq_CRrR-jg"/>
<handlers xmi:id="_xhc-UKQVEeeTrq_CRrR-jg" elementId="eu.etaxonomy.taxeditor.navigation.key.polytomous.e4.handler.RemotingUpdatePolytomousKeyAllNodesHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.navigation/eu.etaxonomy.taxeditor.navigation.key.polytomous.e4.handler.RemotingUpdatePolytomousKeyAllNodesHandlerE4" command="_6S6M4KQVEeeTrq_CRrR-jg"/>
<handlers xmi:id="_CoKnoKQWEeeTrq_CRrR-jg" elementId="eu.etaxonomy.taxeditor.navigation.key.polytomous.e4.handler.RefreshPolytomousKeyListHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.navigation/eu.etaxonomy.taxeditor.navigation.key.polytomous.e4.handler.RefreshPolytomousKeyListHandlerE4" command="_4BQ6YKQVEeeTrq_CRrR-jg"/>
- <handlers xmi:id="_GjyIoKQWEeeTrq_CRrR-jg" elementId="eu.etaxonomy.taxeditor.navigation.key.polytomous.handler.RemotingDeletePolytomousKeyHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.navigation/eu.etaxonomy.taxeditor.navigation.key.polytomous.handler.RemotingDeletePolytomousKeyHandler" command="_8C8AEKQVEeeTrq_CRrR-jg"/>
+ <handlers xmi:id="_GjyIoKQWEeeTrq_CRrR-jg" elementId="eu.etaxonomy.taxeditor.navigation.key.polytomous.e4.handler.RemotingDeletePolytomousKeyHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.navigation/eu.etaxonomy.taxeditor.navigation.key.polytomous.e4.handler.RemotingDeletePolytomousKeyHandlerE4" command="_8C8AEKQVEeeTrq_CRrR-jg"/>
<menus xsi:type="menu:PopupMenu" xmi:id="_FajhpKQUEeeTrq_CRrR-jg" elementId="eu.etaxonomy.taxeditor.navigation.popupmenu.polytomouskeyview">
<visibleWhen xsi:type="ui:CoreExpression" xmi:id="_FajhpaQUEeeTrq_CRrR-jg" coreExpressionId="isCdmStoreConnected"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_FajhpqQUEeeTrq_CRrR-jg" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.polytomouskey.new" label="%command.label.15" command="_lAZG8KQUEeeTrq_CRrR-jg"/>
<children xsi:type="menu:DynamicMenuContribution" xmi:id="_ot9k4KQUEeeTrq_CRrR-jg" elementId="eu.etaxonomy.taxeditor.navigation.polytomouskey.dynamicmenucontribution.cdmViewer" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.view.CdmViewerContextMenuE4"/>
- <children xsi:type="menu:HandledMenuItem" xmi:id="_Fajhp6QUEeeTrq_CRrR-jg" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.polytomouskey.edit" label="%command.label.16">
- <command href="../eu.etaxonomy.taxeditor.editor/fragment.e4xmi#_uM4zsKO8EeeWePK798pdTw"/>
- </children>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_Fajhp6QUEeeTrq_CRrR-jg" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.polytomouskey.edit" label="%command.label.16" command="_BrgnkKQVEeeTrq_CRrR-jg"/>
<children xsi:type="menu:Menu" xmi:id="_IKePEKQVEeeTrq_CRrR-jg" elementId="eu.etaxonomy.taxeditor.navigation.menu.polytomouskey.refresh" label="%menu.label.0">
<children xsi:type="menu:HandledMenuItem" xmi:id="_JS0-QKQVEeeTrq_CRrR-jg" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.polytomouskey.refreshlist" label="%command.label.17" command="_4BQ6YKQVEeeTrq_CRrR-jg"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_JsJdMKQVEeeTrq_CRrR-jg" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.polytomouskey.refreshnodes" label="%command.label.18" command="_6S6M4KQVEeeTrq_CRrR-jg"/>
</children>
<children xsi:type="menu:MenuSeparator" xmi:id="_FajhqKQUEeeTrq_CRrR-jg" elementId="eu.etaxonomy.taxeditor.editor.menuseparator.18"/>
- <children xsi:type="menu:HandledMenuItem" xmi:id="_FajhqaQUEeeTrq_CRrR-jg" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.polytomouskey.refresh" label="%command.label.19">
- <command href="../eu.etaxonomy.taxeditor.editor/fragment.e4xmi#_zN-H8KO8EeeWePK798pdTw"/>
- </children>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_FajhqaQUEeeTrq_CRrR-jg" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.polytomouskey.refresh" label="%command.label.19" command="_8C8AEKQVEeeTrq_CRrR-jg"/>
</menus>
</elements>
</fragments>
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.e4.core.di.annotations.CanExecute;
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
import org.eclipse.e4.ui.services.IServiceConstants;
import org.eclipse.e4.ui.workbench.modeling.EPartService;
import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
+import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.widgets.Display;
}
}
+ @CanExecute
+ public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)Object selection,
+ MHandledMenuItem menuItem){
+ boolean canExecute = false;
+ canExecute = ((IStructuredSelection)selection).getFirstElement() instanceof PolytomousKey;
+ menuItem.setVisible(canExecute);
+ return canExecute;
+ }
+
}