<children xsi:type="menu:HandledMenuItem" xmi:id="_1JIbQJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.copy" label="%command.label.12" command="_EJ-u0JIyEeeJAdt8ZUxyaw"/>
<children xsi:type="menu:MenuSeparator" xmi:id="_z0Q6EJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.menuseparator.4"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_0FX4MJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.refresh" label="%command.label.11" command="_ukhM0JIyEeeJAdt8ZUxyaw"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_7MpwILVfEeeZf_R8QJbACw" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.syncwithtaxon" label="Sync with taxon" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.editor/icons/synced.gif" command="_6iiY8LVbEeeZf_R8QJbACw"/>
</menus>
</elements>
<elements xsi:type="basic:PartDescriptor" xmi:id="_AcycAKOkEee6lJH578buGg" elementId="eu.etaxonomy.taxeditor.navigation.search.e4.SearchResultViewE4" label="%view.name" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.navigation/icons/system-search.png" allowMultiple="true" closeable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.navigation/eu.etaxonomy.taxeditor.navigation.search.e4.SearchResultViewE4">
import javax.annotation.PreDestroy;
import javax.inject.Inject;
-import org.eclipse.core.commands.Command;
-import org.eclipse.core.commands.common.NotDefinedException;
import org.eclipse.core.commands.operations.UndoContext;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.e4.ui.di.Focus;
import org.eclipse.e4.ui.di.UIEventTopic;
import org.eclipse.e4.ui.di.UISynchronize;
-import org.eclipse.e4.ui.model.application.commands.MCommand;
-import org.eclipse.e4.ui.model.application.commands.MCommandsFactory;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
-import org.eclipse.e4.ui.model.application.ui.menu.ItemType;
-import org.eclipse.e4.ui.model.application.ui.menu.MHandledToolItem;
-import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory;
-import org.eclipse.e4.ui.model.application.ui.menu.MToolBar;
import org.eclipse.e4.ui.services.EMenuService;
import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
import org.eclipse.jface.util.LocalSelectionTransfer;
viewer.addDropSupport(dndOperations, transfers, new TreeNodeDropAdapterE4(this));
//add toolbar
- MToolBar toolBar = MMenuFactory.INSTANCE.createToolBar();
- MHandledToolItem linkWithEditor = MMenuFactory.INSTANCE.createHandledToolItem();
- linkWithEditor.setIconURI("platform:/plugin/eu.etaxonomy.taxeditor.store/icons/synced.gif");
- Command command = commandService.getCommand("eu.etaxonomy.taxeditor.navigation.command.linkWithTaxon");
- MCommand mCommand = MCommandsFactory.INSTANCE.createCommand();
- mCommand.setElementId(command.getId());
- try {
- mCommand.setCommandName(command.getName());
- } catch (NotDefinedException e) {
- e.printStackTrace();
- }
- linkWithEditor.setCommand(mCommand);
- linkWithEditor.setType(ItemType.CHECK);
- toolBar.getChildren().add(linkWithEditor);
- thisPart.setToolbar(toolBar);
+// MToolBar toolBar = MMenuFactory.INSTANCE.createToolBar();
+// MHandledToolItem linkWithEditor = MMenuFactory.INSTANCE.createHandledToolItem();
+// linkWithEditor.setIconURI("platform:/plugin/eu.etaxonomy.taxeditor.store/icons/synced.gif");
+// Command command = commandService.getCommand("eu.etaxonomy.taxeditor.navigation.command.linkWithTaxon");
+// MCommand mCommand = MCommandsFactory.INSTANCE.createCommand();
+// mCommand.setElementId(command.getId());
+// try {
+// mCommand.setCommandName(command.getName());
+// } catch (NotDefinedException e) {
+// e.printStackTrace();
+// }
+// linkWithEditor.setCommand(mCommand);
+// linkWithEditor.setType(ItemType.CHECK);
+// toolBar.getChildren().add(linkWithEditor);
+// thisPart.setToolbar(toolBar);
init();
}
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 eu.etaxonomy.taxeditor.navigation.navigator.e4.TaxonNavigatorE4;
public class LinkWithTaxonHandlerE4 {
@Execute
- public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart) {
+ public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart, MHandledMenuItem menuItem) {
TaxonNavigatorE4 taxonNavigator = (TaxonNavigatorE4) activePart.getObject();
taxonNavigator.setLinkWithTaxon(!taxonNavigator.isLinkWithTaxon());
+ if(taxonNavigator.isLinkWithTaxon()){
+ menuItem.setLabel("Do not sync with taxon");
+ }
+ else {
+ menuItem.setLabel("Sync with taxon");
+ }
}
}