Note that there are some explanatory texts on larger screens.

plurals
  1. POException when add data into TableViewer
    primarykey
    data
    text
    <p>I have 2 TableViewer controls in a composite (Supposed they are : <strong>viewer1</strong>, <strong>viewer2</strong>). When initialize application, one "<strong>viewer1</strong>" is filled data from server while "<strong>viewer2</strong>" is set null.</p> <pre><code>viewer1.setInput(getData()); viewer2.setInput(null); </code></pre> <p>Now I want to change some object from viewer1 to <strong>viewer2</strong> via a context menu, the first time add is successful, but the next time when I fill object to <strong>viewer2</strong>, I always get this exception: <strong>java.lang.UnsupportedOperationException</strong></p> <p>This didn't happen if <strong>viewer2</strong> contain some objects in advance, it only happens when <strong>viewer2</strong> is empty. This is the way I add move some data from <strong>viewer1</strong> to <strong>viewer2</strong> : </p> <pre><code>//get selected objects in Viewer1 IStructuredSelection selection= (IStructuredSelection) viewer1.getSelection(); if(selection!=null){ selectedList=(List&lt;MyObject&gt;)selection.toList(); for(MyObject obj: selectedList){ //do something here } //remove all ((List&lt;MyObject&gt;)viewer1().getInput()).removeAll(selectedList); viewer1.refresh(); } //viewer1 get above List if((List&lt;MyObject&gt;)viewer2.getInput()==null) viewer2.setInput(selectedList); else { ((List&lt;MyObject&gt;)viewer2.getInput()).addAll(selectedList); //(Line Error) } viewer2.refresh; </code></pre> <p>It works well at the first time in the IF condition, but the next time when <strong>viewer2</strong> contained some data, I always get exception at above error line. @Krumelur , I added stacktrace that I got:</p> <pre><code>!ENTRY org.eclipse.ui 4 0 2011-12-27 16:26:50.660 !MESSAGE Unhandled event loop exception !STACK 0 java.lang.UnsupportedOperationException at java.util.AbstractList.add(Unknown Source) at java.util.AbstractList.add(Unknown Source) at java.util.AbstractCollection.addAll(Unknown Source) at com.saltlux.om.client.customwidgets.NeutralSetWidget.getReviewFromOtherWidget(NeutralSetWidget.java:39) at com.saltlux.om.client.customwidgets.NeutralSetWidget$1.handleEvent(NeutralSetWidget.java:24) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:774) at com.saltlux.om.client.customwidgets.PositiveSetWidget.add2TrainingSet(PositiveSetWidget.java:107) at com.saltlux.om.client.customwidgets.TrainingReviewWidget$10.run(TrainingReviewWidget.java:288) at org.eclipse.jface.action.Action.runWithEvent(Action.java:498) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501) at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494) at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at com.saltlux.om.client.Application.start(Application.java:21) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) 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:344) 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:622) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577) at org.eclipse.equinox.launcher.Main.run(Main.java:1410) at org.eclipse.equinox.launcher.Main.main(Main.java:1386) </code></pre> <p>Please help me out. Thanks so much for any answer!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload