Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » I'm missing something obvious with this whole EditPolicy/Request architecture...
I'm missing something obvious with this whole EditPolicy/Request architecture... [message #118578] Fri, 20 February 2004 16:02 Go to next message
Eclipse UserFriend
Originally posted by: daniel_nospam.enigmatec.net

Hi there,

Say I want to just listen for selection of an EditPart. So I create an
EditPart and register an EditPolicy. For example the following:

protected void createEditPolicies() {

installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new
MyEditPolicy());
}

And then I have my own EditPolicy as follows:

private final class MyEditPolicy extends SelectionEditPolicy {

/* (non-Javadoc)
* @see
org.eclipse.gef.editpolicies.SelectionEditPolicy#hideSelecti on()
*/
protected void hideSelection() {
System.err.println("hideSelection");
// Called when the user clicks away from the assoc message
label
}

/* (non-Javadoc)
* @see
org.eclipse.gef.editpolicies.SelectionEditPolicy#showSelecti on()
*/
protected void showSelection() {
System.err.println("showSelection");
// Called when the user clicks on the assoc message label

}

public Command getCommand(Request request) {

System.err.println("getCommand: " + request.getType());

return [something];
}

}

So hide() and show() are fired as expected... only I want to use
Requests. So I examine them, but the only requests ever fired have a type
of "delete". These are also always GroupRequests. Is there no such thing
as a request of type "selection"? GroupRequest does not provide me with
anything useful for what I want, e.g. location of the mouse pointer.

I've tried different EditPolicies and roles only the same thing, just
"delete" all the time.

Can anyone help here?

Thanks, Dan
Re: I'm missing something obvious with this whole EditPolicy/Request architecture... [message #118732 is a reply to message #118578] Fri, 20 February 2004 20:50 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

What are you trying to do? Selection has nothing to do with mouse location,
you can select with the keyboard.

"Dan Gravell" <daniel_nospam@enigmatec.net> wrote in message
news:Xns9495A3B962C66danielnospamenigmate@204.138.98.10...
> Hi there,
>
> Say I want to just listen for selection of an EditPart. So I create an
> EditPart and register an EditPolicy. For example the following:
>
> protected void createEditPolicies() {
>
> installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new
> MyEditPolicy());
> }
>
> And then I have my own EditPolicy as follows:
>
> private final class MyEditPolicy extends SelectionEditPolicy {
>
> /* (non-Javadoc)
> * @see
> org.eclipse.gef.editpolicies.SelectionEditPolicy#hideSelecti on()
> */
> protected void hideSelection() {
> System.err.println("hideSelection");
> // Called when the user clicks away from the assoc message
> label
> }
>
> /* (non-Javadoc)
> * @see
> org.eclipse.gef.editpolicies.SelectionEditPolicy#showSelecti on()
> */
> protected void showSelection() {
> System.err.println("showSelection");
> // Called when the user clicks on the assoc message label
>
> }
>
> public Command getCommand(Request request) {
>
> System.err.println("getCommand: " + request.getType());
>
> return [something];
> }
>
> }
>
> So hide() and show() are fired as expected... only I want to use
> Requests. So I examine them, but the only requests ever fired have a type
> of "delete". These are also always GroupRequests. Is there no such thing
> as a request of type "selection"? GroupRequest does not provide me with
> anything useful for what I want, e.g. location of the mouse pointer.
>
> I've tried different EditPolicies and roles only the same thing, just
> "delete" all the time.
>
> Can anyone help here?
>
> Thanks, Dan
Re: I'm missing something obvious with this whole EditPolicy/Request architecture... [message #118796 is a reply to message #118732] Sun, 22 February 2004 14:18 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dan.gravellnospam.mochamail.com

All I want is a small clickable icon on the drawing surface of my
editor. Located somewhere near one of my EditParts (actually a
Connection). When the user clicks on the icon they get a popup allowing
them to associate something with the Connection.

What I do now is create the icon as a child EditPart of the Connection.

This would be accomplished ideally with GEF commands for undo/redo
functionality. I thought this could be done with Requests, selecting the
icon (which would be an EditPart I thought) would cause some kind of
request, no?

Thanks, Dan

