Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Handler doesn't work when it I make it to extend some class
Handler doesn't work when it I make it to extend some class [message #491359] Wed, 14 October 2009 10:19 Go to next message
Prasanna K is currently offline Prasanna K
Messages: 78
Registered: July 2009
Member
Hi all,

I have placed a command on a view's toolbar.
I have implemented org.eclipse.core.commands.IHandler and provided it as the handler for the command and it works fine.
But this handler class should extend some other class.
As long as I keep this handler not-extended it all works fine.
But when it extends some other class the handler doesn't work.
As in no code in execute gets called.

How can I overcome this?
Is it not possible to make handler to extend some class and implement IHandler and use it as event handler for some command?

Thanks.
Re: Handler doesn't work when it I make it to extend some class [message #491371 is a reply to message #491359] Wed, 14 October 2009 11:23 Go to previous messageGo to next message
Prakash G.R. is currently offline Prakash G.R.
Messages: 621
Registered: July 2009
Senior Member
kaprasi wrote:
> As long as I keep this handler not-extended it all works fine.
> But when it extends some other class the handler doesn't work.

Any stack trace in the Error Log?

- Prakash

Platform UI Team, IBM
http://blog.eclipse-tips.com
Re: Handler doesn't work when it I make it to extend some class [message #491373 is a reply to message #491371] Wed, 14 October 2009 11:42 Go to previous messageGo to next message
Prasanna K is currently offline Prasanna K
Messages: 78
Registered: July 2009
Member
Hi Prakash,

Here is the stack trace : http://pastebin.ca/1619123

The problem was this : Parent class from which I was trying to extend the handler didn't have a zero argument constructor.
After I added it, the execute method gets executed.

There are still questions though : Can I instantiate this handler class (extending some existing class) somewhere else in my plug-in?

Thanks.
Re: Handler doesn't work when it I make it to extend some class [message #491376 is a reply to message #491373] Wed, 14 October 2009 11:53 Go to previous messageGo to next message
Prakash G.R. is currently offline Prakash G.R.
Messages: 621
Registered: July 2009
Senior Member
kaprasi wrote:
> The problem was this : Parent class from which I was trying to extend
> the handler didn't have a zero argument constructor.
> After I added it, the execute method gets executed.

You are not alone.
http://blog.eclipse-tips.com/2009/01/top-10-mistakes-in-ecli pse-plug-in.html
:-)

> There are still questions though : Can I instantiate this handler class
> (extending some existing class) somewhere else in my plug-in?

Yes. But do not call the IHandler methods on that class directly.

- Prakash

Platform UI Team, IBM
http://blog.eclipse-tips.com
Re: Handler doesn't work when it I make it to extend some class [message #491405 is a reply to message #491376] Wed, 14 October 2009 13:06 Go to previous messageGo to next message
Prasanna K is currently offline Prasanna K
Messages: 78
Registered: July 2009
Member
Hi Prakash,

Thanks so much. It helped.
Re: Handler doesn't work when it I make it to extend some class [message #491420 is a reply to message #491373] Wed, 14 October 2009 13:31 Go to previous message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

kaprasi wrote on Wed, 14 October 2009 07:42
Hi Prakash,

Here is the stack trace : http://pastebin.ca/1619123

The problem was this : Parent class from which I was trying to extend the handler didn't have a zero argument constructor.
After I added it, the execute method gets executed.

There are still questions though : Can I instantiate this handler class (extending some existing class) somewhere else in my plug-in?



As an aside, you can manage the objects that are instantiated from extensions (i.e. a "class" attribute) yourself, presuming you follow the API:

org.eclipse.core.runtime.IConfigurationElement.createExecuta bleExtension(String)
org.eclipse.core.runtime.IExecutableExtensionFactory

PW


Previous Topic:[CVS] file has been added but not commited
Next Topic:Resource conflicting rule
Goto Forum:
  


Current Time: Wed Sep 17 09:52:50 GMT 2014

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

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