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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:22:50+00:00 2026-06-10T05:22:50+00:00

Is it possible to have a button in a TableViewerColumn? There are several posts

  • 0

Is it possible to have a button in a TableViewerColumn? There are several posts that confirm this, but I’ve found no code that actually works. I’ve read about a DialogCellEditor, too, is that what to look into?

Regards,
Marcus

  • 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-10T05:22:51+00:00Added an answer on June 10, 2026 at 5:22 am

    As this seems to be a common problem, I’ve tried a workaround. I use an image as label and add editing support like so:

            col = createTableViewerColumn(titles[10], bounds[10], 10);
        col.setEditingSupport(new DeleteSupport(viewer));
        col.setLabelProvider(new ColumnLabelProvider() {
            @Override
            public Image getImage(Object element) {
                return new Image(ApplicationRunner.getApp().getShell()
                        .getDisplay(), "ressources/images/delete.png");
            }
    
            @Override
            public String getText(Object element) {
                return "";
            }
        });
    

    In the DeleteSupport class (extending EditingSupport), you have to let canEdit() return false, so the image is not selectable. But then, you can’t work with getValue(). So, I do whatever I have to in canEdit() BEFORE returning false. That’s the same behavior as a simple push button would have.

    The DeleteSupport looks like this:

    public class DeleteSupport extends EditingSupport {
    
    private final TableViewer viewer;
    
    public DeleteSupport(TableViewer viewer) {
        super(viewer);
        this.viewer = viewer;
    }
    
    @Override
    protected CellEditor getCellEditor(Object element) {
        return new TextCellEditor(viewer.getTable());
    }
    
    @Override
    protected boolean canEdit(Object element) {
    
                // if confirmed, try to delete the customer
        if (MessageDialog.openConfirm(  ApplicationRunner.getApp().getShell(),
                        "Confirm delete",
                        "Soll " + ((Customer) element).getFirstname()
                        + " " + ((Customer) element).getLastname()
                        + " be deleted? Cannot be undone!")) {
    
            try {
                CustomerDAO.getInstance().delete(((Customer) element).getId());
            } catch (SQLException e) {
                // TODO something
            }
        }
    
                // reload anyways
        try {
            viewer.setInput(CustomerDAO.getInstance().getAll());
        } catch (SQLException e) {
            // TODO something else
        }
        viewer.refresh();
    
        return false;
    }
    
    @Override
    protected Object getValue(Object element) {
        return "";
    }
    
    @Override
    protected void setValue(Object element, Object value) {
    }
    

    }

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

Sidebar

Related Questions

Is this possible? Code: $('#goRightBtn').click(function() { Random code here }; I have a button,
The title sounds confusing.. but im sure this is possible! I have one button,
Is it possible to have a link/button that will execute an AJAX/Jquery function to
Would this be possible? The app will have a button and a Text Field
I have this button image: I was wondering whether it would be possible to
Is it possible to have a button open a pop-up window that on page
Is it possible to have the button that pulls up the calendar in the
Is it possible to have a button on a page that makes an embedded
Is it possible to have a button that doesn't post back to the server,
Is it possible in Gtk+ to have an add-tab button inline with the tabs

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.