org.eclipse.e4.core.di,
org.eclipse.e4.ui.model.workbench,
org.eclipse.e4.ui.di,
- org.eclipse.e4.core.commands
+ org.eclipse.e4.core.commands,
+ org.eclipse.e4.core.services
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Import-Package: javax.annotation;version="1.0.0";resolution:=optional,
import org.eclipse.core.commands.operations.UndoContext;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.e4.core.services.events.IEventBroker;
import org.eclipse.e4.ui.di.Focus;
import org.eclipse.e4.ui.di.Persist;
import org.eclipse.e4.ui.model.application.ui.MDirtyable;
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.taxeditor.editor.ISecuredEditor;
+import eu.etaxonomy.taxeditor.editor.ITaxonEditor;
import eu.etaxonomy.taxeditor.editor.e4.TaxonEditorInputE4;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
import eu.etaxonomy.taxeditor.editor.name.e4.container.AbstractGroupE4;
import eu.etaxonomy.taxeditor.editor.name.e4.container.ContainerFactoryE4;
import eu.etaxonomy.taxeditor.editor.name.e4.container.HomotypicalSynonymGroupE4;
import eu.etaxonomy.taxeditor.editor.name.e4.container.MisappliedGroupE4;
+import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.IDirtyMarkable;
import eu.etaxonomy.taxeditor.model.IPartChangeListener;
*/
public class TaxonNameEditorE4 implements IConversationEnabled, IDirtyMarkable, IPartContentHasDetails,
IPartContentHasSupplementalData, IPartContentHasMedia, IPartContentHasFactualData, IPartChangeListener,
- ISelectionListener, ISecuredEditor, IPostOperationEnabled, IE4SavablePart {
+ ISelectionListener, ISecuredEditor, IPostOperationEnabled, IE4SavablePart, ITaxonEditor {
private Taxon taxon;
private UndoContext undoContext;
+ @Inject
+ private IEventBroker eventBroker;
+
@Inject
public TaxonNameEditorE4() {
undoContext = new UndoContext();
managedForm.refresh();
}
- public Taxon getTaxon() {
+ @Override
+ public Taxon getTaxon() {
return HibernateProxyHelper.deproxy(taxon);
}
boolean doEnable = permissionsSatisfied();
managedForm.getForm().setEnabled(doEnable);
}
+ eventBroker.post(WorkbenchEventConstants.CURRENT_ACTIVE_EDITOR, this);
}
@Override
eu.etaxonomy.taxeditor.editor,
eu.etaxonomy.taxeditor.editor.definedterm,
eu.etaxonomy.taxeditor.editor.definedterm.input,
+ eu.etaxonomy.taxeditor.event,
eu.etaxonomy.taxeditor.featuretree,
eu.etaxonomy.taxeditor.featuretree.e4,
eu.etaxonomy.taxeditor.handler,
<?xml version="1.0" encoding="ASCII"?>
-<fragment:ModelFragments xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:basic="http://www.eclipse.org/ui/2010/UIModel/application/descriptor/basic" xmlns:commands="http://www.eclipse.org/ui/2010/UIModel/application/commands" xmlns:fragment="http://www.eclipse.org/ui/2010/UIModel/fragment" xmlns:menu="http://www.eclipse.org/ui/2010/UIModel/application/ui/menu" xmlns:ui="http://www.eclipse.org/ui/2010/UIModel/application/ui" xmi:id="_OhwnQCTfEeeiN5lBIuqN3g">
+<fragment:ModelFragments xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:application="http://www.eclipse.org/ui/2010/UIModel/application" xmlns:basic="http://www.eclipse.org/ui/2010/UIModel/application/descriptor/basic" xmlns:commands="http://www.eclipse.org/ui/2010/UIModel/application/commands" xmlns:fragment="http://www.eclipse.org/ui/2010/UIModel/fragment" xmlns:menu="http://www.eclipse.org/ui/2010/UIModel/application/ui/menu" xmlns:ui="http://www.eclipse.org/ui/2010/UIModel/application/ui" xmi:id="_OhwnQCTfEeeiN5lBIuqN3g">
<imports xsi:type="commands:Command" xmi:id="_bnVKsCZxEeeQLpuomSmVoQ" elementId="eu.etaxonomy.taxeditor.command.openPart"/>
<imports xsi:type="commands:Command" xmi:id="_LlbAMEq2EeeN-dEYnw7m3g" elementId="org.eclipse.ui.file.save"/>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_xVa1wCXXEeex9MwMOgUeWw" featurename="descriptors" parentElementId="xpath:/">
</children>
</elements>
</fragments>
+ <fragments xsi:type="fragment:StringModelFragment" xmi:id="_pVVyEJFJEeeDJpjGQES7gw" featurename="addons" parentElementId="org.eclipse.e4.legacy.ide.application">
+ <elements xsi:type="application:Addon" xmi:id="_q4JBkJFJEeeDJpjGQES7gw" elementId="eu.etaxonomy.taxeditor.event.EventUtility" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.event.EventUtility"/>
+ </fragments>
</fragment:ModelFragments>
--- /dev/null
+/**
+* Copyright (C) 2017 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.event;
+
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+
+import org.eclipse.e4.core.di.annotations.Optional;
+import org.eclipse.e4.ui.di.UIEventTopic;
+
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.taxeditor.editor.ITaxonEditor;
+
+/**
+ * @author pplitzner
+ * @since Sep 4, 2017
+ *
+ */
+public class EventUtility {
+
+ private static ITaxonEditor editor;
+
+ @PostConstruct
+ public void create(){
+ //nothing
+ }
+
+ @Inject
+ @Optional
+ private void updateCurrentTaxon(@UIEventTopic(WorkbenchEventConstants.CURRENT_ACTIVE_EDITOR)ITaxonEditor editor){
+ EventUtility.editor = editor;
+ }
+
+ public static Taxon getCurrentTaxon() {
+ if(editor!=null){
+ return editor.getTaxon();
+ }
+ return null;
+ }
+
+ public static ITaxonEditor getEditor() {
+ return editor;
+ }
+
+}
--- /dev/null
+/**
+* Copyright (C) 2017 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.event;
+
+/**
+ * @author pplitzner
+ * @since Sep 4, 2017
+ *
+ */
+public interface WorkbenchEventConstants {
+
+ public static final String CURRENT_ACTIVE_EDITOR = "CURRENT/ACTIVE_EDITOR";
+
+}