Bug 196866

Summary: [Schema][Editors] Global element and local attribute identity constraints are not respected
Product: [Eclipse Project] PDE Reporter: Mike Pawlowski <mike.pawlowski>
Component: UIAssignee: Adam Archer <agarcher>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: wassim.melhem
Version: 3.3Keywords: contributed
Target Milestone: 3.4 M1Flags: mike.pawlowski: review? (wassim.melhem)
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
patch
none
fixed patch none

Description Mike Pawlowski CLA 2007-07-17 15:28:28 EDT
The Schema Editor should not allow two or more (global) elements with the same name to be declared.  

The Schema Editor should not allow two or more (local) attributes with the same name to be declared under the same parent.  

The editor uses attribute and element names as their IDs to uniquely identify them.  As a result, they become 'linked' and things go seriously wrong.

The auto-generated names will no longer overlap thanks to Bug # 196685

We need to guard against the user renaming the element or attribute to the same name as an existing one.

If a duplicate name is detected, I suggest reverting the entered value to the previous uncommitted value as was done for empty element and attribute names.

Note: I would consider names with the same characters but different casing to be the same (e.g. "aB" = "Ab")
Comment 1 Mike Pawlowski CLA 2007-07-18 18:44:51 EDT
Just noticed another requirement.
You can copy and paste an attribute or element to create duplicates as outlined in Comment #0.
You should update the paste enablement such that you cannot paste elements or attributes with duplicate names.
Comment 2 Adam Archer CLA 2007-07-19 15:01:27 EDT
Created attachment 74178 [details]
patch

This patch was implemented slightly differently than suggested in comment 1. In the case of copy/paste/move, if the name is in use, a new name will be generated with a mechanism similar to that used to address bug 196685.
Comment 3 Wassim Melhem CLA 2007-07-19 15:15:21 EDT
The patch does not work quite right.

Copy element 'abc'.  Try to paste it, you will get a new element 'abc1' and it is auto-selected.  Great.  However, the Element Details section still shows 'abc', not 'abc1'
Comment 4 Adam Archer CLA 2007-07-19 15:55:12 EDT
Created attachment 74185 [details]
fixed patch
Comment 5 Wassim Melhem CLA 2007-07-19 16:30:21 EDT
released the patch after externalizing PDELabelUtility.