Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » bug in AbstractGraphicalEditPart#refreshSourceConnection
bug in AbstractGraphicalEditPart#refreshSourceConnection [message #238494] Fri, 14 September 2007 13:56 Go to next message
Eclipse UserFriend
Originally posted by: aczerwonka.3esi.com

and refreshTargetConnections

I *think* there's a bug. In my implementation, I use very lightweight model
objects that are meant to be created as ofter as need be. When I implement
getSourceConnections(), I re-wrap real pojo's with my lightwieght UI model
objects. The trouble is that the implementation of refreshSourceConnection
uses reference equality, e.g. getModel == model, versus equality, e.g.
getModel.equals(model), so my model#equals implementation doesn't work. I
don't see any documentation as to why that choice was made, and what drove
me to a correct equals implementation is the fact that the TableViewer
requires a correct implementation to maintain selection.

Can anyone confirm that this is a *bug* and/or *design choice* or and I
missing something?

--
Andy Czerwonka
Re: bug in AbstractGraphicalEditPart#refreshSourceConnection [message #238551 is a reply to message #238494] Wed, 19 September 2007 15:27 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.ibm.com

If the == fails, doesn't the next statement find the editpart anyway?

if (i < editParts.size()
&& ((EditPart) editParts.get(i)).getModel() == model)
continue;
editPart = (ConnectionEditPart) modelToEditPart.get(model);
if (editPart != null)
reorderSourceConnection(editPart, i);

The model->part map should use .equals(). Did you remember to implement
hashCode()?

"Andy Czerwonka" <aczerwonka@3esi.com> wrote in message
news:fce3u5$d84$1@build.eclipse.org...
> and refreshTargetConnections
>
> I *think* there's a bug. In my implementation, I use very lightweight
> model objects that are meant to be created as ofter as need be. When I
> implement getSourceConnections(), I re-wrap real pojo's with my
> lightwieght UI model objects. The trouble is that the implementation of
> refreshSourceConnection uses reference equality, e.g. getModel == model,
> versus equality, e.g. getModel.equals(model), so my model#equals
> implementation doesn't work. I don't see any documentation as to why that
> choice was made, and what drove me to a correct equals implementation is
> the fact that the TableViewer requires a correct implementation to
> maintain selection.
>
> Can anyone confirm that this is a *bug* and/or *design choice* or and I
> missing something?
>
> --
> Andy Czerwonka
>
>
Re: bug in AbstractGraphicalEditPart#refreshSourceConnection [message #238652 is a reply to message #238551] Tue, 25 September 2007 21:07 Go to previous message
Eclipse UserFriend
Originally posted by: aczerwonka.3esi.com

Yup - hasCode is implemented. I overwrote
AbstractGraphicalEditPart#createOrFindConnection to get around it.

"Randy Hudson" <none@ibm.com> wrote in message
news:fcrf4i$vi8$1@build.eclipse.org...
> If the == fails, doesn't the next statement find the editpart anyway?
>
> if (i < editParts.size()
> && ((EditPart) editParts.get(i)).getModel() == model)
> continue;
> editPart = (ConnectionEditPart) modelToEditPart.get(model);
> if (editPart != null)
> reorderSourceConnection(editPart, i);
>
> The model->part map should use .equals(). Did you remember to implement
> hashCode()?
>
> "Andy Czerwonka" <aczerwonka@3esi.com> wrote in message
> news:fce3u5$d84$1@build.eclipse.org...
>> and refreshTargetConnections
>>
>> I *think* there's a bug. In my implementation, I use very lightweight
>> model objects that are meant to be created as ofter as need be. When I
>> implement getSourceConnections(), I re-wrap real pojo's with my
>> lightwieght UI model objects. The trouble is that the implementation of
>> refreshSourceConnection uses reference equality, e.g. getModel == model,
>> versus equality, e.g. getModel.equals(model), so my model#equals
>> implementation doesn't work. I don't see any documentation as to why
>> that choice was made, and what drove me to a correct equals
>> implementation is the fact that the TableViewer requires a correct
>> implementation to maintain selection.
>>
>> Can anyone confirm that this is a *bug* and/or *design choice* or and I
>> missing something?
>>
>> --
>> Andy Czerwonka
>>
>>
>
>
Previous Topic:Focus rectangle is not drawn in 3.3
Next Topic:inline editing
Goto Forum:
  


Current Time: Mon Dec 22 08:38:59 GMT 2014

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

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