Randy Hudson wrote:
> What are you trying to do? Selection has nothing to do with mouse location,
> you can select with the keyboard.
>
> "Dan Gravell" <daniel_nospam@enigmatec.net> wrote in message
> news:Xns9495A3B962C66danielnospamenigmate@204.138.98.10...
>
>>Hi there,
>>
>>Say I want to just listen for selection of an EditPart. So I create an
>>EditPart and register an EditPolicy. For example the following:
>>
>>protected void createEditPolicies() {
>>
>>installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new
>>MyEditPolicy());
>>}
>>
>>And then I have my own EditPolicy as follows:
>>
>>private final class MyEditPolicy extends SelectionEditPolicy {
>>
>>/* (non-Javadoc)
>>* @see
>> org.eclipse.gef.editpolicies.SelectionEditPolicy#hideSelecti on()
>>*/
>>protected void hideSelection() {
>>System.err.println("hideSelection");
>>// Called when the user clicks away from the assoc message
>>label
>>}
>>
>>/* (non-Javadoc)
>>* @see
>> org.eclipse.gef.editpolicies.SelectionEditPolicy#showSelecti on()
>>*/
>>protected void showSelection() {
>>System.err.println("showSelection");
>>// Called when the user clicks on the assoc message label
>>
>>}
>>
>>public Command getCommand(Request request) {
>>
>>System.err.println("getCommand: " + request.getType());
>>
>>return [something];
>>}
>>
>>}
>>
>>So hide() and show() are fired as expected... only I want to use
>>Requests. So I examine them, but the only requests ever fired have a type
>>of "delete". These are also always GroupRequests. Is there no such thing
>>as a request of type "selection"? GroupRequest does not provide me with
>>anything useful for what I want, e.g. location of the mouse pointer.
>>
>>I've tried different EditPolicies and roles only the same thing, just
>>"delete" all the time.
>>
>>Can anyone help here?
>>
>>Thanks, Dan
>
>
>
Re: I'm missing something obvious with this whole EditPolicy/Request architecture... [message #119017 is a reply to message #118796] Mon, 23 February 2004 16:39 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

"Dan Gravell" <dan.gravellnospam@mochamail.com> wrote in message
news:c1adgb$6b4$1@eclipse.org...
> All I want is a small clickable icon on the drawing surface of my
> editor. Located somewhere near one of my EditParts (actually a
> Connection). When the user clicks on the icon they get a popup allowing
> them to associate something with the Connection.
>
> What I do now is create the icon as a child EditPart of the Connection.

Can I delete this "child"? Drag it? If not, it could just be a figure
which decorates the PolylineConnection figure.

> This would be accomplished ideally with GEF commands for undo/redo
> functionality. I thought this could be done with Requests, selecting the
> icon (which would be an EditPart I thought) would cause some kind of
> request, no?

If the child is its own editpart, it will receive OPEN and DIRECT_EDIT
requests. But, even if it is NOT an editpart, the connection will receive
these requests, and the connection can compare the request *location* to the
location of the icon figure.

> Thanks, Dan
>
> Randy Hudson wrote:
> > What are you trying to do? Selection has nothing to do with mouse
location,
> > you can select with the keyboard.
> >
> > "Dan Gravell" <daniel_nospam@enigmatec.net> wrote in message
> > news:Xns9495A3B962C66danielnospamenigmate@204.138.98.10...
> >
> >>Hi there,
> >>
> >>Say I want to just listen for selection of an EditPart. So I create an
> >>EditPart and register an EditPolicy. For example the following:
> >>
> >>protected void createEditPolicies() {
> >>
> >>installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new
> >>MyEditPolicy());
> >>}
> >>
> >>And then I have my own EditPolicy as follows:
> >>
> >>private final class MyEditPolicy extends SelectionEditPolicy {
> >>
> >>/* (non-Javadoc)
> >>* @see
> >> org.eclipse.gef.editpolicies.SelectionEditPolicy#hideSelecti on()
> >>*/
> >>protected void hideSelection() {
> >>System.err.println("hideSelection");
> >>// Called when the user clicks away from the assoc message
> >>label
> >>}
> >>
> >>/* (non-Javadoc)
> >>* @see
> >> org.eclipse.gef.editpolicies.SelectionEditPolicy#showSelecti on()
> >>*/
> >>protected void showSelection() {
> >>System.err.println("showSelection");
> >>// Called when the user clicks on the assoc message label
> >>
> >>}
> >>
> >>public Command getCommand(Request request) {
> >>
> >>System.err.println("getCommand: " + request.getType());
> >>
> >>return [something];
> >>}
> >>
> >>}
> >>
> >>So hide() and show() are fired as expected... only I want to use
> >>Requests. So I examine them, but the only requests ever fired have a
type
> >>of "delete". These are also always GroupRequests. Is there no such thing
> >>as a request of type "selection"? GroupRequest does not provide me with
> >>anything useful for what I want, e.g. location of the mouse pointer.
> >>
> >>I've tried different EditPolicies and roles only the same thing, just
> >>"delete" all the time.
> >>
> >>Can anyone help here?
> >>
> >>Thanks, Dan
> >
> >
> >
>
Re: I'm missing something obvious with this whole EditPolicy/Request architecture... [message #119214 is a reply to message #119017] Tue, 24 February 2004 08:50 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dan.gravellnospam.enigmatec.net

