Community
Participate
Working Groups
Build ID: M20080911-1700 Steps To Reproduce: 1. Change the diagram zoom level to anything but 100%. 2. Perform direct editing on any modifiable text label which does NOT wrap(!). 3. Stop editing (it does not matter if changes are accepted or not). -> An "Unhandled event loop exception" is reported in the Error Log view, and the edited label figure is garbled. Exception message excerpt: java.lang.IllegalArgumentException: Argument not valid at org.eclipse.swt.SWT.error(SWT.java:3761) at org.eclipse.swt.SWT.error(SWT.java:3695) at org.eclipse.swt.SWT.error(SWT.java:3666) at org.eclipse.swt.graphics.GC.setFont(GC.java:4156) at org.eclipse.draw2d.FigureUtilities.setFont(FigureUtilities.java:329) at org.eclipse.draw2d.FigureUtilities.getFontMetrics(FigureUtilities.java:58) at XYZEditPartFactory$TextCellEditorLocator.relocate(XYZEditPartFactory.java:156) at ... More information: It seems that the Font instance used by the Text control of the TextCellEditor has been disposed when the the FigureUtilities.getFontMetrics() method is invoked within the GMF generated TextCellEditorLocator.relocate() method, which finally causes the aforementioned exception to be thrown. Strangely this is not the case when the zoom level is 100%. (The closed bug #168199 describes the same or a similar issue.)
I can not reproduce this problem neither with GMF 2.1 nor with the current state. Do you see this exception in .log file? I've used Ecore diagram example to check this problem
Build ID: 20090619-0625 I also reproduced it with: * Windows XP SP2 * GMF 2.2 - Create a UML 2.1 Class Diagram - Set the zoom level to 75% for example - Create 2 classes - Create an Association between them - When you're prompted for a text, press enter (or enter a text and press enter). The exception appears in the error log.
This bug *always* occurs with our own generated editor. As a workaround, I changed the generation template for EditPartFactory, in the relocate method of the nested TextCellEditorLocator class: org.eclipse.swt.graphics.Font font = text.getFont(); if (!font.isDisposed()) { int avr = org.eclipse.draw2d.FigureUtilities .getFontMetrics(font).getAverageCharWidth(); rect.setSize(new org.eclipse.draw2d.geometry.Dimension( text.computeSize(org.eclipse.swt.SWT.DEFAULT, org.eclipse.swt.SWT.DEFAULT)).expand(avr * 2, 0)); } The relevant change is the added check for font.isDisposed().
The Bug is still open so; @Alex. Did you edit the laben direct in the editor? Not in the Properties View! @Miro. Your Workarround works fine for me!
> @Alex. Did you edit the laben direct in the editor? Not in the Properties View! Yes, in the editor with direct-edit (pressing F2 for example). As of GMF 2.2.2 the bug is still here, reproducible 100% of the time.
This is generation counterpart of the bug #279788. Suggested fix (check for font.isDisposed) was added to EditPartFactory template.
[target cleanup] 2.3 M6 was the original target milestone for this bug
[GMF Restructure] Bug 319140 : product GMF and component Templates was the original product and component for this bug