fix move whole description to another description and adding delete configurator...
[taxeditor.git] / eu.etaxonomy.taxeditor.editor / src / main / java / eu / etaxonomy / taxeditor / editor / view / descriptive / DescriptionElementDragListener.java
index de3e46f0da432566a11f7895ac149f8ced59ef1c..e5e58d0f675cd52dd980bf0eebeb0b383ec679b7 100644 (file)
@@ -18,6 +18,7 @@ import org.eclipse.swt.dnd.DND;
 import org.eclipse.swt.dnd.DragSourceAdapter;
 import org.eclipse.swt.dnd.DragSourceEvent;
 
+import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
 import eu.etaxonomy.cdm.model.description.DescriptionBase;
 import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
 import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
@@ -30,6 +31,7 @@ import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
 public class DescriptionElementDragListener extends DragSourceAdapter {
 
        private DescriptiveViewPart part;
+       private DescriptionBase description;
        
        public DescriptionElementDragListener(DescriptiveViewPart part){
                this.part = part;
@@ -43,9 +45,10 @@ public class DescriptionElementDragListener extends DragSourceAdapter {
                        return;
                // FIXME what to do here?
                if (event.detail != DND.DROP_NONE) {
-                       IStructuredSelection selection = (IStructuredSelection) part.getViewer()
-                                       .getSelection();
-                       part.changed(null);
+                       //IStructuredSelection selection = (IStructuredSelection) part.getViewer().getSelection();
+                       part.getViewer().refresh();
+                       
+               part.changed(null);
                }
        }
        
@@ -59,6 +62,8 @@ public class DescriptionElementDragListener extends DragSourceAdapter {
                for (Object object : selection.toList()){
                        if(object instanceof DescriptionBase){
                                descriptionElements.addAll(((DescriptionBase) object).getElements());
+                               description = HibernateProxyHelper.deproxy(object, DescriptionBase.class);
+                               
                        }else if(object instanceof FeatureNodeContainer){
                                descriptionElements.addAll(((FeatureNodeContainer) object).getDescriptionElements());
                        }else if(object instanceof DescriptionElementBase){
@@ -69,7 +74,9 @@ public class DescriptionElementDragListener extends DragSourceAdapter {
                if (DescriptionElementTransfer.getInstance().isSupportedType(
                                event.dataType)) {
                        event.data = descriptionElements.toArray(new DescriptionElementBase[descriptionElements.size()]);
+                       
                }
+               
        }
        
        /**