Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » DropObjectsRequest and Command to DnD from a View to diagram editor
DropObjectsRequest and Command to DnD from a View to diagram editor [message #224840] Wed, 08 April 2009 09:45 Go to next message
Esteban Dugueperoux is currently offline Esteban DugueperouxFriend
Messages: 472
Registered: July 2009
Senior Member
Hi,

I have a GMF editor. In my
DiagramDocumentEditor.initializeGraphicalViewer method, I have
configured a DropTargetListener :

getDiagramGraphicalViewer().addDropTargetListener(
new TransfoProjectDropTargetListener(
getDiagramGraphicalViewer()
)
);

with LocalTransfer. I have overrided
DropTargetListener.createTargetRequest method to create a
DropObjectsRequest object with object being dropped :

protected Request createTargetRequest() {
DropObjectsRequest request = new DropObjectsRequest();
request.setObjects(getObjectsBeingDropped());
request.setAllowedDetail(getCurrentEvent().operations);
return request;
}

In the editpolicy corresponding to my GMF diagram I have overrided
DiagramDragDropEditPolicy.getDropObjectsCommand but which Command can I
create to GMF Runtime to add my dropped object in editingdomain et
corresponding view in the GMF diagram editor?
The DiagramDragDropEditPolicy.createViewsAndArrangeCommand don't change
anything.


Thanks in advance.
Re: DropObjectsRequest and Command to DnD from a View to diagram editor [message #224954 is a reply to message #224840] Wed, 08 April 2009 12:33 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Esteban,

See http://dev.eclipse.org/newslists/news.eclipse.modeling.gmf/m sg17244.html

-----------------
Alex Shatalin
Re: DropObjectsRequest and Command to DnD from a View to diagram editor [message #225117 is a reply to message #224954] Thu, 09 April 2009 10:19 Go to previous messageGo to next message
Esteban Dugueperoux is currently offline Esteban DugueperouxFriend
Messages: 472
Registered: July 2009
Senior Member
Hi Alex,

Now I can add view corresponding to my EObject in my diagram but my
EObject is not added to my domain model resource. I use same code of
almost all DnD example :


For example in uml2tools example, the class
"org.eclipse.uml2.diagram.clazz.edit.parts.PackageEditPart" has a
DiagramDragDropEditPolicy with a custom getDropObjectsCommand() method
which return UMLCreateShortcutDecorationsCommand command behind a
AbstractTransactionalCommand.

Constructor of AbstractTransactionalCommand take a list of affected file
from getWorkspaceFiles(parentView), but this list contains only diagram
resource file not domain resource file.

How can I get domain resource file from a EditPart?


Thanks.

Alex Shatalin a écrit :
> Hello Esteban,
>
> See
> http://dev.eclipse.org/newslists/news.eclipse.modeling.gmf/m sg17244.html
>
> -----------------
> Alex Shatalin
>
>
Re: DropObjectsRequest and Command to DnD from a View to diagrameditor [message #225156 is a reply to message #225117] Thu, 09 April 2009 11:39 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Esteban,

> How can I get domain resource file from a EditPart?
((View) getModel()).getElement().eResource()

-----------------
Alex Shatalin
Re: DropObjectsRequest and Command to DnD from a View to diagrameditor [message #225271 is a reply to message #225156] Thu, 09 April 2009 12:57 Go to previous message
Esteban Dugueperoux is currently offline Esteban DugueperouxFriend
Messages: 472
Registered: July 2009
Senior Member
Yes I have seen MDAProjectEditPart.getHostObject() method also to get
EObject under my MDAProjectEditPart controler but both return null.
MDAProject being my root metamodel element.
Yet my domain resource file contain MDAProject object, I don't
understand why this method return null.

I can add view corresponding to my BusinessModel (EObject child of my
MDAProject) but when I try to save diagram a MessageDialog tell me that
saving could not be completed because of corresponding EObject of my
view missing in resource.

Thanks for your help.

Alex Shatalin a écrit :
> Hello Esteban,
>
>> How can I get domain resource file from a EditPart?
> ((View) getModel()).getElement().eResource()
>
> -----------------
> Alex Shatalin
>
>
Previous Topic:Start/activate label editor from custom action
Next Topic:generate help contents from GMF model
Goto Forum:
  


Current Time: Tue Sep 24 14:18:47 GMT 2024

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

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

Back to the top