Community
Participate
Working Groups
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
Created attachment 211320 [details] IllegalStateException Exception occurred
Created attachment 211321 [details] Class modified to reproduce the error. Class modified to reproduce the error. See transactionAboutToCommit() method
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; } }
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
Hi, can you provide a patch instead of the whole class please? It is easier and faster to do the code review. Regards,
Created attachment 212623 [details] patch for UndoableModelPropertySheetEntry Done