Project: Eclipse_Platform_UI
Bug 29977 [Editor Mgmt] OpenWithMenu can contain duplicates
Reported: 2003-01-22 09:43:40 | Status: closed fixed

20030121 Test Case Add the Planty editor as an editor for *.xml (it is already registered for build.xml) Select a build.xml file Use the context menu in the Package Explorer->Open With The sub menu contains two planty entries. Problem: OpenWithMenu#fill(Menu, int) does not check for duplicate editor descriptions for any give file. Possible Solution: Make the following change to OpenWithMenu#fill: List alreadyAddedEditors= new ArrayList(editors.length); for (int i = 0; i < editors.length; i++) { IEditorDescriptor editor = (IEditorDescriptor) editors[i]; if (alreadyAddedEditors.contains(editor.getId())) { continue; } createMenuItem(menu, editor, preferredEditor); if (defaultEditor != null && editor.getId().equals(defaultEditor.getId ())) { defaultFound = true; } alreadyAddedEditors.add(editor.getId()); }

Files changed in fix:
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/OpenWithMenu.java