Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Eclipse Table widget with SWT.CHECK is fireing two events when a TableItem is selected
- final Table table = new Table( composite, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION | SWT.CHECK );
- table.setHeaderVisible(true);
- table.setLinesVisible(false);
- (...)
- table.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- CheckThatOnlyOneItemCanBeCheckedAtTime(e.item);
- //If someone check on me, save the item data value in a "container"
- if( e.detail == SWT.CHECK ) {
- MBSCustomPageManager.addPageProperty(PAGE_ID, "SDK_Path", ((ISdk)((TableItem)e.item).getData()).getPath() );
- } else { //Otherwise, unset the saved value
- MBSCustomPageManager.addPageProperty(PAGE_ID, "SDK_Path", "" );
- }
- }
- });
- table.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event arg0) {
- String string = arg0.detail == SWT.CHECK ? "Checked"
- : "Selected";
- if (arg0.detail == SWT.CHECK)
- System.out.println(arg0.item + " " + string+":"+((Table)arg0.widget).getSelection()[0].getChecked());
- else
- System.out.println(arg0.item + " " + string);
- }
- });
Add Comment
Please, Sign In to add comment