[jbosstools-issues] [JBoss JIRA] Commented: (JBIDE-3034) Generate Hibernate/JPA gives double source menu for all non-java editors

Snjezana Peco (JIRA) jira-events at lists.jboss.org
Wed Jan 14 18:25:04 EST 2009


    [ https://jira.jboss.org/jira/browse/JBIDE-3034?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12447873#action_12447873 ] 

Snjezana Peco commented on JBIDE-3034:
--------------------------------------

The problem with two Source menus is possible to avoid using the org.eclipse.ui.menus extension point.
The following declaration adds the above mentioned action to the Source menu of an XML editor:

    <extension 
      point="org.eclipse.ui.commands">
      <category 
          id="org.hibernate.eclipse.jdt.ui.run_jpaaction.category1" 
          name="Generate Hibernate/JPA annotations">
      </category>
      <command 
         categoryId="org.hibernate.eclipse.jdt.ui.run_jpaaction.category1" 
         defaultHandler="org.hibernate.eclipse.jdt.ui.internal.jpa.actions.JPAMapToolActionPulldownDelegate"  
         id="org.hibernate.eclipse.jdt.ui.run_jpaaction" 
         name="Generate Hibernate/JPA annotations...">
      </command>     
    </extension>
	
	<extension
         point="org.eclipse.ui.menus">
      <menuContribution
            locationURI="menu:sourceMenuId?after=additions">
            <command
                  commandId="org.hibernate.eclipse.jdt.ui.run_jpaaction"
                  id="org.hibernate.eclipse.jdt.ui.run_jpaaction1"
                  style="push">
                  <visibleWhen checkEnabled="false">
			    <reference definitionId="org.eclipse.wst.sse.ui.sseActiveContext.definition"></reference>
	           </visibleWhen>
            </command>
                        
      </menuContribution>
   </extension>

The action will be active only if an XML editor is active.
The following declaration will add the action to the Source Menu of Java editor. This command won't be active if an XML editor is active what means that there won't be two Source menus.
   
   <extension
         point="org.eclipse.ui.menus">
      <menuContribution locationURI="menu:org.eclipse.ui.main.menu?after=edit">
			<menu id="org.eclipse.jdt.ui.source.menu" 
				label="&amp;Source">
			</menu>
	  </menuContribution>
	  <menuContribution locationURI="menu:org.eclipse.jdt.ui.source.menu">
			<separator name="commentGroup" visible="true"/>
            <separator name="editGroup" visible="true"/>
            <separator name="importGroup" visible="true"/>
            <separator name="generateGroup" visible="true"/>
            <separator name="codeGroup" visible="true"/>
            <separator name="externalizeGroup" visible="true"/>
            <separator name="convertGroup" visible="true"/>	
     </menuContribution>

      <menuContribution
            locationURI="menu:org.eclipse.jdt.ui.source.menu?after=generateGroup">
            <command
                  commandId="org.hibernate.eclipse.jdt.ui.run_jpaaction"
                  id="org.hibernate.eclipse.jdt.ui.run_jpaaction"
                  style="push">
                  <visibleWhen checkEnabled="false">
                      <not>
			    <reference definitionId="org.eclipse.wst.sse.ui.sseActiveContext.definition"></reference>
		      </not>
		  </visibleWhen>
            </command>                        
      </menuContribution>
   </extension>

It is also necessary to implement this action as IHandler (AbstractHandler). The FindSeamHandler can serve as an example.

There is a similar issue with the Toggle, Add and Remove Comment actions in the VPE editor that can be reproduced in the current JBoss Tools in the following way:
- open a file in the VPE editor
- select any node in the Package Explorer
You will get 2 Source menus.
The problem is that these actions are contributed using the editorActions ext. point in the org.jboss.tools.jst.jsp plugin.
The solution is to remove those contributions and add the actions by activating the org.eclipse.wst.xml.comments context when the VPE editor is activated.


> Generate Hibernate/JPA gives double source menu for all non-java editors
> ------------------------------------------------------------------------
>
>                 Key: JBIDE-3034
>                 URL: https://jira.jboss.org/jira/browse/JBIDE-3034
>             Project: Tools (JBoss Tools)
>          Issue Type: Bug
>          Components: Hibernate
>    Affects Versions: 3.0.0.beta1
>            Reporter: Max Rydahl Andersen
>            Assignee: Vitali Yemialyanchyk
>             Fix For: 3.0.0.CR2
>
>         Attachments: doublesrcmenu.png
>
>
> see attached.
> it is sometimes enabled other times not....but the unecessary menu is always there!

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jbosstools-issues mailing list