Conflicting handlers and Stackoverflow [message #1729144] |
Mon, 11 April 2016 13:50 |
Ali AKAR Messages: 31 Registered: July 2009 |
Member |
|
|
Hi,
When migrating my product to Eclipse Mars, I start to have the following
messages on the console:
Conflicting handlers for system.test.myCmd:
(org.eclipse.ui.internal.workbenchHandlerServiceHandler@202c6396) vs
(system.test.MyHandler)
Once the workbench is loaded, I have a stack overflow !
My product contribute an IStartup to initialize some user profile
preferences and I have the following code which run in the earlyStartup:
ICommandService cmdService =
(ICommandService)PlatformUI.getWorkbench().getService(ICommandService.class);
IHandlerService handlerService =
(IHandlerService)PlatformUI.getWorkbench().getService(IHandlerService.class);
for(Command cmd : cmdService.getDefinedCommands()){
if(isMyRcpCmd(cmd)){
.
.
IHandlerActivation handlerActivation =
handlerService.activateHandler(cmd.getId(), cmd.getHandler());
prefs.put(cmd.getId(), handlerActivation)
...
}
}
I did some debugging and I see that when there is a conflict and the
method
LegacyHandlerService$HandlerSelectionFunction#compute(IEclipseContext,
String) return the workbenchHandlerServiceHandler as bestActivation, I
have the stack overflow which attached as image. When my handler is
returned, no stack overflow appears.
If in LegacyHandlerService#registerLegacyHandler(IEclipseContext,
String, String, IHandler, Expression, String), I comment out two lines
of code:
boolean handledChanged = handled != command.isHandled();
boolean enabledChanged = enabled != command.isEnabled();
My issue disappear !!
So my questions:
Why I'm having this conflict with this internal Eclipse handler (as I
saw it's generated by Eclipse in a handler generator) ??
Am I doing something wrong in the early startup or it's an Eclipse bug ??
Also, this two booleans handledChanged and enabledChanged are not used
and there is a TODO if we need to fire a handler changed event.
Any help is appreciated,
Kind regards,
Ali
|
|
|
Re: Conflicting handlers and Stackoverflow [message #1729492 is a reply to message #1729144] |
Thu, 14 April 2016 16:35 |
Eclipse User |
|
|
|
That warning message means that the system is unable to determine which handler is most specific to the current context. It determines that specificity by evaluating the complexity of the activeWhen expressions (IIRC). Generally making your expression a little bit longer by adding another clause, will make it more complex.
But stack overflows should never happen. If you have a small reproducible test case, please open a bug!
Brian.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03472 seconds