Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Conflicting handlers and Stackoverflow
Conflicting handlers and Stackoverflow [message #1729144] Mon, 11 April 2016 13:50 Go to next message
Ali AKAR is currently offline Ali AKARFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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.
Re: Conflicting handlers and Stackoverflow [message #1729711 is a reply to message #1729144] Mon, 18 April 2016 10:44 Go to previous messageGo to next message
Ali AKAR is currently offline Ali AKARFriend
Messages: 31
Registered: July 2009
Member
Hi Brian,

Thank you for your answer.

The conflict is with my default handler which does not have an activeWhen expression and it's contributed as following:

<command
defaultHandler="system.test.MyHandler"
id="system.test.command"
name="FunctionalTransition">
</command>

The extension point description states the following:
This handler will conflict with other handler definitions that specify no activeWhen conditions.

I only contribute this default handler and the conflict is with internal Eclipse handler !

When the internal Eclipse handler is returned I have the stack over flow.

I created the following bug:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=491901

Regards,
Ali
Re: Conflicting handlers and Stackoverflow [message #1729821 is a reply to message #1729144] Tue, 19 April 2016 10:47 Go to previous message
Patrik Suzzi is currently offline Patrik SuzziFriend
Messages: 2
Registered: February 2018
Junior Member
Please, take a look at this Forum post about IStartup#earlyStartup()

https://www.eclipse.org/forums/index.php?t=msg&th=1068897&goto=1703131&#msg_1703131


Previous Topic:Introducing MelnormeEclipse, a framework for building Eclipse-based IDEs
Next Topic:Re-pursuing problem with Eclipse on Ubuntu VM "losing" all imported projects
Goto Forum:
  


Current Time: Tue Mar 19 09:32:21 GMT 2024

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

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

Back to the top