Well that's the problem. I don't get OPEN or DIRECT_EDIT requests, just
GroupRequests with type "delete". I think the editor must be configured
incorrectly somewhere (this is an existing codebase I'm working on here).

Thanks, Dan

Randy Hudson wrote:

> "Dan Gravell" <dan.gravellnospam@mochamail.com> wrote in message
> news:c1adgb$6b4$1@eclipse.org...
>
>>All I want is a small clickable icon on the drawing surface of my
>>editor. Located somewhere near one of my EditParts (actually a
>>Connection). When the user clicks on the icon they get a popup allowing
>>them to associate something with the Connection.
>>
>>What I do now is create the icon as a child EditPart of the Connection.
>
>
> Can I delete this "child"? Drag it? If not, it could just be a figure
> which decorates the PolylineConnection figure.
>
>
>>This would be accomplished ideally with GEF commands for undo/redo
>>functionality. I thought this could be done with Requests, selecting the
>>icon (which would be an EditPart I thought) would cause some kind of
>>request, no?
>
>
> If the child is its own editpart, it will receive OPEN and DIRECT_EDIT
> requests. But, even if it is NOT an editpart, the connection will receive
> these requests, and the connection can compare the request *location* to the
> location of the icon figure.
>
>
>>Thanks, Dan
>>
>>Randy Hudson wrote:
>>
>>>What are you trying to do? Selection has nothing to do with mouse
>
> location,
>
>>>you can select with the keyboard.
>>>
>>>"Dan Gravell" <daniel_nospam@enigmatec.net> wrote in message
>>>news:Xns9495A3B962C66danielnospamenigmate@204.138.98.10...
>>>
>>>
>>>>Hi there,
>>>>
>>>>Say I want to just listen for selection of an EditPart. So I create an
>>>>EditPart and register an EditPolicy. For example the following:
>>>>
>>>>protected void createEditPolicies() {
>>>>
>>>>installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new
>>>>MyEditPolicy());
>>>>}
>>>>
>>>>And then I have my own EditPolicy as follows:
>>>>
>>>>private final class MyEditPolicy extends SelectionEditPolicy {
>>>>
>>>>/* (non-Javadoc)
>>>>* @see
>>>> org.eclipse.gef.editpolicies.SelectionEditPolicy#hideSelecti on()
>>>>*/
>>>>protected void hideSelection() {
>>>>System.err.println("hideSelection");
>>>>// Called when the user clicks away from the assoc message
>>>>label
>>>>}
>>>>
>>>>/* (non-Javadoc)
>>>>* @see
>>>> org.eclipse.gef.editpolicies.SelectionEditPolicy#showSelecti on()
>>>>*/
>>>>protected void showSelection() {
>>>>System.err.println("showSelection");
>>>>// Called when the user clicks on the assoc message label
>>>>
>>>>}
>>>>
>>>>public Command getCommand(Request request) {
>>>>
>>>>System.err.println("getCommand: " + request.getType());
>>>>
>>>>return [something];
>>>>}
>>>>
>>>>}
>>>>
>>>>So hide() and show() are fired as expected... only I want to use
>>>>Requests. So I examine them, but the only requests ever fired have a
>
> type
>
>>>>of "delete". These are also always GroupRequests. Is there no such thing
>>>>as a request of type "selection"? GroupRequest does not provide me with
>>>>anything useful for what I want, e.g. location of the mouse pointer.
>>>>
>>>>I've tried different EditPolicies and roles only the same thing, just
>>>>"delete" all the time.
>>>>
>>>>Can anyone help here?
>>>>
>>>>Thanks, Dan
>>>
>>>
>>>
>
>
Re: I'm missing something obvious with this whole EditPolicy/Request architecture... [message #119333 is a reply to message #119214] Tue, 24 February 2004 19:05 Go to previous message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

This is working fine for me. performRequest is called with both types of
requests for wires in the logic example.

"Dan Gravell" <dan.gravellnospam@enigmatec.net> wrote in message
news:c1f32n$em8$1@eclipse.org...
> Well that's the problem. I don't get OPEN or DIRECT_EDIT requests, just
> GroupRequests with type "delete". I think the editor must be configured
> incorrectly somewhere (this is an existing codebase I'm working on here).
>
> Thanks, Dan
>
> Randy Hudson wrote:
>
> > "Dan Gravell" <dan.gravellnospam@mochamail.com> wrote in message
> > news:c1adgb$6b4$1@eclipse.org...
> >
> >>All I want is a small clickable icon on the drawing surface of my
> >>editor. Located somewhere near one of my EditParts (actually a
> >>Connection). When the user clicks on the icon they get a popup allowing
> >>them to associate something with the Connection.
> >>
> >>What I do now is create the icon as a child EditPart of the Connection.
> >
> >
> > Can I delete this "child"? Drag it? If not, it could just be a figure
> > which decorates the PolylineConnection figure.
> >
> >
> >>This would be accomplished ideally with GEF commands for undo/redo
> >>functionality. I thought this could be done with Requests, selecting the
> >>icon (which would be an EditPart I thought) would cause some kind of
> >>request, no?
> >
> >
> > If the child is its own editpart, it will receive OPEN and DIRECT_EDIT
> > requests. But, even if it is NOT an editpart, the connection will
receive
> > these requests, and the connection can compare the request *location* to
the
> > location of the icon figure.
> >
> >
> >>Thanks, Dan
> >>
> >>Randy Hudson wrote:
> >>
> >>>What are you trying to do? Selection has nothing to do with mouse
> >
> > location,
> >
> >>>you can select with the keyboard.
> >>>
> >>>"Dan Gravell" <daniel_nospam@enigmatec.net> wrote in message
> >>>news:Xns9495A3B962C66danielnospamenigmate@204.138.98.10...
> >>>
> >>>
> >>>>Hi there,
> >>>>
> >>>>Say I want to just listen for selection of an EditPart. So I create an
> >>>>EditPart and register an EditPolicy. For example the following:
> >>>>
> >>>>protected void createEditPolicies() {
> >>>>
> >>>>installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new
> >>>>MyEditPolicy());
> >>>>}
> >>>>
> >>>>And then I have my own EditPolicy as follows:
> >>>>
> >>>>private final class MyEditPolicy extends SelectionEditPolicy {
> >>>>
> >>>>/* (non-Javadoc)
> >>>>* @see
> >>>> org.eclipse.gef.editpolicies.SelectionEditPolicy#hideSelecti on()
> >>>>*/
> >>>>protected void hideSelection() {
> >>>>System.err.println("hideSelection");
> >>>>// Called when the user clicks away from the assoc message
> >>>>label
> >>>>}
> >>>>
> >>>>/* (non-Javadoc)
> >>>>* @see
> >>>> org.eclipse.gef.editpolicies.SelectionEditPolicy#showSelecti on()
> >>>>*/
> >>>>protected void showSelection() {
> >>>>System.err.println("showSelection");
> >>>>// Called when the user clicks on the assoc message label
> >>>>
> >>>>}
> >>>>
> >>>>public Command getCommand(Request request) {
> >>>>
> >>>>System.err.println("getCommand: " + request.getType());
> >>>>
> >>>>return [something];
> >>>>}
> >>>>
> >>>>}
> >>>>
> >>>>So hide() and show() are fired as expected... only I want to use
> >>>>Requests. So I examine them, but the only requests ever fired have a
> >
> > type
> >
> >>>>of "delete". These are also always GroupRequests. Is there no such
thing
> >>>>as a request of type "selection"? GroupRequest does not provide me
with
> >>>>anything useful for what I want, e.g. location of the mouse pointer.
> >>>>
> >>>>I've tried different EditPolicies and roles only the same thing, just
> >>>>"delete" all the time.
> >>>>
> >>>>Can anyone help here?
> >>>>
> >>>>Thanks, Dan
> >>>
> >>>
> >>>
> >
> >
Previous Topic:Calculate the best connection anchor
Next Topic:What is the best place to set a reference creation Request's factory?
Goto Forum:
  


Current Time: Sat Jul 27 16:43:32 GMT 2024

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

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

Back to the top