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 5982219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:03:22+00:00 2026-05-22T22:03:22+00:00

I made a model with EMF, representing the settings of a device, and a

  • 0

I made a model with EMF, representing the settings of a device, and a RCP GUI. In the GUI I have a list to select different devices of the type of the model (Master).

The model has a List of Objects of a small class which should be displayed in a table (Detail).

The tableItems itself need to be edited so I have a small GUI part with checkboxes etc. to change the settings. Here the tableitem is master and all fields shown in the GUI are details.

Observable for the List of devices:

IObservableValue selection = ViewersObservables.observeSingleSelection(availableDevicesList);

Table:

IObservableList list = EMFObservables.observeDetailList(Realm.getDefault(), selection,DevicePackage.Literals.LIST);

TableViewer tableViewer = new TableViewer(parent, SWT.SINGLE | SWT.FULL_SELECTION);
tableViewer.setInput(list);

IObservableValue tableSelection = ViewersObservables.observeSingleSelection(tableViewer);

Editing:

Spinner field1 = new Spinner(parent, SWT.BORDER);

dbc.bindValue(SWTObservables.observeSelection(field1), EMFObservables.observeDetailValue(Realm.getDefault(), tableSelection, DevicePackage.Literals.Value1));

When changing the device selection the tableitems get replaced. But the tableSelection seems to have a problem with this. Sometimes it still contains values of a a tableitem from a different device and sometimes it just contains null.
I also have a button which gets enabled/disabled according the validation status of all fields. When the tableSelection puts null into these fields the validation does not work and the button is disabled until a entry in the table is selected.

I tried to manually set the selection empty with a listener on the list and:

tableViewer.setSelection(StructuredSelection.EMPTY, true);

but this does not do the full job. At least all “old” values are replaced but the null problem still occurs.

All I need is to set the tableSelection to an empty state as after the launch of the application, when no tableitem was selected yet.

  • 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-22T22:03:23+00:00Added an answer on May 22, 2026 at 10:03 pm

    I found the solution by myself. The problem was actually the spinner itself. It threw a nullpointer when the selection was empty and there was no value.

    I solved it by giving it a custom converter (from int to int…) where I return a default value if the source is null.
    Now the validation works fine and my button’s enable state is set correct.

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

Sidebar

Related Questions

I have made a data model, and now I've made a 2nd version. All
I have made a model using Sketchup, and have tested rendering it using Blender
I have made a model for a post and have to make a form
i have used the following code in my view and made the model it
When making my model, I made row type as string (I wasn't aware of
I have a data model made up of several entities, all of them interlinked,
I have SQLite Database(DB) and made this to model class and taken the data
I have a JTable for which I have made a table model. But on
I have a categories model made with the fantastic awesome_nested set. I have successfully
I have a very simple composite model made of two classes: Public Class ParentModelVM

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.