Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » force only one type of connector for an EditPart
force only one type of connector for an EditPart [message #191318] Tue, 09 August 2005 21:27 Go to next message
Eclipse UserFriend
Originally posted by: pbeagan.yahoo_nospam_.com

I have EditParts A and B. I have connectors A1 and B1. EditParts A can
only be connected together with A1 connectors. EditParts B can only be
connected together with B1 connectors.

How do I accomplished this rule?

It seems that in A's EditPolicy.getConnectionCreateCommand, I should
somehow be able to determine the type of connector in the
CreateConnectionRequest. I've tried request.getNewObjectType(), which
always returns 1. I've tried request.getNewObject(), which returns null.
Any ideas?

Thanks.



protected Command getConnectionCreateCommand(CreateConnectionRequest
request) {


Shape source = (Shape) getHost().getModel();
int style = ((Integer) request.getNewObjectType()).intValue();
ShapeConnectionCreateCommand cmd = new
ShapeConnectionCreateCommand(source, style);
request.setStartCommand(cmd);
return cmd;

}
Re: force only one type of connector for an EditPart [message #191327 is a reply to message #191318] Tue, 09 August 2005 21:49 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

Those methods should work. It depends on the CreationFactory you configured
the tool with.

"Patrick Beagan" <pbeagan@yahoo_nospam_.com> wrote in message
news:ddb6qb$ruh$1@news.eclipse.org...
>I have EditParts A and B. I have connectors A1 and B1. EditParts A can
> only be connected together with A1 connectors. EditParts B can only be
> connected together with B1 connectors.
>
> How do I accomplished this rule?
>
> It seems that in A's EditPolicy.getConnectionCreateCommand, I should
> somehow be able to determine the type of connector in the
> CreateConnectionRequest. I've tried request.getNewObjectType(), which
> always returns 1. I've tried request.getNewObject(), which returns null.
> Any ideas?
>
> Thanks.
>
>
>
> protected Command getConnectionCreateCommand(CreateConnectionRequest
> request) {
>
>
> Shape source = (Shape) getHost().getModel();
> int style = ((Integer)
> request.getNewObjectType()).intValue();
> ShapeConnectionCreateCommand cmd = new
> ShapeConnectionCreateCommand(source, style);
> request.setStartCommand(cmd);
> return cmd;
>
> }
Re: force only one type of connector for an EditPart [message #191466 is a reply to message #191327] Wed, 10 August 2005 15:33 Go to previous message
Eclipse UserFriend
Originally posted by: pbeagan.yahoo_dontspamme_.com

That was it, in the tool's CreationFactory. Thanks again! It's really cool
when GEF starts to come together and make sense.


Randy Hudson wrote:

> Those methods should work. It depends on the CreationFactory you
> configured the tool with.
>
> "Patrick Beagan" <pbeagan@yahoo_nospam_.com> wrote in message
> news:ddb6qb$ruh$1@news.eclipse.org...
>>I have EditParts A and B. I have connectors A1 and B1. EditParts A can
>> only be connected together with A1 connectors. EditParts B can only be
>> connected together with B1 connectors.
>>
>> How do I accomplished this rule?
>>
>> It seems that in A's EditPolicy.getConnectionCreateCommand, I should
>> somehow be able to determine the type of connector in the
>> CreateConnectionRequest. I've tried request.getNewObjectType(), which
>> always returns 1. I've tried request.getNewObject(), which returns null.
>> Any ideas?
>>
>> Thanks.
>>
>>
>>
>> protected Command getConnectionCreateCommand(CreateConnectionRequest
>> request) {
>>
>>
>> Shape source = (Shape) getHost().getModel();
>> int style = ((Integer)
>> request.getNewObjectType()).intValue();
>> ShapeConnectionCreateCommand cmd = new
>> ShapeConnectionCreateCommand(source, style);
>> request.setStartCommand(cmd);
>> return cmd;
>>
>> }
Previous Topic:Dragging a parent via a child
Next Topic:Displaying table in palette drawer
Goto Forum:
  


Current Time: Fri Dec 13 03:56:38 GMT 2024

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

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

Back to the top