Skip to main content



      Home
Home » Eclipse Projects » GEF » Supporting for more than one kind of Connections
Supporting for more than one kind of Connections [message #11096] Sat, 22 June 2002 03:19 Go to next message
Eclipse UserFriend
I want to support 2 kinds of connection, and each kind of connection has
its own kind of EditPart, and I add the 2 connection tools to the palette
with the following code

tool = new DefaultPaletteToolEntry(
new ConnectionTool(),
"connection1",
"connection1",
Image16,
Image32
);
entries.add(tool);

tool = new DefaultPaletteToolEntry(
new ConnectionTool(),
"connection2",
"connection2",
Image16,
Image32
);
entries.add(tool);

However, in the NodeEditPolicy.getConnectionCreateCommand(request) method,

request.getNewObject and request.getNewObjectType all returns null, so
that I cannot distinguish which kind of connection to create

The current solution is to keep reference of the two new ConnectionTool in
the above code as connection1Tool and connection2Tool, and then at the
NodeEditPolicy.getConnectionCreateCommand(request) method, I can determine
which kind of connection to create by testing which tool is the current
active tool get from
getHost().getRoot().getViewer().getEditDomain().getActiveToo l()

Obvious this is not a good solution because of the more tight coupling
degree between editpolicies and palettes. So I want to know why
request.getNewObject and request.getNewObjectType will be null? Is it a
bug? Or is there any other way of solving this problem
Re: Supporting for more than one kind of Connections [message #11101 is a reply to message #11096] Sat, 22 June 2002 16:53 Go to previous message
Eclipse UserFriend
Originally posted by: none.ibm.com

If you set the Factory on the ConnectionCreationTool, it should provide the
new Type and instance information to the request.
Someone at IBM requested this about 6 months ago so I believe it should
work.

"Jun Zhu" <zhujun@cn.ibm.com> wrote in message
news:af18ep$8tc$1@rogue.oti.com...
> I want to support 2 kinds of connection, and each kind of connection has
> its own kind of EditPart, and I add the 2 connection tools to the palette
> with the following code
>
> tool = new DefaultPaletteToolEntry(
> new ConnectionTool(),
> "connection1",
> "connection1",
> Image16,
> Image32
> );
> entries.add(tool);
>
> tool = new DefaultPaletteToolEntry(
> new ConnectionTool(),
> "connection2",
> "connection2",
> Image16,
> Image32
> );
> entries.add(tool);
>
> However, in the NodeEditPolicy.getConnectionCreateCommand(request) method,
>
> request.getNewObject and request.getNewObjectType all returns null, so
> that I cannot distinguish which kind of connection to create
>
> The current solution is to keep reference of the two new ConnectionTool in
> the above code as connection1Tool and connection2Tool, and then at the
> NodeEditPolicy.getConnectionCreateCommand(request) method, I can determine
> which kind of connection to create by testing which tool is the current
> active tool get from
> getHost().getRoot().getViewer().getEditDomain().getActiveToo l()
>
> Obvious this is not a good solution because of the more tight coupling
> degree between editpolicies and palettes. So I want to know why
> request.getNewObject and request.getNewObjectType will be null? Is it a
> bug? Or is there any other way of solving this problem
>
>
>
>
>
>
Previous Topic:Running GEF outside of Eclipse...
Next Topic:Using GEF Outside of Eclipse?
Goto Forum:
  


Current Time: Thu May 08 17:09:13 EDT 2025

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

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

Back to the top