Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » IHandlerService with Compatibility-Layer(The command doesn't get set the handler.)
IHandlerService with Compatibility-Layer [message #1385246] Thu, 05 June 2014 07:45 Go to next message
Stefan Weiser is currently offline Stefan WeiserFriend
Messages: 55
Registered: February 2012

I try to run an old e3-application with the compatibility layer of e4. After doing some code changes most things seem to work correct. The only problem I have is the ICommandService.

When I want to exeute a command from the ICommandService, the execution fails because there is no handler available in the command. In this topic this problem have been discussed but I didn't read a solution.
The only think I don't know is why isEnabled() and getHandler() return false and null.

This could be solved, if I set the Handler manually into the Command. Then isEnabled() and getHandle() work correct. Is there a reason, why the handler is not set for the command?

Is there any other solution available? Setting the handler manually seem to be a bit strange.
Re: IHandlerService with Compatibility-Layer [message #1385249 is a reply to message #1385246] Thu, 05 June 2014 07:50 Go to previous message
Stefan Weiser is currently offline Stefan WeiserFriend
Messages: 55
Registered: February 2012
As I can read in the FAQ:
Why does org.eclipse.core.commands.Command's isEnabled() and getHandler() not work?

Command's isEnabled() and getHandler() and are specific to Eclipse 3.x based API and are not supported in Eclipse 4. Hence they will always return false or null in Eclipse 4 applications. Applications should use the EHandlerService to query against a command.

As I'm running an e3-application with the compatibility layer in e4, I don't have an EHandlerService. I tried to get it from the IEclipseContext
IEclipseContext serviceContext = EclipseContextFactory.getServiceContext(Activator.getDefault().getBundle().getBundleContext());

but the EHandlerService is not available. It does not get instantiated anytime.
Previous Topic:Goodies from o.e.ui.workbench
Next Topic:isPartVisible (PartService)
Goto Forum:

Current Time: Fri Jun 18 17:47:42 GMT 2021

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

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

Back to the top