Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » directedit and connection
directedit and connection [message #133811] Mon, 24 May 2004 11:32 Go to next message
Eclipse UserFriend
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 #133944 is a reply to message #133811] Tue, 25 May 2004 03:42 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

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 #134044 is a reply to message #133944] Tue, 25 May 2004 06:47 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: m.hassenforder.uha.fr

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 #134180 is a reply to message #134044] Tue, 25 May 2004 20:48 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

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 #134375 is a reply to message #134180] Wed, 26 May 2004 07:25 Go to previous messageGo to next message
Eclipse UserFriend
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] Tue, 01 June 2004 01:04 Go to previous messageGo to next message
Eclipse UserFriend
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
> >
....
Re: directedit and connection [message #153638 is a reply to message #135233] Mon, 11 October 2004 17:35 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: usenet.jevopi.de

On 2004-06-01 03:04:56 +0200, "Randy Hudson" <none@us.ibm.com> said:

> "Hassenforder" <m.hassenforder@uha.fr> wrote in message
> news:c91ga5$4dl$1@eclipse.org...
>> 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've runned into the same problem: two request instances and the
feature field is not copied between them (by GEF).
I didn't found a bug report in bugzilla – should there be one? Or
should the feature field be copied by my application somewhere? If yes
– where?

I assume that this problem always occurs if one figure/editpart has
more than one "editable" label, doesn't it?

Jens
Re: directedit and connection [message #153677 is a reply to message #153638] Mon, 11 October 2004 18:57 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

Open a bugzilla. The workaround is to override createDirectEditRequest()
and set the feature.

"Jens v. P." <usenet@jevopi.de> wrote in message
news:ckeg0b$c51$1@eclipse.org...
> On 2004-06-01 03:04:56 +0200, "Randy Hudson" <none@us.ibm.com> said:
>
> > "Hassenforder" <m.hassenforder@uha.fr> wrote in message
> > news:c91ga5$4dl$1@eclipse.org...
> >> 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've runned into the same problem: two request instances and the
> feature field is not copied between them (by GEF).
> I didn't found a bug report in bugzilla - should there be one? Or
> should the feature field be copied by my application somewhere? If yes
> - where?
>
> I assume that this problem always occurs if one figure/editpart has
> more than one "editable" label, doesn't it?
>
> Jens
>
>
Re: directedit and connection [message #153684 is a reply to message #153677] Mon, 11 October 2004 20:31 Go to previous message
Eclipse UserFriend
Originally posted by: usenet.jevopi.de

On 2004-10-11 20:57:18 +0200, "Randy Hudson" <none@us.ibm.com> said:

> Open a bugzilla. The workaround is to override createDirectEditRequest()
> and set the feature.


Bugzilla Bug 76044 added.

Jens
Previous Topic:"Shapes" Example now available in Integration builds
Next Topic:visual feedback during connection creation
Goto Forum:
  


Current Time: Fri Apr 26 00:47:49 GMT 2024

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

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

Back to the top