AssertionFailedException while creating CellEditor in Eclipse

ist_lion picture ist_lion · Sep 7, 2009 · Viewed 9.3k times · Source

Hopefully someone can point me in the right direction. I'm trying to create a CellEditor in Eclipse and when I click on the field I get an Unhandled event loop exception with the stack trace below.

The cell editor code for this column looks like this

/** Cell Editor Row 2 **/
textEditor = new TextCellEditor(table);
((Text)textEditor.getControl()).setTextLimit(10);
editors[1] = textEditor;

org.eclipse.core.runtime.AssertionFailedException: assertion failed:
at org.eclipse.core.runtime.Assert.isTrue(Assert.java:111)
at org.eclipse.core.runtime.Assert.isTrue(Assert.java:97)
at org.eclipse.jface.viewers.TextCellEditor.doSetValue(TextCellEditor.java:228)
at org.eclipse.jface.viewers.CellEditor.setValue(CellEditor.java:855)
at org.eclipse.jface.viewers.EditingSupport.initializeCellEditorValue(EditingSupport.java:96)
at org.eclipse.jface.viewers.ColumnViewerEditor.activateCellEditor(ColumnViewerEditor.java:194)
at org.eclipse.jface.viewers.ColumnViewerEditor.handleEditorActivationEvent(ColumnViewerEditor.java:443)
at org.eclipse.jface.viewers.ColumnViewer.triggerEditorActivationEvent(ColumnViewer.java:680)
at org.eclipse.jface.viewers.ColumnViewer.handleMouseDown(ColumnViewer.java:664)
at org.eclipse.jface.viewers.ColumnViewer.access$0(ColumnViewer.java:660)
at org.eclipse.jface.viewers.ColumnViewer$1.mouseDown(ColumnViewer.java:89)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:179)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3823)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3422)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2382)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2346)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2198)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:493)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:488)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at com.tasc.swb.internal.application.SWBApplication.start(SWBApplication.java:414)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:382)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
at org.eclipse.equinox.launcher.Main.main(Main.java:1212)

Answer

VonC picture VonC · Sep 7, 2009

According to this thread:

it seems like:

  • you have either not set the CellModifier for the TableViewer (using the setCellModifier() function)
  • or, if you have, then the getValue() function of your ICellModifier descendant returns either null or not a String object.
    The return value of getValue() is an object, but if you are using a TextCellEditor, it has to return a String.