Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » how do I drag an object from my outline view and drop it into GEF editor?
how do I drag an object from my outline view and drop it into GEF editor? [message #996859] Thu, 03 January 2013 03:42 Go to next message
Julie Pat is currently offline Julie PatFriend
Messages: 4
Registered: December 2012
Junior Member
Hi,

I would like to drag an object from my outline view and drop it into the GEF editor. I can drag an object from my palettte into GEF editor just fine by doing the following listed below.

Is there something equivalent to this only dragging from the outline view into the GEF editor?

Thanks in advance...

public class MyMenuBoardEditor extends GraphicalEditorWithFlyoutPalette{

@Override
protected void initializeGraphicalViewer() {
.
.
viewer.addDropTargetListener(new MyTemplateTransferDropTargetListener(viewer));
}

@Override
protected PaletteViewerProvider createPaletteViewerProvider() {
return new PaletteViewerProvider(getEditDomain()) {
protected void configurePaletteViewer(PaletteViewer viewer) {
super.configurePaletteViewer(viewer);
viewer.addDragSourceListener(new TemplateTransferDragSourceListener(viewer));

}

};
}

protected class TemplatePage extends ContentOutlinePage {


public TemplatePage() {
super(new TreeViewer());
}



public void init(IPageSite pageSite) {
super.init(pageSite);

.
.
// I think I need to add a drag listener here. But what listener should be added?? I saw some code for org.eclipse.ui.parts.TreeViewerTransferDropListener, etc in the old versions of GEF, but they seem to be removed from the new jars.... I am using GEF 3.7
//getViewer().addDragSourceListener(What listener should go here????);
}
}

}

public class MyTemplateTransferDropTargetListener extends TemplateTransferDropTargetListener {

public MyTemplateTransferDropTargetListener(EditPartViewer viewer) {
super(viewer);
}

@Override
protected CreationFactory getFactory(Object template) {
return new NodeCreationFactory((Class<?>)template);
}

}
Re: how do I drag an object from my outline view and drop it into GEF editor? [message #997048 is a reply to message #996859] Thu, 03 January 2013 13:37 Go to previous messageGo to next message
Jan Krakora is currently offline Jan KrakoraFriend
Messages: 477
Registered: December 2009
Location: Prague
Senior Member
Hi, this should help you
http://www.eclipse.org/articles/Article-GEF-dnd/GEF-dnd.html
Re: how do I drag an object from my outline view and drop it into GEF editor? [message #997121 is a reply to message #996859] Thu, 03 January 2013 19:54 Go to previous message
Julie Pat is currently offline Julie PatFriend
Messages: 4
Registered: December 2012
Junior Member
Thank you for your suggestion!

Read throught the article. Will try it on my issue. I think I need to create some sort of DragSourceListener as well on my TreeViewer used in the Outline View. Is that correct? or does the Outline View already come with DragSourceListener built in as in Navigator or Package Explorer?
Previous Topic:Context menu on mouse over
Next Topic:Drag onto connection
Goto Forum:
  


Current Time: Mon Dec 22 01:27:27 GMT 2014

Powered by FUDForum. Page generated in 0.01860 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software