Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 327886

Summary: Allow for multiple targetID to be specified under one poupmenu contribution
Product: [Eclipse Project] Platform Reporter: Andrew Flatt <aflatt>
Component: IDEAssignee: Platform-UI-Inbox <Platform-UI-Inbox>
Status: RESOLVED WONTFIX QA Contact:
Severity: enhancement    
Priority: P3    
Version: 3.4.2   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Andrew Flatt CLA 2010-10-15 09:01:54 EDT
Build Identifier: 3.4.2.R342_v20090122

I currently have to duplicate xml to add a pop up menu to multiple areas in the IDE I would like to specify a menu item for each of the target id's below but to do this i need to create 4 viewer contributions with repeated xml in.  When you expand this to more menus the maintainance of them becomes an issue, where one change will need to be reflected in several places in the xml. 

"#TextEditorContext"  
"#CompilationUnitEditorContext"  
"#TextRulerContext" 
"#CompilationUnitRulerContext"


Reproducible: Always

Steps to Reproduce:
N/A
Comment 1 Paul Webster CLA 2010-10-15 10:22:11 EDT
We won't change the org.eclipse.ui.popupMenus extension.  That's already deprecated in 4.x, and has been "secondary" in 3.x since 3.3.

But just FYI, there's an #AbstractTextEditorContext that's common to both "#TextEditorContext" and "#CompilationUnitEditorContext".  Similar thing for #TextRulerContext.

In org.eclipse.ui.menus/menuContribution it is possible to do what you want, either by placing a submenu in all the locations you want, then the contents of the submenu are in one place only, or by placing your command contributions in the popup.any location (all popups) and then adding a visibleWhen that checked  org.eclipse.ui.ISources.ACTIVE_MENU_NAME contains the correct ID

PW