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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:49:13+00:00 2026-06-11T12:49:13+00:00

I would like for my ComboBoxCellEditor to be able to have 3 selections possible.

  • 0

I would like for my ComboBoxCellEditor to be able to have 3 selections possible. Right now it only has Yes or No. I would like for it to have Yes, No, Both.

Also the combobox selection values does not show up in the table unless the cell is clicked. It is hard to tell if the table cell has a selection possible unless they click in the empty cell. I would like it to at least show the down arrow.
I have read some where that the only way you can get around this is to set a default value.

  1. I am not sure how to add the 3rd value. I will add my code trying to add the 3rd value

  2. How can a get the combobox show up in the table without the cell having to be clicked first?

.

public class OptionEditingSupport extends EditingSupport {

    private ComboBoxCellEditor cellEditor;

    public OptionEditingSupport(ColumnViewer viewer) {
        super(viewer);
        cellEditor = new ComboBoxCellEditor(((TableViewer)viewer).getTable(), new String[]{"Yes", "No", "Both"}, SWT.READ_ONLY);

    }

    protected CellEditor getCellEditor(Object element) {
        return cellEditor;
    }

    protected boolean canEdit(Object element) {
        return true;
    }

    protected Object getValue(Object element) {
        return 0;
    }

    protected void setValue(Object element, Object value) 
    {
        if((element instanceof AplotDatasetData) && (value instanceof Integer)) {
            Integer choice = (Integer)value;
            String option = (choice == 0? "Yes":"No":"Both"); **<- Error Here
            ((AplotDatasetData)element).setMarkupValue(option);
            getViewer().update(element, null);
        }
    }
}
  • 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-11T12:49:14+00:00Added an answer on June 11, 2026 at 12:49 pm

    The conditional operator

    x ? y : z
    

    is a ternary operator, which internally does:

    if(x)
        y;
    else
        z;
    

    Thus, you can only use it with three components. Use an if else if else instead:

    Integer choice = (Integer)value;
    String option = "";
    
    if(choice == 0)
        option = "Yes";
    else if(choice == 1)
        option = "No";
    else
        option = "Both";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Would like to be able to set colors of headings and such, different font
would like to know how can this be implemented in Joomla. I have a
would like to be able to load a website without loading it in Safari
would like to put fieldSets side-by-side on my Edit page because I have so
Would like to know what does Drupal 7 and Acquia have in common? I
Would like to be able to populate any properties of an object and search
Would like to have an executable save its state by modifying its own global
would like to set this convention up globally if possible.
would like to have a central place to register new signals, connect to signals,
Would like to ask for advice. there is a need for binary to have

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.