Bug 372097 - A Change in a GMF property throws a dialog an exception occurs
Summary: A Change in a GMF property throws a dialog an exception occurs
Status: NEW
Alias: None
Product: GMF-Runtime
Classification: Modeling
Component: General (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-21 05:24 EST by Salmeron Delia CLA
Modified: 2012-03-14 04:39 EDT (History)
2 users (show)

See Also:


Attachments
IllegalStateException (9.38 KB, text/plain)
2012-02-21 05:27 EST, Salmeron Delia CLA
no flags Details
Class modified to reproduce the error. (13.81 KB, text/x-java)
2012-02-21 05:31 EST, Salmeron Delia CLA
no flags Details
UndoableModelPropertySheetEntry modified to fixed the bug (13.18 KB, text/x-java)
2012-02-21 05:37 EST, Salmeron Delia CLA
no flags Details
patch for UndoableModelPropertySheetEntry (2.33 KB, patch)
2012-03-14 04:39 EDT, Salmeron Delia CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Salmeron Delia CLA 2012-02-21 05:24:44 EST
Build Identifier: Version: Helios Service Release 2 Build id: 20110301-1815

Sometimes when we modify a GMF property we need throw a dialog to get user information. In this case an IllegalStateException exception occurs.

Reproducible: Always

Steps to Reproduce:
1.Download from cvs repository http://dev.eclipse.org/viewcvs/viewvc.cgi/org.eclipse.gmp/org.eclipse.gmf.tooling/examples/?root=Modeling_Project
org.eclipse.gmf.examples.mindmap/ plugin.
2.Select mindmap.genmodel , Right-click and select Generate Edit Code , Editor Code 
3.Select mindmap.gmfgen , Right-click and Generate Diagram Code  
4.Replace MindmapDiagramEditor class 
5.See the video http://www.youtube.com/watch?v=0W7IAr0gvVI
6. Attached possible solution to the UndoableModelPropertySheetEntry class
Comment 1 Salmeron Delia CLA 2012-02-21 05:27:13 EST
Created attachment 211320 [details]
IllegalStateException

Exception occurred
Comment 2 Salmeron Delia CLA 2012-02-21 05:31:20 EST
Created attachment 211321 [details]
Class modified to reproduce the error.

Class modified to reproduce the error. See transactionAboutToCommit() method
Comment 3 Salmeron Delia CLA 2012-02-21 05:37:09 EST
Created attachment 211323 [details]
UndoableModelPropertySheetEntry modified to fixed the bug

Possible solution . See the applyEditorValue() method.
    public void applyEditorValue() {
    	if (editor == null || !editor.isActivated())
     	 	return;
    	
    	    	
    	if(myDescriptor!= null)
    	{
    		if(myDescriptor.getId().equals(getDescriptor().getId()))
    			return;
    	}
    	
        if (!editor.isValueValid()) {
            setErrorText(editor.getErrorMessage());
            return;
        } else 
            setErrorText(null);


        // See if the value changed and if so update
        
        Object newValue = editor.getValue();
        boolean changed = false;
        if (values.length > 1) {
            changed = true;
        } else if (editValue == null) {
            if (newValue != null)
                changed = true;
        } else if (!editValue.equals(newValue))
            changed = true;

        // Set the editor value
        if (changed)
        {
        	myDescriptor = getDescriptor(); 
        	setValue(newValue);
        	myDescriptor = null;
        }
    }
Comment 4 Salmeron Delia CLA 2012-02-21 06:10:03 EST
the error only happens when we modify the name from the GMF Properties View. It does not happen if we edit the name in the GMF editor, or in the EMF base properties
Comment 5 Aurelien Pupier CLA 2012-03-13 23:10:00 EDT
Hi,

can you provide a patch instead of the whole class please? It is easier and faster to do the code review.

Regards,
Comment 6 Salmeron Delia CLA 2012-03-14 04:39:09 EDT
Created attachment 212623 [details]
patch for UndoableModelPropertySheetEntry

Done