Adding children to child figures [message #154542] |
Tue, 19 October 2004 01:40 |
Eclipse User |
|
|
|
Originally posted by: bo.fubar.majewski.com
In the "Building a Database Schema Diagram Editor
with GEF" article
( http://www.eclipse.org/articles/Article-GEF-editor/gef-schem a-editor.html),
Phil Zoio created a schema editor. One of the interesting properties
of that editor is that he has a root object - a schema represented by a
schema figure, to which one can add tables. Furthermore, tables can
accept columns. I am trying to replicate this behavior but with no
success. I have a network, that may have any number of devices. Thus I
created NetworkFigure, NetworkModel and NetworkPart. Each device may
take any number of interfaces. Thus again, I have DeviceFigure,
DeviceModel and DevicePart. And I have Interface part, model and figure,
representing interface. I installed ContainerEditPolicy on both
NetworkPart and DevicePart. Yet my DevicePart never gets any request for
commands (through getCommand(Request) method) when I create a new
Interface, using a palette. Since my NetworkContainerPolicy returns a
null command if one tries to add an interface to it, I can't drop new
interfaces anywhere.
Does anybody know which of the 73 classes that come with Database Schema
Diagram Editor causes tables to receive "create child" requests? Any
hints are greatly appreciated.
|
|
|
Re: Adding children to child figures [message #154821 is a reply to message #154542] |
Thu, 21 October 2004 18:22 |
Pratik Shah Messages: 1077 Registered: July 2009 |
Senior Member |
|
|
Set a breakpoint in CreationTool#handleMove(). When getCommand() is invoked
in that method, it should query the target under the mouse (ensure that it
is your DevicePart) for a creation command.
"Bo Majewski" <bo@fubar.majewski.com> wrote in message
news:cl1qve$jpv$1@eclipse.org...
> In the "Building a Database Schema Diagram Editor
> with GEF" article
>
( http://www.eclipse.org/articles/Article-GEF-editor/gef-schem a-editor.html),
> Phil Zoio created a schema editor. One of the interesting properties
> of that editor is that he has a root object - a schema represented by a
> schema figure, to which one can add tables. Furthermore, tables can
> accept columns. I am trying to replicate this behavior but with no
> success. I have a network, that may have any number of devices. Thus I
> created NetworkFigure, NetworkModel and NetworkPart. Each device may
> take any number of interfaces. Thus again, I have DeviceFigure,
> DeviceModel and DevicePart. And I have Interface part, model and figure,
> representing interface. I installed ContainerEditPolicy on both
> NetworkPart and DevicePart. Yet my DevicePart never gets any request for
> commands (through getCommand(Request) method) when I create a new
> Interface, using a palette. Since my NetworkContainerPolicy returns a
> null command if one tries to add an interface to it, I can't drop new
> interfaces anywhere.
>
> Does anybody know which of the 73 classes that come with Database Schema
> Diagram Editor causes tables to receive "create child" requests? Any
> hints are greatly appreciated.
|
|
|
Re: Adding children to child figures [message #154979 is a reply to message #154821] |
Thu, 21 October 2004 20:45 |
Eclipse User |
|
|
|
Originally posted by: bo.fubar.majewski.com
Pratik Shah wrote:
> Set a breakpoint in CreationTool#handleMove(). When getCommand() is invoked
> in that method, it should query the target under the mouse (ensure that it
> is your DevicePart) for a creation command.
Pratik,
Thanks for the reply. It seems that in order to be able to add children
to a child node I have to define two policies: ContainerEditPolicy and
LayoutEditPolicy. It seems that if the device has no layout edit policy
the findFigureAt(int x, int y, TreeSearch search) over a device returns
null for the create tool, even though it returns non-null for the
selection tool. Are these types of dependencies described in any document?
|
|
|
Re: Adding children to child figures [message #155048 is a reply to message #154979] |
Fri, 22 October 2004 03:38 |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
The key to finding the answer was in EditPart#getTargetEditPart(Request).
ContainerEditPolicy (and ROLE) is *optionally* used if you want to share
common container behavior between multiple EditPart implementations such as
one for a TreeViewer, and one for GraphicalViewer. In both of those cases,
we assume that there is generally a TREE_CONTAINER_ROLE or LAYOUT_ROLE
present and that one of those will perform the targeting.
I know I've written this somewhere but I'm not sure where. It might be in
the integrated help somewhere.
> Thanks for the reply. It seems that in order to be able to add children
> to a child node I have to define two policies: ContainerEditPolicy and
> LayoutEditPolicy. It seems that if the device has no layout edit policy
> the findFigureAt(int x, int y, TreeSearch search) over a device returns
> null for the create tool, even though it returns non-null for the
> selection tool. Are these types of dependencies described in any document?
|
|
|
Powered by
FUDForum. Page generated in 0.01680 seconds