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

  • SEARCH
  • Home
  • 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 8444523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T09:24:47+00:00 2026-06-10T09:24:47+00:00

I am looking into JFace for Eclipse development. I made a plugin to act

  • 0

I am looking into JFace for Eclipse development. I made a plugin to act as a dummy content provider for a ComboViewer. This provider essentially provides the data model as an ArrayList of hardcoded values. Anyway, I tried to understand the approach.

I set the model on the ComboViewer via the comboViewer.setInput(list) method.
On the press of a button I call another object’s method that updates the list I passed as input to the ComboViewer (adds another element) and I call comboViewer.refresh to reflect the change, but nothing happens.

Turns out:

I need to call comboViewer.setInput(list) with the updated list to see the changes in the data (i.e. the previous addition) in my UI combo. I found that comboViewer.refresh reflects any updates only if I get the a hold of comboViewer‘s passed as input Object and modify that. I.e. if I do:

List<SomeObject> data = ((List<SomeObject>)(comboViewer.getInput()));  
data.add(new SomeObject("aaa","cccc"));  
comboViewer.refresh();    

Only like this the data are refreshed. But I don’t understand what is the proper way to use these APIs.
Am I supposed to ever get a hold and modify the object I pass in the setInput method? It feels I should not be doing it. So what is the purpose of refresh?

What is the proper way to do updates of the data that are provided to the Viewers?

  • 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-06-10T09:24:48+00:00Added an answer on June 10, 2026 at 9:24 am

    The proper way to reflect changes is to call refresh. The list

    String[] values = {"1","2","3"};
    List<String> list = new ArrayList<String>(Arrays.asList(values));
    

    create components

    final ComboViewer comboViewer = new ComboViewer(shell, SWT.DROP_DOWN);
    comboViewer.setLabelProvider(new LabelProvider());
    comboViewer.setContentProvider(new ArrayContentProvider());
    comboViewer.setInput(list);
    Button button1 = new Button(shell, SWT.PUSH);
    button1.setText("Button 5");
    button1.addSelectionListener(new SelectionListener(){
    
      @Override
      public void widgetSelected(SelectionEvent e) {
         // TODO Auto-generated method stub
         System.out.println("Button 5");
         list.add("4");
         comboViewer.refresh();             
      }
    
      @Override
      public void widgetDefaultSelected(SelectionEvent e) {
         // TODO Auto-generated method stub     
      }
    
    });
    

    when you push the button the combo viewer is updated.

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

Sidebar

Related Questions

Looking into Eclipse 4 RCP. Did the following: Created an Eclipse Plugin Project (no
Am looking into developing an iPhone native app using Titanium Developer Since this is
I was looking into this issue but I couldn't find any solid answers for
hi looking into the framework, what do you think about it as development framework
I'm looking into doing some development for the Azure platform. I don't need the
Looking into Kohana documentation, i found this really usefull function that they use to
I'm looking into buying an Android phone and I'd like to do some development
I have been looking into this for some hours now and can't figure it
when looking into metadata of images I was wondering how standardized this data actually
Looking into org.pentaho.reporting.engine.classic.core.DataFactory and more specifically into the initialize method (which was formerly part

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.