Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse conflicting handlers

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

The problem which appears on the console is :

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

But it doesn't block running the plugin. I'm asking about the solution for this problem, and whether it affects the performance of my plugin in general ?

Edit :

The snippet that define 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>

The snippet that define the handler :

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

And here is the enablement 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>

like image 854
Sara Tarek Avatar asked Jun 15 '13 09:06

Sara Tarek


1 Answers

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

When you want to have different handlers provide the behaviour for your command depending on the application state, you would use activeWhen in the org.eclipse.ui.handlers definition, but that doesn't seem to be the case here.

like image 126
Paul Webster Avatar answered Sep 22 '22 16:09

Paul Webster