Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » Compound command to add a sub diagram
Compound command to add a sub diagram [message #230170] Wed, 13 May 2009 16:32 Go to next message
Eclipse UserFriend
Hi there,
I have a diagram which contains some nodes, by double-click one of the
node, it'll open up a sub diagram by firing off Command got through
OpenDiagramEditPolicy. The logic in OpenDiagramEditPolicy basically works
like this, if the diagram resource doesn't exist, create one and append
that to current resource's contents. Now comes my question, I want the sub
diagram resource gets created once the node(its model and its view) gets
created, I want that to be in a single command(or compound command), is
this feasible? I ask because the current redo/undo is a bit weird, when I
first drops a node on the canvas, and then double click on it, it opens up
the new diagram editor, and then I close the subdiagram editor, and have
to click undo twice(first remove the diagram resource and then remove the
node and its view) to get rid of the newly created node, ideally I should
just need to click once. Also I need to programmatically create the node
and its diagram resource, and I don't want to create that in 2 steps, but
I don't know how to make this compound command since the
create-diagram-resource subcommand depends on the newly created node's
editpart which is a prior command.

Thanks in advance!
Paul
Re: Compound command to add a sub diagram [message #230225 is a reply to message #230170] Thu, 14 May 2009 05:30 Go to previous messageGo to next message
Eclipse UserFriend
Hello ps,

Currently such a node will be created together with HintedDiagramLinkStyle
(an object keeping a reference to linked diagram), but diagram itself will
be created on demand on first attempt to open linked diagram. If you need
to create such node and linked diagram at once then you can modify generated
XXXViewProvider (a class responsible for node instance creation) and make
it creating a linked diagram just in a place it created HintedDiagramLinkStyle.
The code creating a linked diagram you can copy from generated OpenDiagramEditPolicy.OpenDiagramCommand.initializeNewDiagra m()
method.

-----------------
Alex Shatalin
Re: Compound command to add a sub diagram [message #230326 is a reply to message #230225] Thu, 14 May 2009 14:57 Go to previous message
Eclipse UserFriend
Yes, that solved my problem! Thanks again!
Previous Topic:Loading too many GMF plugins causes debugger crash with "Cannot connect to VM"
Next Topic:Copy paste problem resolved ?
Goto Forum:
  


Current Time: Sat Jul 05 04:05:08 EDT 2025

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

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

Back to the top