Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[gef-dev] Drop EditPart from TreeViewer



Hello,


I am new to this portal and trying to obtain some information about EditPart creation.


I have a GEF Graphical Editor with a palette and several entries. I create the parts by selecting entries from the palette and then dropping it into the editor.


I would like to by pass the palette by dragging an element from a SWT TreeViewer and dropping the element into the editor. So far, I have created a drop listener in the GraphicalViewer component of my editor using my 'ObjectTransferDropTargetListener' class.


public class ObjectTransferDropTargetListener
  extends AbstractTransferDropTargetListener  {}


I followed the LogicLabel drag and drop example to implement the factory. However, here is where I have the problem. All my EditPart require a View object to be passed as a parameter into the constructor.



public class ChassisShapeEditPart extends ShapeNodeEditPart {

...

public ChassisShapeEditPart(View view) {

               super(view);

}

...


}


I do not know how to create the view object to create the EditPart. In addition, I have read several examples about EdiPart factories and getNewObject () use. I am confused about it use.


Therefore, essentially, can someone help me with this problem? I would like to catch the drop action when the mouse enters into the editor view. I would like to extract the name of the object to be created and then create the corresponding EditPart. The name of the EditPart is the text to be dragged from the TreeViewer.


I appreciate your patience reading the long message. Your help is greatly appreciated.


Thank you.

Francisco

Back to the top