<imports xsi:type="commands:Command" xmi:id="_0WYQcL2lEeeyWfw0n8-ICQ" elementId="eu.etaxonomy.taxeditor.workbench.command.collapse"/>
<imports xsi:type="commands:Command" xmi:id="_vDKPoL4vEeewU62zpvPllA" elementId="eu.etaxonomy.taxeditor.workbench.command.expand"/>
<imports xsi:type="commands:Command" xmi:id="_W_4cQE3LEeiplYSgvvNXRQ" elementId="org.eclipse.ui.edit.copy"/>
+ <imports xsi:type="commands:Command" xmi:id="_YMab4O5gEeiy4-dyP0ltdA" elementId="eu.etaxonomy.taxeditor.store.command.featureTree.copyFeature"/>
+ <imports xsi:type="commands:Command" xmi:id="_Y2mBUO5gEeiy4-dyP0ltdA" elementId="eu.etaxonomy.taxeditor.store.command.featureTree.pasteFeature"/>
+ <imports xsi:type="commands:Command" xmi:id="_a7aYwO5gEeiy4-dyP0ltdA" elementId="eu.etaxonomy.taxeditor.store.command.featureTree.addChildFeature"/>
+ <imports xsi:type="commands:Command" xmi:id="_wujDAO5iEeiy4-dyP0ltdA" elementId="eu.etaxonomy.taxeditor.store.command.featureTree.addFeature"/>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_gSpRsDQDEeeTNOFVGI4q2w" featurename="descriptors" parentElementId="xpath:/">
<elements xsi:type="basic:PartDescriptor" xmi:id="_gSpRsTQDEeeTNOFVGI4q2w" elementId="eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView" label="%command.label.DERIVATIVE_EDITOR" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.editor/icons/derivate_view-16x16-32.png" tooltip="%command.label.DERIVATIVE_EDITOR" allowMultiple="true" category="" closeable="true" dirtyable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView">
<tags>View</tags>
</elements>
<elements xsi:type="basic:PartDescriptor" xmi:id="_R7vxEECaEeeL5JDzMOYK6g" elementId="eu.etaxonomy.taxeditor.editor.descriptiveDataSet.CharacterEditor" label="%partdescriptor.label.1" closeable="true" dirtyable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.descriptiveDataSet.character.CharacterEditor">
<tags>nonRestore</tags>
- <menus xsi:type="menu:PopupMenu" xmi:id="_cHWz8GhvEee3K4uKJljEYg" elementId="eu.etaxonomy.taxeditor.editor.popupmenu.characterEditor">
- <children xsi:type="menu:HandledMenuItem" xmi:id="_eDZC0GhvEee3K4uKJljEYg" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.removecharacter" label="%handledmenuitem.label.10" command="_oBEz8GhvEee3K4uKJljEYg"/>
+ <handlers xmi:id="_A6uWsO5jEeiy4-dyP0ltdA" elementId="eu.etaxonomy.taxeditor.editor.handler.3" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.descriptiveDataSet.character.handler.AddFeatureToCharacterTreeHandler" command="_wujDAO5iEeiy4-dyP0ltdA"/>
+ <menus xsi:type="menu:PopupMenu" xmi:id="_46lOIO5TEeiy4-dyP0ltdA" elementId="eu.etaxonomy.taxeditor.editor.popupmenu.characterEditor">
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_T5PhEO5hEeiy4-dyP0ltdA" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.addfeature" label="Add Feature" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.store/icons/add.gif" command="_wujDAO5iEeiy4-dyP0ltdA"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_eDsYUO5gEeiy4-dyP0ltdA" elementId="eu.etaxonomy.taxeditor.editor.charactereditor.handledmenuitem.addchildfeature" label="Add Child Feature" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.store/icons/add.gif" command="_a7aYwO5gEeiy4-dyP0ltdA"/>
+ <children xsi:type="menu:MenuSeparator" xmi:id="_tTotQO5gEeiy4-dyP0ltdA" elementId="eu.etaxonomy.taxeditor.editor.menuseparator.27"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_QquMEO5gEeiy4-dyP0ltdA" elementId="eu.etaxonomy.taxeditor.editor.charactereditor.handledmenuitem.paste" label="Paste" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.store/icons/paste_edit.png" command="_Y2mBUO5gEeiy4-dyP0ltdA"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_RNTUsO5gEeiy4-dyP0ltdA" elementId="eu.etaxonomy.taxeditor.editor.charactereditor.handledmenuitem.copy" label="Copy" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.store/icons/copy_edit.png" command="_YMab4O5gEeiy4-dyP0ltdA"/>
+ <children xsi:type="menu:MenuSeparator" xmi:id="_uNg7kO5gEeiy4-dyP0ltdA" elementId="eu.etaxonomy.taxeditor.editor.menuseparator.28"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_F--RgO5UEeiy4-dyP0ltdA" elementId="eu.etaxonomy.taxeditor.editor.charactereditor.handledmenuitem.delete" label="Delete" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.store/icons/delete.gif" command="_oBEz8GhvEee3K4uKJljEYg"/>
</menus>
</elements>
<elements xsi:type="basic:PartDescriptor" xmi:id="_7GbckIDLEeeBD7P1FZoD-g" elementId="eu.etaxonomy.taxeditor.editor.view.media.e4.MediaViewPartE4" label="%view.name.1" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.editor/icons/camera-photo.png" closeable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.view.media.e4.MediaViewPartE4">
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TreeSelection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
import eu.etaxonomy.cdm.model.description.FeatureNode;
import eu.etaxonomy.cdm.model.description.FeatureTree;
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
+import eu.etaxonomy.taxeditor.editor.AppModelId;
import eu.etaxonomy.taxeditor.featuretree.e4.FeatureNodeDragListener;
import eu.etaxonomy.taxeditor.featuretree.e4.FeatureNodeDropAdapter;
import eu.etaxonomy.taxeditor.featuretree.e4.FeatureTreeEditorComposite;
-import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.featuretree.e4.IFeatureTreeEditor;
import eu.etaxonomy.taxeditor.model.IDirtyMarkable;
import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
-import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.ui.dialog.selection.FeatureTreeSelectionDialog;
-import eu.etaxonomy.taxeditor.workbench.part.IE4SavablePart;
import eu.etaxonomy.taxeditor.workbench.part.IE4ViewerPart;
/**
* @date 24.05.2017
*
*/
-public class CharacterEditor implements ICdmEntitySessionEnabled, IConversationEnabled, ISelectionChangedListener,
- ModifyListener, IE4ViewerPart, IPartContentHasDetails, IPartContentHasSupplementalData, IE4SavablePart,
- IDirtyMarkable {
+public class CharacterEditor implements IFeatureTreeEditor,IConversationEnabled, ISelectionChangedListener,
+ ModifyListener, IE4ViewerPart, IPartContentHasDetails, IPartContentHasSupplementalData, IDirtyMarkable {
private FeatureTreeEditorComposite characterTreeEditorComposite;
private FeatureTreeEditorComposite propertiesTreeEditorComposite;
composite_1.setLayout(gl_composite_1);
propertiesTreeEditorComposite = addFeatureTreeEditor(composite_1);
- initFeatureTreeComposite(propertiesTreeEditorComposite, null, null);
+ initFeatureTreeComposite(propertiesTreeEditorComposite, new CharacterDragListener(structuresTreeEditorComposite.getViewer(), propertiesTreeEditorComposite.getViewer()), null);
propertiesTreeEditorComposite.getLabel_title().setText("Properties");
- //TODO: fix drag and drop
-// initFeatureTreeComposite(treeViewerProperties, new CharacterDragListener(treeViewerStructures.getViewer(), treeViewerProperties.getViewer()), null);
Composite composite_3 = new Composite(sashForm, SWT.NONE);
formToolkit.adapt(composite_3);
characterTreeEditorComposite.getLabel_title().setText("Characters");
//add context menu to character viewer//create context menu
- menuService.registerContextMenu(characterTreeEditorComposite.getViewer().getControl(), "eu.etaxonomy.taxeditor.editor.popupmenu.characterEditor");
+ menuService.registerContextMenu(characterTreeEditorComposite.getViewer().getControl(),
+ AppModelId.POPUPMENU_EU_ETAXONOMY_TAXEDITOR_EDITOR_POPUPMENU_CHARACTEREDITOR);
init();
}
@Override
public void selectionChanged(SelectionChangedEvent event) {
//propagate selection
- selService.setSelection(AbstractUtility.getElementsFromSelectionChangedEvent(event));
+ selService.setSelection(event.getSelection());
}
return (IStructuredSelection) characterTreeEditorComposite.getViewer().getSelection();
}
+ public FeatureTree getCharacterTree(){
+ return characterTreeEditorComposite.getFeatureTree();
+ }
+
@Override
public void refresh(){
structuresTreeEditorComposite.getViewer().refresh();
setDirty();
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean postOperation(Object objectAffectedByOperation) {
+ characterTreeEditorComposite.getViewer().refresh();
+ if(objectAffectedByOperation instanceof FeatureNode){
+ StructuredSelection selection = new StructuredSelection(objectAffectedByOperation);
+ characterTreeEditorComposite.getViewer().setSelection(selection);
+ }
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean onComplete() {
+ return false;
+ }
+
}
--- /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.editor.descriptiveDataSet.character.handler;
+
+import javax.inject.Named;
+
+import org.eclipse.e4.core.di.annotations.CanExecute;
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.core.di.annotations.Optional;
+import org.eclipse.e4.ui.di.UISynchronize;
+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.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.taxeditor.editor.descriptiveDataSet.character.CharacterEditor;
+import eu.etaxonomy.taxeditor.featuretree.e4.handler.AddFeatureHandler;
+
+/**
+ * @author pplitzner
+ * @since Jul 12, 2017
+ *
+ */
+public class AddFeatureToCharacterTreeHandler extends AddFeatureHandler {
+
+ @Execute
+ @Override
+ public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell,
+ @Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
+ @Named(IServiceConstants.ACTIVE_PART)MPart thisPart, UISynchronize sync) {
+ CharacterEditor editor = (CharacterEditor) thisPart.getObject();
+ super.execute(shell, new StructuredSelection(editor.getCharacterTree()), thisPart, sync);
+ }
+
+ @Override
+ @CanExecute
+ public boolean canExecute(
+ @Optional@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
+ @Named(IServiceConstants.ACTIVE_PART)MPart thisPart,
+ MHandledMenuItem menuItem) {
+ boolean canExecute = false;
+ canExecute = thisPart.getObject() instanceof CharacterEditor
+ && ((CharacterEditor) thisPart.getObject()).getCharacterTree()!=null
+ && (selection==null || selection.isEmpty());
+ menuItem.setVisible(canExecute);
+ return canExecute;
+ }
+}
eu.etaxonomy.taxeditor.event,
eu.etaxonomy.taxeditor.featuretree,
eu.etaxonomy.taxeditor.featuretree.e4,
+ eu.etaxonomy.taxeditor.featuretree.e4.handler,
eu.etaxonomy.taxeditor.handler,
eu.etaxonomy.taxeditor.handler.defaultHandler,
eu.etaxonomy.taxeditor.handler.defaultHandler.e4,
</elements>
<elements xsi:type="basic:PartDescriptor" xmi:id="_J-3UEEqgEeeN-dEYnw7m3g" elementId="eu.etaxonomy.taxeditor.featuretree.e4.FeatureTreeEditor" label="%partdescriptor.label.featureTreeEditor" allowMultiple="true" closeable="true" dirtyable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.featuretree.e4.FeatureTreeEditor">
<tags>nonRestore</tags>
- <handlers xmi:id="_H_c_EEq2EeeN-dEYnw7m3g" elementId="eu.etaxonomy.taxeditor.featuretree.handler.SaveHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.workbench/eu.etaxonomy.taxeditor.workbench.SaveHandler" command="_LlbAMEq2EeeN-dEYnw7m3g"/>
- <handlers xmi:id="_3wq0cGceEee0qLTtA2ZpVQ" elementId="eu.etaxonomy.taxeditor.featuretree.e4.handler.AddFeatureHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.featuretree.e4.handler.AddFeatureHandler" command="_oftL0GceEee0qLTtA2ZpVQ"/>
- <handlers xmi:id="_VSc2UGcqEee0qLTtA2ZpVQ" elementId="eu.etaxonomy.taxeditor.featuretree.e4.handler.FeatureTreeExportHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.featuretree.e4.handler.FeatureTreeExportHandler" command="_I_yx4GcqEee0qLTtA2ZpVQ"/>
- <handlers xmi:id="_hPTxMBezEeiXusClKZjycQ" elementId="eu.etaxonomy.taxeditor.featuretree.e4.handler.AddChildFeatureHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.featuretree.e4.handler.AddChildFeatureHandler" command="_aPYxsBezEeiXusClKZjycQ"/>
- <handlers xmi:id="_Bb0TwCFeEeiVXriJfxPIuA" elementId="eu.etaxonomy.taxeditor.featuretree.e4.handler.RemoveFeatureTreeHandlers" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.featuretree.e4.handler.RemoveFeatureTreeHandler" command="_3mqzkCFdEeiVXriJfxPIuA"/>
<handlers xmi:id="_DYhGACHXEeiP8eNo0PEm1g" elementId="eu.etaxonomy.taxeditor.featuretree.e4.handler.CreateFeatureTreeHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.featuretree.e4.handler.CreateFeatureTreeHandler" command="_AJtnsCHXEeiP8eNo0PEm1g"/>
- <handlers xmi:id="_i-FlkNjyEeidDMMI9xTsbQ" elementId="eu.etaxonomy.taxeditor.featuretree.e4.handler.CopyFeatureHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.featuretree.e4.handler.CopyFeatureHandler" command="_cMyQ4NjyEeidDMMI9xTsbQ"/>
- <handlers xmi:id="_tzQ_YNjyEeidDMMI9xTsbQ" elementId="eu.etaxonomy.taxeditor.featuretree.e4.handler.PasteFeatureHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.featuretree.e4.handler.PasteFeatureHandler" command="_xDk5kNjyEeidDMMI9xTsbQ"/>
+ <handlers xmi:id="_Bb0TwCFeEeiVXriJfxPIuA" elementId="eu.etaxonomy.taxeditor.featuretree.e4.handler.RemoveFeatureTreeHandlers" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.featuretree.e4.handler.RemoveFeatureTreeHandler" command="_3mqzkCFdEeiVXriJfxPIuA"/>
+ <handlers xmi:id="_VSc2UGcqEee0qLTtA2ZpVQ" elementId="eu.etaxonomy.taxeditor.featuretree.e4.handler.FeatureTreeExportHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.featuretree.e4.handler.FeatureTreeExportHandler" command="_I_yx4GcqEee0qLTtA2ZpVQ"/>
+ <handlers xmi:id="_3wq0cGceEee0qLTtA2ZpVQ" elementId="eu.etaxonomy.taxeditor.featuretree.e4.handler.AddFeatureHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.featuretree.e4.handler.AddFeatureHandler" command="_oftL0GceEee0qLTtA2ZpVQ"/>
<menus xsi:type="menu:PopupMenu" xmi:id="__Jwh4GceEee0qLTtA2ZpVQ" elementId="eu.etaxonomy.taxeditor.store.popupmenu.featureTreeEditor">
<children xsi:type="menu:HandledMenuItem" xmi:id="_GuuM0CHXEeiP8eNo0PEm1g" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.newfeaturetree" label="%handledmenuitem.label.1" iconURI="platform:/plugin/org.eclipse.ui/icons/full/etool16/new_wiz.png" command="_AJtnsCHXEeiP8eNo0PEm1g"/>
<children xsi:type="menu:MenuSeparator" xmi:id="_eIB1kCHXEeiP8eNo0PEm1g" elementId="eu.etaxonomy.taxeditor.store.menuseparator.5"/>
<elements xsi:type="commands:Handler" xmi:id="_4owEkMVREeiKErB3UVzQug" elementId="eu.etaxonomy.taxeditor.handler.e4.OpenDistributionEditorWizardHandlerAdminE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.handler.e4.OpenDistributionEditorWizardHandlerAdminE4" command="_Vs75kMVfEeiKErB3UVzQug"/>
<elements xsi:type="commands:Handler" xmi:id="_VBYX4MiQEeiKErB3UVzQug" elementId="eu.etaxonomy.taxeditor.handler.e4.OpenDistributionStausWizardAdminHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.handler.e4.OpenDistributionStatusWizardAdminHandler" command="_tPtdwMiIEeiKErB3UVzQug"/>
<elements xsi:type="commands:Handler" xmi:id="_jnQb8MrcEeiKErB3UVzQug" elementId="eu.etaxonomy.taxeditor.handler.e4.OpenCommonNameAreaWizardAdminHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.handler.e4.OpenCommonNameAreaWizardAdminHandler" command="_tRsg8MrcEeiKErB3UVzQug"/>
+ <elements xsi:type="commands:Handler" xmi:id="_H_c_EEq2EeeN-dEYnw7m3g" elementId="eu.etaxonomy.taxeditor.featuretree.handler.SaveHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.workbench/eu.etaxonomy.taxeditor.workbench.SaveHandler" command="_LlbAMEq2EeeN-dEYnw7m3g"/>
+ <elements xsi:type="commands:Handler" xmi:id="_hPTxMBezEeiXusClKZjycQ" elementId="eu.etaxonomy.taxeditor.featuretree.e4.handler.AddChildFeatureHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.featuretree.e4.handler.AddChildFeatureHandler" command="_aPYxsBezEeiXusClKZjycQ"/>
+ <elements xsi:type="commands:Handler" xmi:id="_i-FlkNjyEeidDMMI9xTsbQ" elementId="eu.etaxonomy.taxeditor.featuretree.e4.handler.CopyFeatureHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.featuretree.e4.handler.CopyFeatureHandler" command="_cMyQ4NjyEeidDMMI9xTsbQ"/>
+ <elements xsi:type="commands:Handler" xmi:id="_tzQ_YNjyEeidDMMI9xTsbQ" elementId="eu.etaxonomy.taxeditor.featuretree.e4.handler.PasteFeatureHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.featuretree.e4.handler.PasteFeatureHandler" command="_xDk5kNjyEeidDMMI9xTsbQ"/>
</fragments>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_qT4hgIfTEeecZ4F2Y9Z0Og" featurename="children" parentElementId="eu.etaxonomy.taxeditor.workbench.menu.window" positionInList="before:eu.etaxonomy.taxeditor.application.windowMenu.last">
<elements xsi:type="menu:Menu" xmi:id="_LT3P8IfcEeecZ4F2Y9Z0Og" elementId="eu.etaxonomy.taxeditor.store.menu.termeditor" label="%menu.label.1">