AssertionFailedException ao criar CellEditor no Eclipse
-
21-09-2019 - |
Pergunta
Espero que alguém possa me apontar na direção certa. Estou tentando criar um CellEditor no Eclipse e, quando clico no campo, recebo uma exceção de loop de eventos não atendida com o rastreamento da pilha abaixo.
O código do editor de células para esta coluna se parece com isso
/** 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)
Solução
De acordo com este tópico:
parece que:
- Você não definiu o
CellModifier
para oTableViewer
(usando osetCellModifier()
função)- Ou, se você tiver, então o
getValue()
função do seuICellModifier
O descendente retorna nulo ou não um objeto de string.
O valor de retorno degetValue()
é um objeto, mas se você estiver usando umTextCellEditor
, ele tem que devolver uma string.
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow