Bug 196866 - [Schema][Editors] Global element and local attribute identity constraints are not respected
Summary: [Schema][Editors] Global element and local attribute identity constraints are...
Status: RESOLVED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 M1   Edit
Assignee: Adam Archer CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2007-07-17 15:28 EDT by Mike Pawlowski CLA
Modified: 2007-07-19 16:30 EDT (History)
1 user (show)

See Also:
mike.pawlowski: review? (wassim.melhem)


Attachments
patch (15.04 KB, patch)
2007-07-19 15:01 EDT, Adam Archer CLA
no flags Details | Diff
fixed patch (15.19 KB, patch)
2007-07-19 15:55 EDT, Adam Archer CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.