Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6995891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:05:15+00:00 2026-05-27T20:05:15+00:00

I have 2 TableViewer controls in a composite (Supposed they are : viewer1 ,

  • 0

I have 2 TableViewer controls in a composite (Supposed they are : viewer1, viewer2). When initialize application, one “viewer1” is filled data from server while “viewer2” is set null.

viewer1.setInput(getData());
viewer2.setInput(null);

Now I want to change some object from viewer1 to viewer2 via a context menu, the first time add is successful, but the next time when I fill object to viewer2, I always get this exception:
java.lang.UnsupportedOperationException

This didn’t happen if viewer2 contain some objects in advance, it only happens when viewer2 is empty.
This is the way I add move some data from viewer1 to viewer2 :

//get selected objects in Viewer1
IStructuredSelection selection= (IStructuredSelection) viewer1.getSelection();
if(selection!=null){
            selectedList=(List<MyObject>)selection.toList();
            for(MyObject obj: selectedList){
                //do something here
            }
            //remove all
            ((List<MyObject>)viewer1().getInput()).removeAll(selectedList);
            viewer1.refresh();
        }
//viewer1 get above List
if((List<MyObject>)viewer2.getInput()==null)
 viewer2.setInput(selectedList);
else {
 ((List<MyObject>)viewer2.getInput()).addAll(selectedList);  //(Line Error)
}
viewer2.refresh;

It works well at the first time in the IF condition, but the next time when viewer2 contained some data, I always get exception at above error line.
@Krumelur , I added stacktrace that I got:

!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)

Please help me out. Thanks so much for any answer!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T20:05:16+00:00Added an answer on May 27, 2026 at 8:05 pm

    Not all implementations of java.util.List interface support addAll() method. For example, the one that is returned by Arrays.asList() does not and this is the method used by StructuredSelection.toList().

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a tableview application loaded with core data feltching objects and i wanna
I have a table that has its content filled using one of the two
I want to save the Notifications which come from server in my application and
I have built a simple Eclipse plugin where a user may use a TableViewer
I have a tableView and when the user is selecting one of the cells,
I have few custom controls (image views) added programmatically to table cell. I want
I have a MonoTouch application that seems to throw an exception randomly on the
I have 3 segmented controls in each cell of a tableview on an iPad.
I have a grid control that I use throughout the application. I would like
I have a UITableView whose data source and delegate are switched between a couple

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.