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

Bug 333804

Summary: Deleting EAttribute from model diagram may remove wrong attribute or produces NPE
Product: [Modeling] Ecoretools Reporter: Matthias Basler <matthiasbasler>
Component: GeneralAssignee: Project Inbox <ecore-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: cedric.brun
Version: unspecified   
Target Milestone: 2.0.0M7   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Eclipse stack traces of all the error messages happening during the two sessions. none

Description Matthias Basler CLA 2011-01-08 17:38:45 EST
Build Identifier: I20101216-1305

On Eclipse 4.1M4b:

I have created a small ecore model using the ecore diagram editor. The diagram consists of two packages having two classes each and a few references, so it is rather small. Nothing other has been changed or added.

Trying to get the EAttributes right, I wanted to delete some attributes. This produces three different outcomes:
a) Another attribute (not the selected one) was removed.
b) A dialog simply telling me "null".
c) A dialog showing the following error:

org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.NullPointerException)
Failed to execute runnable (java.lang.NullPointerException)

Afterwards the model editor is blank and the user has to discard the changes and re-open the model in the editor.

I give it P3 only because experienced on Eclipse 4.1M4b. If the problem occurred on a stable Eclipse 3.x release as well, it should be P2 imho. 
Eclipse Build: I20101216-1305
EMF SDK Build: 2.7.0.v20101215-0940
EcoreTools Build: 0.10.0.v20100615-1639

Reproducible: Always

Steps to Reproduce:
1. Create an "Empty EMF Project"
2. Add a New -> Ecore diagram
3. Add an Eclass
4. Add two attributes: Attrib1 and Attrib2 below it.
5. Select Attrib2 and in the context menu: "Delete from model"
 -> Attrib 1 is deleted
6. Select the remaining Attrib2 and choose "Delete from model"
 -> Error message "null". Attribute is not deleted.
7. Click on the EClass
8. Click on the EAttribute Attrib2 again and choose "Delete from model"
 -> Error message "NullPointerException"
Comment 1 Matthias Basler CLA 2011-01-08 17:52:33 EST
Created attachment 186338 [details]
Eclipse stack traces of all the error messages happening during the two sessions.
Comment 2 Cedric Brun CLA 2014-03-12 13:09:47 EDT
Thanks for your feedback. This has been fixed in the EcoreTools 2.x stream (which is going to be released in June with Luna.