Home » Eclipse Projects » GEF » [Draw2D] Suggestions for implementing a non-right click popup
[Draw2D] Suggestions for implementing a non-right click popup [message #118245] |
Wed, 18 February 2004 06:01  |
Eclipse User |
|
|
|
Originally posted by: daniel_nospam.enigmatec.net
Hi there,
I'd like to implement a popup within Draw2D that is activated when I click
on a certain label (text or image). I'd like it to be similar in appearance
to the content assist style popups you get in the JDT.
So far I've been successful in displaying the popup but implementing
similar functionality (e.g. hide when click away from the popup) remains
elusive.
I've tried implementing this as a figure, but I don't know how to grab the
focus and make it disappear when the user clicks away.
I've tried implementing this as a swt shell, but when I popup the window
the focus is lost immediately.
Any ideas on how to do this?
Ta, Dan
|
|
| |
Re: [Draw2D] Suggestions for implementing a non-right click popup [message #118316 is a reply to message #118287] |
Wed, 18 February 2004 13:16   |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
> TBH, looking into this further I'd be grateful if someone could outline
the
> general mechanism toward providing "actions" on the actual GEF display
> which can be selected and potentially cause changes to the model.
Obviously
> these "actions" are not part of the model themselves, so should they be
> EditParts?
Actions are just actions. You fire them, and they do something. Frequently
in GEF the action implementation goes to the selected editpart(s) and asks
for commands so that the action is undoable. But, I'm not sure
content-assist-like behavior has much in common with actions.
>
> Currently this has been implemented by MouseListening etc on the Figure
and
> clearly that is not the proper way!
Right, you should be using mouse listeners on the figure. Tools and
requests are the way to go, and we already send REQ_DIRECT_EDIT and REQ_OPEN
to editparts when they are single and double clicked.
>
> > I've tried implementing this as a swt shell, but when I popup the
> > window the focus is lost immediately.
A popup shell is the best way to do this probably. The Java content
proprosal popup thingy is open source, so go take a look at their code. I'm
guessing they are doing focus tricks including setting styles on the shell
like NO_TRIM.
> >
> > Any ideas on how to do this?
> >
> > Ta, Dan
>
|
|
|
Re: [Draw2D] Suggestions for implementing a non-right click popup [message #118412 is a reply to message #118316] |
Thu, 19 February 2004 09:07   |
Eclipse User |
|
|
|
Originally posted by: daniel_nospam.enigmatec.net
Thanks for your reply Randy, I'm most grateful. I tried playing around
with requests and things but didn't get far. All I seem to get are delete
requests, when the connection is selected! I don't get any direct edit
requests and the like.
I'm not sure really how to start on this being a GEF newbie. Perhaps it'd
be better to decribe what I'm trying to achieve.
I have two nodes connected. The user wants to associate something with
this connection. Beforehand we were popping up a context menu, letting
the user click an option, loading a dialog and then choosing from there.
What I _want_ to do is have the "associate" be a Label (i.e. an image) on
the actual drawing surface itself next to the connection. When the user
clicks a floating "window" appears with the choices otherwise shown in
the aforementioned dialog, this could be a NO_TRIM shell or a new GEF
component of some kind.
I guess I'd really like to know basically how this would be structured in
respect to EditParts. What should be one and what shouldn't be? Should
the label be wrapped by a separate EditPart? When is this created? I
guess the popup, if better implemented as an SWT shell, kinda steps out
of this conversation.
Many thanks, Dan
"Randy Hudson" <none@us.ibm.com> wrote in news:c109vg$do0$1@eclipse.org:
>> TBH, looking into this further I'd be grateful if someone could
>> outline
> the
>> general mechanism toward providing "actions" on the actual GEF
>> display which can be selected and potentially cause changes to the
>> model.
> Obviously
>> these "actions" are not part of the model themselves, so should they
>> be EditParts?
>
> Actions are just actions. You fire them, and they do something.
> Frequently in GEF the action implementation goes to the selected
> editpart(s) and asks for commands so that the action is undoable.
> But, I'm not sure content-assist-like behavior has much in common with
> actions.
>>
>> Currently this has been implemented by MouseListening etc on the
>> Figure
> and
>> clearly that is not the proper way!
> Right, you should be using mouse listeners on the figure. Tools and
> requests are the way to go, and we already send REQ_DIRECT_EDIT and
> REQ_OPEN to editparts when they are single and double clicked.
>>
>
>> > I've tried implementing this as a swt shell, but when I popup the
>> > window the focus is lost immediately.
>
> A popup shell is the best way to do this probably. The Java content
> proprosal popup thingy is open source, so go take a look at their
> code. I'm guessing they are doing focus tricks including setting
> styles on the shell like NO_TRIM.
>
>> >
>> > Any ideas on how to do this?
>> >
>> > Ta, Dan
>>
>
>
|
|
|
Re: [Draw2D] Suggestions for implementing a non-right click popup [message #118965 is a reply to message #118412] |
Mon, 23 February 2004 11:28  |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
AbstractConnectionEditPart returns a SelectEditPartTracker, which WILL send
both:
performRequest(REQ_OPEN) and
performRequest(REQ_DIRECT_EDIT)
You should probably be using a DirectEditManager to place a ComboCellEditor
on the diagram. There is probably not a reason to use a popup shell unless
you have clipping issues, but you should be able to scroll the diagram so
that the celleditor can be seen. Just because you are using a
directeditmanager, doesn't mean you can't trigger the editing using any
mechanism you want.
"Dan Gravell" <daniel_nospam@enigmatec.net> wrote in message
news:Xns9494903952BCdanielnospamenigmate@204.138.98.10...
> Thanks for your reply Randy, I'm most grateful. I tried playing around
> with requests and things but didn't get far. All I seem to get are delete
> requests, when the connection is selected! I don't get any direct edit
> requests and the like.
>
> I'm not sure really how to start on this being a GEF newbie. Perhaps it'd
> be better to decribe what I'm trying to achieve.
>
> I have two nodes connected. The user wants to associate something with
> this connection. Beforehand we were popping up a context menu, letting
> the user click an option, loading a dialog and then choosing from there.
>
> What I _want_ to do is have the "associate" be a Label (i.e. an image) on
> the actual drawing surface itself next to the connection. When the user
> clicks a floating "window" appears with the choices otherwise shown in
> the aforementioned dialog, this could be a NO_TRIM shell or a new GEF
> component of some kind.
>
> I guess I'd really like to know basically how this would be structured in
> respect to EditParts. What should be one and what shouldn't be? Should
> the label be wrapped by a separate EditPart? When is this created? I
> guess the popup, if better implemented as an SWT shell, kinda steps out
> of this conversation.
>
> Many thanks, Dan
>
> "Randy Hudson" <none@us.ibm.com> wrote in news:c109vg$do0$1@eclipse.org:
>
> >> TBH, looking into this further I'd be grateful if someone could
> >> outline
> > the
> >> general mechanism toward providing "actions" on the actual GEF
> >> display which can be selected and potentially cause changes to the
> >> model.
> > Obviously
> >> these "actions" are not part of the model themselves, so should they
> >> be EditParts?
> >
> > Actions are just actions. You fire them, and they do something.
> > Frequently in GEF the action implementation goes to the selected
> > editpart(s) and asks for commands so that the action is undoable.
> > But, I'm not sure content-assist-like behavior has much in common with
> > actions.
> >>
> >> Currently this has been implemented by MouseListening etc on the
> >> Figure
> > and
> >> clearly that is not the proper way!
> > Right, you should be using mouse listeners on the figure. Tools and
> > requests are the way to go, and we already send REQ_DIRECT_EDIT and
> > REQ_OPEN to editparts when they are single and double clicked.
> >>
> >
> >> > I've tried implementing this as a swt shell, but when I popup the
> >> > window the focus is lost immediately.
> >
> > A popup shell is the best way to do this probably. The Java content
> > proprosal popup thingy is open source, so go take a look at their
> > code. I'm guessing they are doing focus tricks including setting
> > styles on the shell like NO_TRIM.
> >
> >> >
> >> > Any ideas on how to do this?
> >> >
> >> > Ta, Dan
> >>
> >
> >
>
|
|
|
Goto Forum:
Current Time: Wed Jul 23 19:31:40 EDT 2025
Powered by FUDForum. Page generated in 0.03435 seconds
|