Inconsistent Eclipse Handlers

When developing the eclipse plugin, I created a command in manifest extensions with id crtc_v4.session with the default handler crtc_v4.handlers.StartSession, I added a handler to the manifest for this command, this handler resolves the command according to the variable crtc_v4.sessionvar.

The problem that appears on the console:

!MESSAGE Conflicting handlers for crtc_v4.session: { crtc_v4.handlers.StartSession@98bc5c } vs { crtc_v4.handlers.StartSession@1265d09 } 

But it does not block the launch of the plugin. I ask about the solution to this problem and does it affect the performance of my plugin in general?

Edit:

The fragment defining the command:

  <extension point="org.eclipse.ui.menus"> <menuContribution allPopups="false" locationURI="toolbar:org.eclipse.ui.main.toolbar"> <toolbar id="crtc_v5.crtctoolbar"> <command commandId="crtc_v5.session" icon="icons/neutral.png" label="Start Session" style="push"> </command> </toolbar> </menuContribution> 

A fragment defining a handler:

  </extension> <command defaultHandler="crtc_v5.handlers.StartSession" id="crtc_v5.session" name="session"> </command> </extension> 

And here is the activation against sessionvar:

  <extension point="org.eclipse.ui.handlers"> <handler class="crtc_v5.handlers.StartSession" commandId="crtc_v5.session"> <enabledWhen> <with variable="crtc_v5.sessionvar"> <equals value="LOGGEDIN"> </equals> </with> </enabledWhen> </handler> 

+4
source share
1 answer

You defined a default handler in the command and another one in the org.eclipse.ui.handlers extension. If you want to use enabledWhen, just remove the defaultHandler attribute (since both instances provide the same handler, crtc_v5.handlers.StartSession ).

If you want different handlers to ensure the behavior of your team depending on the state of the application, you should use activeWhen in the definition of org.eclipse.ui.handlers , but this does not look like in this case.

+6
source

Source: https://habr.com/ru/post/1486368/


All Articles