ScottJ
ScottJ

Reputation: 155

Add popup menu to Eclipse Problems view

I wish to add a popup menu to the Eclipse Problem View. I can add the menu but I want it to only appear under certain condition. Like for example when a certain type of problem is selected in the problems view.

Upvotes: 0

Views: 245

Answers (1)

Simon
Simon

Reputation: 720

Assuming you are using the "org.eclipse.ui.menus" extension point and the command framework, you can set the visibleWhen part of the menu definition to something like;

 <visibleWhen>
    <with variable="selection">
      <iterate>
        <and>
          <instanceof value="com.example.MyClass">
          </instanceof>
        </and>
      </iterate>
    </with>
  </visibleWhen>

This should only make the option visible when the selected items are of the correct instance. It is also possible to set enabled and active states on command handlers in a similar way.

Upvotes: 1

Related Questions