Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Move connection label
Move connection label [message #201971] Fri, 04 November 2005 21:46 Go to next message
Felix L J Mayer is currently offline Felix L J MayerFriend
Messages: 202
Registered: July 2009
Senior Member
I am trying to move a Label that is the child of a connection, so a added a
XYLayoutPolicy to my ConnectionEditPart. But when I try to move the Label,
the DragEditPartsTracker always thinks that the DiagramEditPart is the
target and creates an orphan request. And when it has a command for those,
it changes the request to an add request and wants a command from the
DiagramEditPart.

What am I doing wrong? Is there a way to tell the DragEditPartsTracker that
the target is actually the owning connection?
Re: Move connection label [message #201987 is a reply to message #201971] Sat, 05 November 2005 03:33 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Lamont_Gilbert.rigidsoftware.com

Felix L J Mayer wrote:
> I am trying to move a Label that is the child of a connection, so a added a
> XYLayoutPolicy to my ConnectionEditPart. But when I try to move the Label,
> the DragEditPartsTracker always thinks that the DiagramEditPart is the
> target and creates an orphan request. And when it has a command for those,
> it changes the request to an add request and wants a command from the
> DiagramEditPart.
>
> What am I doing wrong? Is there a way to tell the DragEditPartsTracker that
> the target is actually the owning connection?
>
>

I been intending to do this for a while now.static labels is kinda weak.
Anyway, is your Label a figure or an editpart? If you want to drag it
around seperately from the connectioneditPart then it will need to be
inside its own editpart. That will be my strategy anyway.


CL
Re: Move connection label [message #202183 is a reply to message #201987] Mon, 07 November 2005 18:10 Go to previous messageGo to next message
Felix L J Mayer is currently offline Felix L J MayerFriend
Messages: 202
Registered: July 2009
Senior Member
Yes, of course I need EditParts for anything that can be touched.

I got it to work by overriding
ConstrainedLayoutEditPolicy.createAddCommand() in my DiagramEditPart's
XYLayoutPolicy and returning an empty command.

But this looks a little like a hack to me, I am wondering if there is a
better way to it.

"CL [dnoyeb] Gilbert" <Lamont_Gilbert@rigidsoftware.com> wrote in message
news:dkh95d$jdv$1@news.eclipse.org...
> Felix L J Mayer wrote:
>> I am trying to move a Label that is the child of a connection, so a added
>> a XYLayoutPolicy to my ConnectionEditPart. But when I try to move the
>> Label, the DragEditPartsTracker always thinks that the DiagramEditPart is
>> the target and creates an orphan request. And when it has a command for
>> those, it changes the request to an add request and wants a command from
>> the DiagramEditPart.
>>
>> What am I doing wrong? Is there a way to tell the DragEditPartsTracker
>> that the target is actually the owning connection?
>
> I been intending to do this for a while now.static labels is kinda weak.
> Anyway, is your Label a figure or an editpart? If you want to drag it
> around seperately from the connectioneditPart then it will need to be
> inside its own editpart. That will be my strategy anyway.
>
>
> CL
Re: Move connection label [message #202206 is a reply to message #202183] Mon, 07 November 2005 19:00 Go to previous messageGo to next message
venkataramana m is currently offline venkataramana mFriend
Messages: 86
Registered: July 2009
Member
Felix, if I remember, I referred you to look at the code of a plugin which has connection-label movement facility http://qvtp.org/downloads/qvtp-eclipse/. Didn't that help you to solve your problem ?

Thanks
Venkat
Re: Move connection label [message #202239 is a reply to message #202183] Mon, 07 November 2005 22:03 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Lamont_Gilbert.rigidsoftware.com

Ahh, so you have an editpart that contains your Label, and that
LabelEditPart is the child of the ConnectionEditPart which in turn is a
child of the DiagramEditPart.

Great, thats what I planned to do.





As to your direct situation. Is your DiagramEditPart your drawing so to
speak? and your ConnectionEditPart is ontop of that?

I'm surprised its not working. I Can only imagine your problem is that
your LabelEditPart is not returning a command for the move request. Set
a breakpoint in the LabelEditParts getCommand(Request) method and see
why its not returning an appropriate command. Im my experience, unless
you specifically do something to stop it, the childmost editpart gets
first shot at the command. As long as it is still returning true for
isSelectable() since move first requires selection.

Make sure your LAYOUT_ROLE edit policy is creating a command to move
this child too. I am speaking of the policy in the ConnectionEditPart
since its containing the Label.


CL

Felix L J Mayer wrote:
> Yes, of course I need EditParts for anything that can be touched.
>
> I got it to work by overriding
> ConstrainedLayoutEditPolicy.createAddCommand() in my DiagramEditPart's
> XYLayoutPolicy and returning an empty command.
>
> But this looks a little like a hack to me, I am wondering if there is a
> better way to it.
>
> "CL [dnoyeb] Gilbert" <Lamont_Gilbert@rigidsoftware.com> wrote in message
> news:dkh95d$jdv$1@news.eclipse.org...
>
>>Felix L J Mayer wrote:
>>
>>>I am trying to move a Label that is the child of a connection, so a added
>>>a XYLayoutPolicy to my ConnectionEditPart. But when I try to move the
>>>Label, the DragEditPartsTracker always thinks that the DiagramEditPart is
>>>the target and creates an orphan request. And when it has a command for
>>>those, it changes the request to an add request and wants a command from
>>>the DiagramEditPart.
>>>
>>>What am I doing wrong? Is there a way to tell the DragEditPartsTracker
>>>that the target is actually the owning connection?
>>
>>I been intending to do this for a while now.static labels is kinda weak.
>>Anyway, is your Label a figure or an editpart? If you want to drag it
>>around seperately from the connectioneditPart then it will need to be
>>inside its own editpart. That will be my strategy anyway.
>>
>>
>>CL
>
>
>
Re: Move connection label [message #202260 is a reply to message #202206] Mon, 07 November 2005 22:18 Go to previous message
Felix L J Mayer is currently offline Felix L J MayerFriend
Messages: 202
Registered: July 2009
Senior Member
Thanks, I didn't see that qvtp had moveable labels.
Your solution of overriding DragEditPartsTracker.getTargetEditPart() looks
much simpler.

"venkataramana" <venkataramanam@gmail.com> wrote in message
news:1427389.1131390045319.JavaMail.root@cp1.javalobby.org...
> Felix, if I remember, I referred you to look at the code of a plugin which
> has connection-label movement facility
> http://qvtp.org/downloads/qvtp-eclipse/. Didn't that help you to solve
> your problem ?
>
> Thanks
> Venkat
Previous Topic:Connections start one pixel away from node
Next Topic:Remove model objects or remove visuals?
Goto Forum:
  


Current Time: Thu Sep 26 00:56:45 GMT 2024

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

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

Back to the top