Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » Problem while creating DiagramDocumentEditor as a drop target
Problem while creating DiagramDocumentEditor as a drop target [message #196991] Mon, 14 July 2008 16:01
Eclipse UserFriend
Hello All,

I am trying to assign the DiagramDocumentEditor (generated by GMF) as a
drop target for some custom tools in the fly-out palette (some of which
were added manually). I did an override of the
createPaletteViewerProvider method to make it a drag source:

protected PaletteViewerProvider createPaletteViewerProvider() {
super.createPaletteViewerProvider();
getEditDomain().setPaletteRoot(createPaletteRoot(null));
return new PaletteViewerProvider(getEditDomain()) {

public PaletteViewer createPaletteViewer(Composite parent) {
return super.createPaletteViewer(parent);
}
protected void configurePaletteViewer(PaletteViewer
viewer) {
super.configurePaletteViewer(viewer);
viewer.addDragSourceListener(new
TemplateTransferDragSourceListener(viewer));
}

};
}

I then did an override of the initializeGraphicalViewer method:

protected void initializeGraphicalViewer() {
super.initializeGraphicalViewer();


getDiagramGraphicalViewer().addDropTargetListener(new
TemplateTransferDropTargetListener(getGraphicalViewer()) {
protected CreationFactory getFactory(Object template) {
return new NodeCreationFactory((Class<?>)(template));
}
});


}

"NodeCreationFactory" is the name of my class which creates and returns
Objects based on the "template".

There is no problem when I drag and drop tools in the palette which were
generated by GMF. But the editor does not act as a drop target for the
tools which were manually added by me. Am I missing something here? Do I
have to implement/override some other method?

Thanks in advance.

Cheers,
Naren.
Previous Topic:Problems accessing subclasses in different packages
Next Topic:Context Menu in Mapping file
Goto Forum:
  


Current Time: Sun Jul 06 01:09:40 EDT 2025

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

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

Back to the top