Creating a Perspective Menu in Eclipse

I am developing an Eclipse plug-in and I would like to associate a new menu (at the top of the screen along with File, Edit, etc.) to the perspective I have created.

I made the menu ok, but it shows up even in other perspectives. How can I relate this just from my point of view? This is the code I am using in plugin.xml:

<plugin>
<extension point="org.eclipse.ui.perspectives">
   <perspective
         class="org.eclipse.ui.articles.perspective.API_Development"
         id="org.eclipse.ui.articles.perspective.API_Development"
         name="API Development">
   </perspective>
</extension>

<extension
         point="org.eclipse.ui.actionSets">
      <actionSet
            label="Sample Action Set"
            visible="true"
            id="API_Development_Menu.actionSet">
         <menu
               label="API Development"
               id="sampleMenu">
            <separator
                  name="sampleGroup">
            </separator>
         </menu>
      </actionSet>
   </extension>
</plugin>

      

Thanks and cheers, Kurt

+2


a source to share


1 answer


The wiki article "Menu Contribution" mentions as Eclipse3.3M6 element

 <visibleWhen/>

      

Expansion point added . The definition can then refer to other locations to define the base expression. org.eclipse.core.expressions.definitions

<extension point="org.eclipse.core.expressions.definitions">
  <definition id="com.example.context">
    <with variable="activeContexts">
       <iterate operator="or">
         <equals value="org.eclipse.ui.contexts.actionSet"/>
       </iterate>
    <with>
  </definition>
</extension>

      

This can be called in a kernel expression like activeWhen, enabledWhen, visibleWhen, etc. using a reference element:



<reference definitionId="com.example.context"/>

      

Maybe then the type definition is:

   

can I use for your menu?

0


a source







All Articles