Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » DnD between multiple GMF Editors [different ecore-models]
DnD between multiple GMF Editors [different ecore-models] [message #493155] Fri, 23 October 2009 12:28 Go to next message
Andreas  is currently offline Andreas Friend
Messages: 19
Registered: October 2009
Junior Member
Hi,

i`ve combined some GMF-editors (each based on his own ecore-model) in a multipageeditor. Now i want to drag`n`drop modelelements between the editors. It should be possible to drag each single element and drop it on each editorlevel.

Example:
Model A
Toplevel-element a
Sublevel-element a`

Model B
Toplevel-element b
Sublevel-element b`

drag a` and drop it on b

The "Contains-Shortcuts-to/Shortcuts-Provided-For"-Feature looks quite good/similar but isn`t enough.
I`m sure this problem was mentioned before, but i couldn`t find a solution yet.
I`m glad about any advice.

Thx in advance
Andreas
Re: DnD between multiple GMF Editors [different ecore-models] [message #493527 is a reply to message #493155] Mon, 26 October 2009 16:00 Go to previous messageGo to next message
Andreas  is currently offline Andreas Friend
Messages: 19
Registered: October 2009
Junior Member
i want to drag modelelements from the navigator/projectexplorer and drop it in another modelelement.
I`ve seen some examples doing this with the same ecore-model/editingdomain. I`m not sure how to do this between different models.

whats the appropriate way to do this?
Re: DnD between multiple GMF Editors [different ecore-models] [message #493932 is a reply to message #493527] Wed, 28 October 2009 14:39 Go to previous messageGo to next message
Artur Kronenberg is currently offline Artur KronenbergFriend
Messages: 159
Registered: August 2009
Senior Member
Hi Andreas,

to your first.

I think dnd from two different editors is a little bit more difficult then normal dnd. The normal DragSourceListener of GMF thinks that you are just moving things in the editor rather then dragging it out. Your diagram just gets bigger.

You would need to apply your own drag source listener to the graphical viewer of your diagram(s) to achiev the wanted behaviour, but I think you will loose the moving behaviour of the elements. A solution I read about would be applying a key (e.g. ctrl) that differs between what you want to do (drag or move) and use that for dnd support.

DND from the navigator, project explorer is easier to achiev.

You need to applie a DNDEditPolicy to the edit Part you want to drop in and implement the according methods. (getDropObjectsCommand)
This way you return your own command which gets executed and does whatever you want it to do.

Hope that helps.

Artur
Re: DnD between multiple GMF Editors [different ecore-models] [message #494083 is a reply to message #493932] Thu, 29 October 2009 07:19 Go to previous messageGo to next message
Andreas  is currently offline Andreas Friend
Messages: 19
Registered: October 2009
Junior Member
Thanks Artur. I`ll try it.
Re: DnD between multiple GMF Editors [different ecore-models] [message #501409 is a reply to message #494083] Wed, 02 December 2009 09:04 Go to previous message
Andreas  is currently offline Andreas Friend
Messages: 19
Registered: October 2009
Junior Member
Hi,

i`m still facing some Problems with this. I realized dnd from the Navigator using the following code. It`s working but it is very slow. Is there a way to improve the performance? I`m using Eclipse3.5/GMF2.2.

thanks in advance.

protected Command getDropObjectsCommand(DropObjectsRequest dropRequest) {

public class ???DropEditPolicy extends DragDropEditPolicy {
???EditPart selectedElement = (???EditPart) getHost();
IElementType type = ???ElementTypes.myElement_2001;
CreateElementRequest cer = new CreateElementRequest(type);
ViewAndElementDescriptor viewDescriptor = new ViewAndElementDescriptor(
new CreateElementRequestAdapter(cer), Node.class,
((IHintedType) type).getSemanticHint(),
selectedElement.getDiagramPreferencesHint());
CreateViewAndElementRequest req = new CreateViewAndElementRequest(viewDescriptor);
req.setLocation(dropRequest.getLocation());
Command cmd1 = getHost().getCommand(req);

return cmd1;
}
protected final Command getGEFWrapper(ICommand cmd) {
return new ICommandProxy(cmd);
}
}
Previous Topic:Need old popup properties behavior
Next Topic:Context Menu will not display
Goto Forum:
  


Current Time: Fri Apr 19 00:47:48 GMT 2024

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

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

Back to the top