org.eclipse.e4.ui.di
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
-Import-Package: javax.inject;version="1.0.0",
+Import-Package: javax.annotation;version="1.0.0";resolution:=optional,
+ javax.inject;version="1.0.0",
org.eclipse.core.databinding.beans,
org.eclipse.core.databinding.observable.list,
org.eclipse.core.databinding.observable.map,
<children xsi:type="menu:HandledMenuItem" xmi:id="_wg0-oDulEeeOtqC_3qh40A" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.commandlabel54" label="%command.label.54" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.editor/icons/deep-delete-16x16-32.png" command="_fKT-wDulEeeOtqC_3qh40A"/>
</menus>
</elements>
+ <elements xsi:type="basic:PartDescriptor" xmi:id="_R7vxEECaEeeL5JDzMOYK6g" elementId="eu.etaxonomy.taxeditor.editor.workingSet.FeatureTreeBuilderViewPart" label="FeatureTreeBuilder" closeable="true" dirtyable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.workingSet.FeatureTreeBuilderViewPart"/>
</fragments>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="__mwtMDVpEee_b7RlBzTDRw" featurename="commands" parentElementId="xpath:/">
<elements xsi:type="commands:Command" xmi:id="_BjF3ADVqEee_b7RlBzTDRw" elementId="eu.etaxonomy.taxeditor.editor.command.specimeneditor.create_field_unit" commandName="%command.commandname.1"/>
<elements xsi:type="commands:Command" xmi:id="_N0wLsDumEeeOtqC_3qh40A" elementId="eu.etaxonomy.taxeditor.editor.derivative.copySingleReadToClipBoard" commandName="%command.name.COPY_SINGLE_READ_TO_CLIPBOARD"/>
<elements xsi:type="commands:Command" xmi:id="_YPp1wDvREeeOtqC_3qh40A" elementId="eu.etaxonomy.taxeditor.editor.derivate.delete" commandName="Delete"/>
</fragments>
+ <fragments xsi:type="fragment:StringModelFragment" xmi:id="_pZmusEalEeeXMc6kSYO7Xg" featurename="children" parentElementId="eu.etaxonomy.taxeditor.menu.showView">
+ <elements xsi:type="menu:HandledMenuItem" xmi:id="_tvph4EalEeeXMc6kSYO7Xg" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.featuretreeeditor" label="FeatureTree Editor" command="_WPjpoDSnEeek0dKsFNy--Q">
+ <parameters xmi:id="_wJkmoEalEeeXMc6kSYO7Xg" elementId="eu.etaxonomy.taxeditor.editor.parameter.0" name="eu.etaxonomy.taxeditor.workbench.commandparameter.partName" value="eu.etaxonomy.taxeditor.editor.workingSet.FeatureTreeBuilderViewPart"/>
+ </elements>
+ </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.editor.workingSet;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.dnd.DragSourceEvent;
+
+import eu.etaxonomy.cdm.model.description.FeatureNode;
+import eu.etaxonomy.taxeditor.featuretree.FeatureNodeDragListener;
+import eu.etaxonomy.taxeditor.featuretree.FeatureNodeTransfer;
+
+/**
+ * @author pplitzner
+ * @since Jun 2, 2017
+ *
+ */
+public class CharacterDragListener extends FeatureNodeDragListener {
+
+ private TreeViewer structureViewer;
+ private TreeViewer propertyViewer;
+
+ /**
+ * @param propertyViewer
+ */
+ public CharacterDragListener(TreeViewer structureViewer, TreeViewer propertyViewer) {
+ super(propertyViewer);
+ this.structureViewer = structureViewer;
+ this.propertyViewer = propertyViewer;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void dragSetData(DragSourceEvent event) {
+ FeatureNode structure = (FeatureNode) ((IStructuredSelection) structureViewer.getSelection()).getFirstElement();
+ FeatureNode property = (FeatureNode) ((IStructuredSelection) propertyViewer.getSelection()).getFirstElement();
+ FeatureNode[] character = new FeatureNode[2];
+ character[0] = structure;
+ character[1] = property;
+ if (FeatureNodeTransfer.getInstance().isSupportedType(event.dataType)) {
+ event.data = character;
+ }
+ }
+
+}
--- /dev/null
+/**
+* Copyright (C) 2009 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.workingSet;
+
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerDropAdapter;
+import org.eclipse.swt.dnd.TransferData;
+
+import eu.etaxonomy.cdm.model.description.Character;
+import eu.etaxonomy.cdm.model.description.FeatureNode;
+import eu.etaxonomy.cdm.model.description.FeatureTree;
+import eu.etaxonomy.taxeditor.featuretree.FeatureNodeTransfer;
+
+/**
+ *
+ * @author pplitzner
+ * @date Jun 1, 2017
+ *
+ */
+public class CharacterDropAdapter extends ViewerDropAdapter {
+
+ protected CharacterDropAdapter(Viewer viewer) {
+ super(viewer);
+ }
+
+ @Override
+ public boolean performDrop(Object data) {
+
+ FeatureNode target = (FeatureNode) getCurrentTarget();
+ int currentLocation = getCurrentLocation();
+ Object[] characterData = (Object[]) data;
+
+ //create new Character
+ if(characterData.length==2){
+ FeatureNode structureNode = (FeatureNode) characterData[0];
+ FeatureNode propertyNode = (FeatureNode) characterData[1];
+ String label = structureNode.getFeature().toString()+" "+propertyNode.getFeature().toString();
+ Character character = Character.NewInstance(structureNode, propertyNode, null, label, label);
+ FeatureNode characterNode = FeatureNode.NewInstance(character);
+
+ Object input = getViewer().getInput();
+ if(input==null){
+ //create new feature tree
+ FeatureTree featureTree = FeatureTree.NewInstance();
+ getViewer().setInput(featureTree);
+ }
+ if(target==null){
+ FeatureNode root = ((FeatureTree)input).getRoot();
+ root.addChild(characterNode);
+ }
+ else{
+ target.addChild(characterNode);
+ }
+ }
+ getViewer().refresh();
+ return true;
+ }
+
+ @Override
+ public boolean validateDrop(Object target, int operation,
+ TransferData transferType) {
+ boolean transferDataIsSupported = FeatureNodeTransfer.getInstance().isSupportedType(transferType);
+ return transferDataIsSupported;
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+* 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.workingSet;
+
+import eu.etaxonomy.taxeditor.featuretree.FeatureTreeLabelProvider;
+
+/**
+ *
+ * @author pplitzner
+ * @date Jun 1, 2017
+ *
+ */
+public class CharacterLabelProvider extends FeatureTreeLabelProvider {
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getText(Object element) {
+ if(element instanceof eu.etaxonomy.cdm.model.description.Character){
+ eu.etaxonomy.cdm.model.description.Character character = (eu.etaxonomy.cdm.model.description.Character)element;
+ }
+ return super.getText(element);
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+* 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.workingSet;
+
+import java.util.UUID;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+
+import org.eclipse.e4.ui.di.Focus;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+
+import eu.etaxonomy.cdm.api.service.IFeatureTreeService;
+import eu.etaxonomy.cdm.model.description.FeatureTree;
+import eu.etaxonomy.taxeditor.featuretree.FeatureNodeTransfer;
+import eu.etaxonomy.taxeditor.featuretree.FeatureTreeContentProvider;
+import eu.etaxonomy.taxeditor.featuretree.FeatureTreeLabelProvider;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author pplitzner
+ * @date 24.05.2017
+ *
+ */
+public class FeatureTreeBuilderViewPart {
+
+
+ private TreeViewer treeViewerCharacters;
+ private TreeViewer treeViewerProperties;
+ private TreeViewer treeViewerStructures;
+
+ public FeatureTreeBuilderViewPart() {
+ }
+
+ /**
+ * Create contents of the view part.
+ */
+ @PostConstruct
+ public void createControls(Composite parent) {
+ parent.setLayout(new FillLayout(SWT.HORIZONTAL));
+
+ treeViewerStructures = new TreeViewer(parent, SWT.BORDER);
+
+ treeViewerProperties = new TreeViewer(parent, SWT.BORDER);
+
+ treeViewerCharacters = new TreeViewer(parent, SWT.BORDER);
+
+ init();
+ }
+
+ private void init(){
+ int dndOperations = DND.DROP_COPY | DND.DROP_MOVE;
+ Transfer[] transfers = new Transfer[] { FeatureNodeTransfer.getInstance() };
+
+ FeatureTree structureFeatureTree = CdmStore.getService(IFeatureTreeService.class).load(UUID.fromString("63d15e75-5f47-47c0-9540-cebe2697f37e"));
+ treeViewerStructures.setContentProvider(new FeatureTreeContentProvider());
+ treeViewerStructures.setLabelProvider(new FeatureTreeLabelProvider());
+ treeViewerStructures.setInput(structureFeatureTree);
+
+ FeatureTree propertiesFeatureTree = CdmStore.getService(IFeatureTreeService.class).load(UUID.fromString("87680e5d-1026-451f-9a18-02d8e80fdaa0"));
+ treeViewerProperties.setContentProvider(new FeatureTreeContentProvider());
+ treeViewerProperties.setLabelProvider(new FeatureTreeLabelProvider());
+ treeViewerProperties.addDragSupport(dndOperations, transfers, new CharacterDragListener(treeViewerStructures, treeViewerProperties));
+ treeViewerProperties.setInput(propertiesFeatureTree);
+
+ treeViewerCharacters.setContentProvider(new FeatureTreeContentProvider());
+ treeViewerCharacters.setLabelProvider(new FeatureTreeLabelProvider());
+ treeViewerCharacters.addDropSupport(dndOperations, transfers, new CharacterDropAdapter(treeViewerCharacters));
+ }
+
+ @PreDestroy
+ public void dispose() {
+ }
+
+ @Focus
+ public void setFocus() {
+ }
+
+ public TreeViewer getTreeViewerCharacters() {
+ return treeViewerCharacters;
+ }
+ public TreeViewer getTreeViewerProperties() {
+ return treeViewerProperties;
+ }
+ public TreeViewer getTreeViewerStructures() {
+ return treeViewerStructures;
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+* 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.workingSet;
+
+import java.util.Collections;
+
+import org.eclipse.jface.viewers.ITreeContentProvider;
+
+import eu.etaxonomy.cdm.model.description.FeatureNode;
+import eu.etaxonomy.cdm.model.description.FeatureTree;
+
+/**
+ * @author pplitzner
+ * @date 24.05.2017
+ *
+ */
+public class StructureContentProvider implements ITreeContentProvider {
+
+ public StructureContentProvider() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Object[] getElements(Object inputElement) {
+ FeatureTree featureTree = (FeatureTree)inputElement;
+ return Collections.singleton(featureTree.getRoot()).toArray();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Object[] getChildren(Object parentElement) {
+ return ((FeatureNode)parentElement).getChildNodes().toArray();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Object getParent(Object element) {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean hasChildren(Object element) {
+ return ((FeatureNode)element).getChildCount()>0;
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+* 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.workingSet;
+
+import org.eclipse.jface.viewers.ColumnLabelProvider;
+
+import eu.etaxonomy.cdm.model.description.FeatureNode;
+
+/**
+ * @author pplitzner
+ * @date 24.05.2017
+ *
+ */
+public class StructureLabelProvider extends ColumnLabelProvider {
+
+
+ public StructureLabelProvider() {
+ }
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getText(Object element) {
+
+ return ((FeatureNode)element).getFeature().getLabel();
+ }
+}
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerDropAdapter;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.DragSourceAdapter;
-import org.eclipse.swt.dnd.DragSourceEvent;
import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.dnd.TransferData;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
-import org.hibernate.proxy.HibernateProxy;
import eu.etaxonomy.cdm.api.service.IFeatureNodeService;
import eu.etaxonomy.cdm.api.service.config.FeatureNodeDeletionConfigurator;
import eu.etaxonomy.cdm.model.description.Feature;
import eu.etaxonomy.cdm.model.description.FeatureNode;
import eu.etaxonomy.cdm.model.description.FeatureTree;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
for (Feature feature : additionalFeatures) {
FeatureNode child = FeatureNode.NewInstance(feature);
CdmStore.getService(IFeatureNodeService.class).merge(child, true);
-
+
parent.addChild(child);
}
viewer.refresh();
FeatureNode featureNode = (FeatureNode) selectedObject;
FeatureNode parent = featureNode.getParent();
parent.removeChild(featureNode);
-
- CdmStore.getService(IFeatureNodeService.class).deleteFeatureNode(featureNode.getUuid(), new FeatureNodeDeletionConfigurator());
-
- }
- viewer.refresh();
- }
- }
- private class FeatureNodeDragListener extends DragSourceAdapter {
-
- private final TreeViewer viewer;
-
- public FeatureNodeDragListener(TreeViewer viewer) {
- this.viewer = viewer;
- }
-
- /**
- * Method declared on DragSourceListener
- */
- @Override
- public void dragFinished(DragSourceEvent event) {
- if (!event.doit) {
- return;
- }
- // if the featureNode was moved, remove it from the source viewer
- if (event.detail == DND.DROP_MOVE) {
- IStructuredSelection selection = (IStructuredSelection) viewer
- .getSelection();
- viewer.refresh();
- }
- }
+ CdmStore.getService(IFeatureNodeService.class).deleteFeatureNode(featureNode.getUuid(), new FeatureNodeDeletionConfigurator());
- /**
- * Method declared on DragSourceListener
- */
- @Override
- public void dragSetData(DragSourceEvent event) {
- IStructuredSelection selection = (IStructuredSelection) viewer
- .getSelection();
- FeatureNode[] featureNodes = (FeatureNode[]) selection.toList()
- .toArray(new FeatureNode[selection.size()]);
- if (FeatureNodeTransfer.getInstance().isSupportedType(
- event.dataType)) {
- event.data = featureNodes;
}
+ viewer.refresh();
}
-
- /**
- * Method declared on DragSourceListener
- */
- @Override
- public void dragStart(DragSourceEvent event) {
- event.doit = !viewer.getSelection().isEmpty();
- }
-
}
- private class FeatureNodeDropAdapter extends ViewerDropAdapter {
-
- protected FeatureNodeDropAdapter(Viewer viewer) {
- super(viewer);
- }
-
- @Override
- public boolean performDrop(Object data) {
- FeatureNode target = (FeatureNode) getCurrentTarget();
- int position = 0;
-
- if (target != null) {
- int location = getCurrentLocation();
- FeatureNode parent = target.getParent();
- if (location == LOCATION_BEFORE) {
- position = Math.max(0, parent.getIndex(target) - 1);
- target = parent;
- }
-
- if (location == LOCATION_AFTER) {
- position = parent.getIndex(target);
- target = parent;
- }
- }
-
- // set target to root node if there is no target specified
- if (target == null) {
- FeatureTree featureTree = (FeatureTree) getViewer().getInput();
- target = featureTree.getRoot();
- }
-
- Object[] droppedObjects = (Object[]) data;
- TreeViewer viewer = (TreeViewer) getViewer();
-
- // cannot drop a feature node onto itself
- for (Object droppedObject : droppedObjects) {
- if (droppedObject == null) {
- MessagingUtils.warningDialog(
- "Operation not supported yet",
- this,
- "We are currently unable to change the order of freshly created "
- + "feature trees nodes. Please close and reopen the dialog to change the order of features.");
- return false;
- }
- if (droppedObject.equals(target)) {
- return false;
- }
- }
- for (Object droppedObject : droppedObjects) {
- FeatureNode droppedNode = (FeatureNode) droppedObject;
- target.addChild(droppedNode, position);
- viewer.add(target, droppedNode);
- viewer.reveal(droppedNode);
- }
- return true;
- }
-
- @Override
- public boolean validateDrop(Object target, int operation,
- TransferData transferData) {
- return FeatureNodeTransfer.getInstance().isSupportedType(
- transferData);
- }
-
- }
}
--- /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.featuretree;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.DragSourceAdapter;
+import org.eclipse.swt.dnd.DragSourceEvent;
+
+import eu.etaxonomy.cdm.model.description.FeatureNode;
+
+/**
+ * @author pplitzner
+ * @since Jun 2, 2017
+ *
+ */
+public class FeatureNodeDragListener extends DragSourceAdapter {
+
+ private final TreeViewer viewer;
+
+ public FeatureNodeDragListener(TreeViewer viewer) {
+ this.viewer = viewer;
+ }
+
+ /**
+ * Method declared on DragSourceListener
+ */
+ @Override
+ public void dragFinished(DragSourceEvent event) {
+ if (!event.doit) {
+ return;
+ }
+ if (event.detail == DND.DROP_MOVE) {
+ viewer.refresh();
+ }
+ }
+
+ /**
+ * Method declared on DragSourceListener
+ */
+ @Override
+ public void dragSetData(DragSourceEvent event) {
+ IStructuredSelection selection = (IStructuredSelection) viewer
+ .getSelection();
+ FeatureNode[] featureNodes = (FeatureNode[]) selection.toList()
+ .toArray(new FeatureNode[selection.size()]);
+ if (FeatureNodeTransfer.getInstance().isSupportedType(
+ event.dataType)) {
+ event.data = featureNodes;
+ }
+ }
+
+ /**
+ * Method declared on DragSourceListener
+ */
+ @Override
+ public void dragStart(DragSourceEvent event) {
+ event.doit = !viewer.getSelection().isEmpty();
+ }
+
+}
--- /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.featuretree;
+
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerDropAdapter;
+import org.eclipse.swt.dnd.TransferData;
+
+import eu.etaxonomy.cdm.model.description.FeatureNode;
+import eu.etaxonomy.cdm.model.description.FeatureTree;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+
+/**
+ * @author pplitzner
+ * @since Jun 2, 2017
+ *
+ */
+public class FeatureNodeDropAdapter extends ViewerDropAdapter {
+
+ public FeatureNodeDropAdapter(Viewer viewer) {
+ super(viewer);
+ }
+
+ @Override
+ public boolean performDrop(Object data) {
+ FeatureNode target = (FeatureNode) getCurrentTarget();
+ int position = 0;
+
+ if (target != null) {
+ int location = getCurrentLocation();
+ FeatureNode parent = target.getParent();
+ if (location == LOCATION_BEFORE) {
+ position = Math.max(0, parent.getIndex(target) - 1);
+ target = parent;
+ }
+
+ if (location == LOCATION_AFTER) {
+ position = parent.getIndex(target);
+ target = parent;
+ }
+ }
+
+ // set target to root node if there is no target specified
+ if (target == null) {
+ FeatureTree featureTree = (FeatureTree) getViewer().getInput();
+ target = featureTree.getRoot();
+ }
+
+ Object[] droppedObjects = (Object[]) data;
+ TreeViewer viewer = (TreeViewer) getViewer();
+
+ // cannot drop a feature node onto itself
+ for (Object droppedObject : droppedObjects) {
+ if (droppedObject == null) {
+ MessagingUtils.warningDialog(
+ "Operation not supported yet",
+ this,
+ "We are currently unable to change the order of freshly created "
+ + "feature trees nodes. Please close and reopen the dialog to change the order of features.");
+ return false;
+ }
+ if (droppedObject.equals(target)) {
+ return false;
+ }
+ }
+ for (Object droppedObject : droppedObjects) {
+ FeatureNode droppedNode = (FeatureNode) droppedObject;
+ target.addChild(droppedNode, position);
+ viewer.add(target, droppedNode);
+ viewer.reveal(droppedNode);
+ }
+ return true;
+ }
+
+ @Override
+ public boolean validateDrop(Object target, int operation,
+ TransferData transferData) {
+ return FeatureNodeTransfer.getInstance().isSupportedType(
+ transferData);
+ }
+
+}
\ No newline at end of file
/**
* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* 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.
*/
import eu.etaxonomy.cdm.model.description.FeatureTree;
/**
- * <p>FeatureTreeLabelProvider class.</p>
*
* @author n.hoffmann
* @created Aug 5, 2010
* @version 1.0
*/
public class FeatureTreeLabelProvider extends LabelProvider {
-
- private Feature feature;
-
+
/** {@inheritDoc} */
@Override
public String getText(Object element) {
if(element instanceof FeatureTree){
return ((FeatureTree) element).getTitleCache();
}else if(element instanceof FeatureNode){
- feature = ((FeatureNode) element).getFeature();
-
- if(feature != null)
- return feature.getTitleCache();
-
+ Feature feature = ((FeatureNode) element).getFeature();
+ if(feature != null) {
+ return feature.getTitleCache();
+ }
+
}
return "No label provided";
}
-
- /**
- * <p>Getter for the field <code>feature</code>.</p>
- *
- * @return a {@link eu.etaxonomy.cdm.model.description.Feature} object.
- */
- public Feature getFeature(){
- return feature;
- }
+
}