directedit and connection [message #133811] |
Mon, 24 May 2004 07:32  |
Eclipse User |
|
|
|
Originally posted by: m.hassenforder.uha.fr
hello,
a little question about connection.
I have a connection and around it some labels.
I use the same pattern (special Locater) as that described in the
article "Display a UML Diagram using Draw2D".
Now I am faced with the DirectEdit problem.
The editPart subscribes one and only one DIRECTEDIT request but I have
find the right label (one over about not less than 5)) according to the
mouse click.
Who have to make such a lookup (me or GEF ...). I guess it is my job,
but where is the best place ?
thanks in advance
|
|
|
|
|
|
Re: directedit and connection [message #134375 is a reply to message #134180] |
Wed, 26 May 2004 03:25   |
Eclipse User |
|
|
|
Originally posted by: m.hassenforder.uha.fr
hello,
Just for information, I have not less than 5 labels inside the
connection. So have too make something good not just a hack, and that is
my problem.
I forward the point obtained by the request.getLocation() to the figure
which calls the findFigure method and I obtain the good Label.
But now I am faced with another problems :
how to update the underlying label during direct edition (using
showCurrentEditValue of the directEditPolicy). The Figure knows about
the different labels (it create them), and knows about the association
String/Figure. The editPart knows about string but nothing about labels
(it job is to forward the string to the connection which convert it into
a label) and the association String/label is made internally by the
figure. I am not sure if I am clear : but currently to find the label to
update I have to lookup the figure associated to the editPart associated
to the policy. This is not really nice. If I break something, the
editpart has too much knowledges about the internals of the figure. This
is my first dilemna.
how to update the string in the model. I have 1 method per string to
update in the model. Another time, I have to lookup the label which is
in the figure to find the good method. This is not nice too.
If I remember the directEditRequest has a feature field which could be
used for such a problem, but nobody set it (in 2.1.x). But two
DirectEditRequest are created : one to initiate the directEdit and one
to terminate the directEdit. This is not cool as I have to copy the
feature field between the two creations, and it looks like a hack.
I hope I have clearly explained the problem.
Randy Hudson wrote:
> Sorry. In general we have no idea which figures you are using for your
> graphical editpart, or how many properties are direct-editable.
>
> "Hassenforder" <m.hassenforder@uha.fr> wrote in message
> news:c8upod$uru$1@eclipse.org...
>
>>hello randy,
>>
>>thank you for the reply, but I hope that GEF do it automaticly for me.
>>
>>I will implement such a solution.
>>
>>
>>Randy Hudson wrote:
>>
>>
>>>The request will contain the mouse location in absolute coordinates.
>
> All
>
>>>you have to do is hit-test the different labels to figure out which one
>
> to
>
>>>edit.
>>>
>>>label.translateToRelative(copyOfPoint);
>>>if (label.containsPoint(copyOfPoint))
>>> //edit the label
>>>
>>>"Hassenforder" <m.hassenforder@uha.fr> wrote in message
>>>news:c8sm1j$sge$1@eclipse.org...
>>>
>>>
>>>>hello,
>>>>
>>>>a little question about connection.
>>>>I have a connection and around it some labels.
>>>>I use the same pattern (special Locater) as that described in the
>>>>article "Display a UML Diagram using Draw2D".
>>>>Now I am faced with the DirectEdit problem.
>>>>The editPart subscribes one and only one DIRECTEDIT request but I have
>>>>find the right label (one over about not less than 5)) according to the
>>>>mouse click.
>>>>
>>>>Who have to make such a lookup (me or GEF ...). I guess it is my job,
>>>>but where is the best place ?
>>>>
>>>>thanks in advance
>>>>
>>>
>>>
>>>
>
>
|
|
|
Re: directedit and connection [message #135233 is a reply to message #134375] |
Mon, 31 May 2004 21:04   |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
"Hassenforder" <m.hassenforder@uha.fr> wrote in message
news:c91ga5$4dl$1@eclipse.org...
> hello,
>
> Just for information, I have not less than 5 labels inside the
> connection. So have too make something good not just a hack, and that is
> my problem.
>
> I forward the point obtained by the request.getLocation() to the figure
> which calls the findFigure method and I obtain the good Label.
>
> But now I am faced with another problems :
>
> how to update the underlying label during direct edition (using
> showCurrentEditValue of the directEditPolicy). The Figure knows about
> the different labels (it create them), and knows about the association
> String/Figure. The editPart knows about string but nothing about labels
> (it job is to forward the string to the connection which convert it into
> a label) and the association String/label is made internally by the
> figure.
Ok, great separation. So the connection figure needs to provide more
services to the editpart. Add some more API for the editpart to use. Such
as getLabelPropertyAt(Point).
> I am not sure if I am clear : but currently to find the label to
> update I have to lookup the figure associated to the editPart associated
> to the policy. This is not really nice. If I break something, the
> editpart has too much knowledges about the internals of the figure. This
> is my first dilemna.
> how to update the string in the model. I have 1 method per string to
> update in the model. Another time, I have to lookup the label which is
> in the figure to find the good method. This is not nice too.
>
> If I remember the directEditRequest has a feature field which could be
> used for such a problem, but nobody set it (in 2.1.x). But two
> DirectEditRequest are created : one to initiate the directEdit and one
> to terminate the directEdit. This is not cool as I have to copy the
> feature field between the two creations, and it looks like a hack.
Yes, there is a discriminator field on the direct edit request for these
purposes. If it doesn't work, open a bugzilla.
>
> I hope I have clearly explained the problem.
>
> Randy Hudson wrote:
> > Sorry. In general we have no idea which figures you are using for your
> > graphical editpart, or how many properties are direct-editable.
> >
> > "Hassenforder" <m.hassenforder@uha.fr> wrote in message
> > news:c8upod$uru$1@eclipse.org...
> >
> >>hello randy,
> >>
> >>thank you for the reply, but I hope that GEF do it automaticly for me.
> >>
> >>I will implement such a solution.
> >>
> >>
> >>Randy Hudson wrote:
> >>
> >>
> >>>The request will contain the mouse location in absolute coordinates.
> >
> > All
> >
> >>>you have to do is hit-test the different labels to figure out which one
> >
> > to
> >
....
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04299 seconds