Note that there are some explanatory texts on larger screens.

plurals
  1. POAdding a delete icon column to an Eclipse table
    primarykey
    data
    text
    <p>I've currently implemented a <a href="http://help.eclipse.org/indigo/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/widgets/Table.html" rel="nofollow noreferrer"><code>Table</code></a> with a <a href="http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/custom/TableEditor.html" rel="nofollow noreferrer"><code>TableEditor</code></a> in my Eclipse plugin to support cell-level editing with keyboard support (to traverse cells with the editor).</p> <p>I also need a way to delete rows, and I didn't want to go with the practice of adding a delete button next to the table as it requires 2 clicks to delete a row (1 to select a row, and 1 to delete it). Instead I want a separate column which is populated with delete icons. I've thought of 2 ways to accomplish this and have run into issues with both:</p> <ol> <li><p><strong>Add another column to the <code>Table</code>, set the icon with <a href="http://help.eclipse.org/indigo/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/widgets/TableItem.html" rel="nofollow noreferrer"><code>TableItem.setImage()</code></a>.</strong> There are multiple issues with this approach, and you can see them below:</p> <ul> <li>When selecting a row, the icon gets selected too</li> <li>When hovering over the icon, it gets a tooltip of the image which apparently can't be disabled</li> <li>Can't seem to vertically center the image inside the cell<br> &nbsp;</li> </ul> <p><img src="https://i.stack.imgur.com/pKf5S.png" alt="Delete column approach #1"></p></li> <li><p><strong>Add a <a href="http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/custom/ScrolledComposite.html" rel="nofollow noreferrer"><code>ScrolledComposite</code></a> next to the table and fill it with delete icons.</strong> This sounds a little insane, but I've actually made it pretty far with this one. The idea is to fill a <code>ScrolledComposite</code> with delete icons, force it to scroll with the table's scrollbar, and delete the corresponding row when an icon is clicked. I've only run into one blocking issue with this approach:</p> <ul> <li>Can't seem to hide the scrollbar<br> &nbsp;</li> </ul> <p><img src="https://i.stack.imgur.com/DDZRL.png" alt="Delete column approach #2"></p></li> </ol> <p>So my questions are:</p> <ul> <li>How I can solve the issues mentioned for either of these approaches?</li> <li>Is there some other better approach?</li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload