|
|
|
Re: Handling REQ_OPEN requests [message #164886 is a reply to message #164858] |
Fri, 21 January 2005 01:34 |
Brian Fernandes Messages: 68 Registered: July 2009 |
Member |
|
|
Nick,
You're right about the Role being a Unique Identifier.
What I was trying to say is that you would rather use GEF roles as they
are defined in the documentation along with their corresponding edit
policies. If you want to do something different, I suggest you define your
own role. (Which just boils down to another string)
I'm not too sure why your policy didn't get called; perhaps because
something else intercepted the request and handled it.
What you want to do seems just right for overriding performRequest. None
of the predefined roles fit your requirement, so I would go ahead and use
it.
The GEF documentation will give you a list of the Roles and the
EditPolicies usually associated with them. The EditPolicy section is quite
informative on the requests they handle & should give you an idea of when
to use EditPolicies. Personally, I have always used EditPolicies except
for when I need to detect and process a double click, wher I override
PerformRequest.
I'm sorry I can't be more insightful :)
Brian.
Nick Lerissa wrote:
> Thanks Brian,
> Based on your response I need clarification on a couple of points:
> "Brian Fernandes" <brian.fernandes@genuitec.com> wrote in message
> news:csovsf$827$1@www.eclipse.org...
>> Nick,
>> The GRAPHICAL_NODE_ROLE is used to create connections from / to your
>> EditPart, which is probably why you aren't seeing any delegation
>> happening.
> I thought that the String indentifying the role was just used to uniquely
> identify the role. Isn't
> every EditPolicy called to determine if a can provide a Command for a given
> Request.
>>
>> What exactly do you wish to achieve?
> The nodes on our canvas can be expanded and collapsed. What I want to
> achieve is the following:
> - User double clicks on a node to see a more detailed info
> - The model for the node is notified it needs to get more detailed
> information
> - The view is updated to show the detailed info
>>
>> You can simply override performRequest in your EditPart directly without
>> an EditPolicy and handle REQ_OPEN requests.
>>
>> Something like
>>
>> public void performRequest(Request req) {
>> super.performRequest(req);
>> if (!(req.getType() == RequestConstants.REQ_OPEN)) return; ....
>> }
> From reading the documentation, I thought the correct way to do this was to
> use EditPolicies and Commands
> and overriding EditPart.performRequest was a last resort way of doing this.
> I'm unclear when to use EditPolicies
> and when to override performRequest.
> Thanks,
> Nick
|
|
|
|
Powered by
FUDForum. Page generated in 0.03190 seconds