Community
Participate
Working Groups
Steps To Reproduce: (1) Launch a new runtime Eclipse workbench (2) Create an extension point schema (3) Create a new element -> Auto-generated name is "new_element1" (4) Create another new element -> Auto-generated name is "new_element2" (5) Create another new element -> Auto-generated name is "new_element3" (6) Rename "new_element3" to "new_element5" (7) Close and relaunch the runtime Eclipse workbench (8) Open the extension point schema created earlier (9) Create 5 new elements -> BUG: "new_element1", "new_element2", "new_element3", "new_element4", "new_element5" created -> This is bad since element names are used as IDs -> Duplicate element names are now 'linked' in a very bad way -> EXPECTED: "new_element", "new_element3", "new_element4", "new_element6", "new_element7", created The same problem exists for local attribute objects with the same parent. Reference for correct behaviour and code: Simple Cheat Sheet Editor Noam generalized some code to handle this in: org.eclipse.pde.internal.ui.util.PDELabelUtility.generateName(String[], String) Ideally we would want to reuse this; however, it will have to be adapted or generalized some more to generate "1" instead of " (1)", etc.
Created attachment 73958 [details] patch Created a new method, PDELabelUtility.generateName(String[], String, boolean). The boolean parameter (bracketed) controls the style of name to be generated. if bracketed is true, result is of the form: "<base> (#)" otherwise, result is of the form: "<base>#" Changed PDELabelUtility.generateName(String[], String) to simply call the new method with bracketed set to true. Used the new utility to generate element names in NewElementAction.
Comment on attachment 73958 [details] patch Good patch. Thanks Adam. However need to implement this for attributes as well ;)
Patch applied to HEAD. Target: 3.4 M1 Adam, just provide another patch for local attribute objects with the same parent.
Oops! Will do.
Created attachment 74108 [details] additional patch Applies the fix to attribute name generation as well.
Comment on attachment 74108 [details] additional patch Tested well. Thanks, Adam.
Patch applied to HEAD.