diff --git a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/views/LibraryView.java b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/views/LibraryView.java index b39966f3c24457eb39d600a7b0bbfa42a53d307d..ff68cd42740a58bf26652e4bc4c789c3eb65028a 100644 --- a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/views/LibraryView.java +++ b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/views/LibraryView.java @@ -109,7 +109,11 @@ public class LibraryView extends ViewPart { @Override public boolean select(Viewer viewer, Object parentElement, Object element) { - // TODO Auto-generated method stub + + /* + * if (element instanceof Prototype) { EObject prototypeObject = + * ((Prototype) element).getPrototype(); return true; } + */ return true; } @@ -135,6 +139,7 @@ public class LibraryView extends ViewPart { return prototype.getName(); } return super.getText(element); + } // TODO (JE): getImage @@ -144,5 +149,6 @@ public class LibraryView extends ViewPart { * return ModelElementService.getInstance().getImage( * prototype.getPrototypeObject()); } return super.getImage(element); } */ + } } diff --git a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/util/DragAndDropUtils.java b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/util/DragAndDropUtils.java index 4137f3178acb2b091deb7f473f41f06ec01d86db..7102c34edc8b28b6e9103e5305f4a6a9fec77a30 100644 --- a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/util/DragAndDropUtils.java +++ b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/util/DragAndDropUtils.java @@ -18,7 +18,6 @@ $Id$ package org.fortiss.tooling.kernel.util; import org.eclipse.emf.ecore.EObject; -import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.fortiss.tooling.kernel.services.IPrototypeService.Prototype; @@ -34,11 +33,15 @@ public final class DragAndDropUtils { /** Extracts the EObject contained in the given drop object. */ public static EObject extractDroppedEObject(Object data) { - if (data instanceof IStructuredSelection) { - return EObjectSelectionUtils.getFirstElement((ISelection) data); - } - if (data instanceof Prototype) { - return ((Prototype) data).getPrototypeCopy(); + if (data instanceof IStructuredSelection + && !((IStructuredSelection) data).isEmpty()) { + Object result = ((IStructuredSelection) data).getFirstElement(); + if (result instanceof Prototype) { + return ((Prototype) result).getPrototypeCopy(); + } + if (result instanceof EObject) { + return (EObject) result; + } } return null; }