"the chosen operation is not enabled" for Add to Favorites

Tell us what you think about our book and report any errata. Sample chapters are available at http://www.qualityeclipse.com/

(Note: Previous Editions were called "Eclipse: Building Commercial Quality Plugins")

Moderators: Eric Clayberg, Dan Rubel

"the chosen operation is not enabled" for Add to Favorites

Postby mlorenz » Thu Nov 20, 2008 1:33 pm

When I launch the Favorites plugin, select a Java file and choose Favorites>Add, I get the subject error message. I've checked the .log file and don't see any error. Ideas of what I can look at to resolve this? Thanks! Mark
mlorenz
 
Posts: 1
Joined: Thu Nov 20, 2008 1:27 pm

Re: "the chosen operation is not enabled" for Add to Favorites

Postby bgruenba » Tue Jan 06, 2009 12:38 pm

Is this your own code or the book's version of the code? I ran into a similar problem working through the Commands section in Chapter 6 of the third edition of the book. I specifically mention that because it is different in the first and second editions. Here is what I wrote in an e-mail on this:

I have been working through the section on Commands in chapter 6 and I spent quite a lot of time trying to figure out why I could not get my command to work as expected after adding the handler as described in section 6.3.1. I made use of the “click on the class:” method as described in the paragraph. When I tried to run the example I got a message “The chosen operation is not enabled.” I looked at the sample code for the Commands section and found the difference.

When you generate the class using the method discussed in the text of the book, the class is generated to implement org.eclipse.core.commands.IHandler. Several additional methods are generated for you. The example that is available on-line extends org.eclipse.core.commands.AbstractHandler which obviously includes behavior for the standard behavior. I changed my own code to follow this and it executes just fine.
regards,
Bruce Gruenbaum
bgruenba
 
Posts: 4
Joined: Tue Jan 06, 2009 12:30 pm

Re: "the chosen operation is not enabled" for Add to Favorites

Postby Dan Rubel » Mon Jan 12, 2009 12:05 pm

Good point. In the next update (and to the errata) I'll add a new "tip" just before the code block in section 6.3.1 that reads...

Tip: Subclass AbstractHandler rather than implementing IHandler.
Dan Rubel
Moderator
 
Posts: 27
Joined: Thu Oct 30, 2003 9:13 am


Return to Book: Eclipse Plug-Ins (3rd Edition)

Who is online

Users browsing this forum: No registered users and 1 guest