|
Re: What editpolicy shall I use to get double click message? & what's wrong with my code? [message #197496 is a reply to message #197473] |
Tue, 04 October 2005 07:04 |
Eclipse User |
|
|
|
Originally posted by: ingo.koch[nospam].sap.com
Hi Vince,
you have to catch the open-request in your editpart by overriding
public void performRequest(Request request).
Then you could pass the request to one of
editpolicy to have them do the request-command-handling.
regards, Ingo
"vince" <fiustudent@hotmail.com> wrote in message
news:dhs740$ofr$1@news.eclipse.org...
> Hi, all,
>
> What editpolicy shall I use to get double click message?
> I have read the help doc and couldn't find such editpolicy, so I write my
> own DoubleClickEditPolicy.java as below
>
> public abstract class DoubleClickEditPolicy
> extends AbstractEditPolicy
> {
> protected Command createOpenCommand(GroupRequest request) {
> return null;
> }
>
> public Command getCommand(GroupRequest request) {
>
>
> //According to the documents, every EditPolicy will receive every message,
> // and they just deal with what they are interested in.
> //So I expect to see what the variable "request" is by setting up
> breakpoint here when debugging.
> //However, actually, it didn't stop, which quitely confused me.
> //What's wrong with my understanding?
> //And what's the right way to catch double click message? Thank you!
>
> if (REQ_OPEN.equals(request.getType()))
> return getOpenCommand(request);
> return null;
> }
>
> protected Command getOpenCommand(GroupRequest request) {
> return createOpenCommand(request);
> }
>
> }
>
>
|
|
|
Re: What editpolicy shall I use to get double click message? & what's wrong with my code? [message #197664 is a reply to message #197496] |
Wed, 05 October 2005 01:44 |
victor fiu Messages: 37 Registered: July 2009 |
Member |
|
|
It works! Thank you very much!
However, it remains something that I don't understand.
That is, why I can't catch open-request by installing my EditPolicy
(compared to delete-request catched if ComponentEditPolicy is installed)? I
read the source code of AbstractEditPart, it does with every installed
EditPolicy:
public Command getCommand(Request request) {
Command command = null;
EditPolicyIterator i = getEditPolicyIterator();
while (i.hasNext()) {
if (command != null)
command = command.chain(i.next().
getCommand(request));
else
command = i.next().
getCommand(request);
}
return command;
}
I could get more information by debugging, but the method is called too
often. So I would be very appreciated if someone happens to know does GEF
have different policies with open-request or not?
Regards,
Vince
"Ingo Koch" <ingo.koch[nospam]@sap.com> wrote in message
news:dht9ir$1l0$1@news.eclipse.org...
> Hi Vince,
>
> you have to catch the open-request in your editpart by overriding
> public void performRequest(Request request).
> Then you could pass the request to one of
> editpolicy to have them do the request-command-handling.
>
> regards, Ingo
>
>
> "vince" <fiustudent@hotmail.com> wrote in message
> news:dhs740$ofr$1@news.eclipse.org...
>> Hi, all,
>>
>> What editpolicy shall I use to get double click message?
>> I have read the help doc and couldn't find such editpolicy, so I write my
>> own DoubleClickEditPolicy.java as below
>>
>> public abstract class DoubleClickEditPolicy
>> extends AbstractEditPolicy
>> {
>> protected Command createOpenCommand(GroupRequest request) {
>> return null;
>> }
>>
>> public Command getCommand(GroupRequest request) {
>>
>>
>> //According to the documents, every EditPolicy will receive every
>> message,
>> // and they just deal with what they are interested in.
>> //So I expect to see what the variable "request" is by setting up
>> breakpoint here when debugging.
>> //However, actually, it didn't stop, which quitely confused me.
>> //What's wrong with my understanding?
>> //And what's the right way to catch double click message? Thank you!
>>
>> if (REQ_OPEN.equals(request.getType()))
>> return getOpenCommand(request);
>> return null;
>> }
>>
>> protected Command getOpenCommand(GroupRequest request) {
>> return createOpenCommand(request);
>> }
>>
>> }
>>
>>
>
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.03108 seconds