/** * Handles the mouse down event; activates the cell editor. * * @param event * the mouse event that should be handled */ public void handleMouseDown(MouseEvent event) { if (event.button != 1) { return; } if (cellEditor != null) { applyEditorValue(); } // activate the cell editor immediately. If a second mouseDown // is received prior to the expiration of the doubleClick time then // the cell editor will be deactivated and a doubleClick event will // be processed. // doubleClickExpirationTime = event.time + Display.getCurrent().getDoubleClickTime(); Item[] items = getSelection(); // Do not edit if more than one row is selected. if (items.length != 1) { tableItem = null; return; } tableItem = items[0]; activateCellEditor(event); }
/** * Start editing the given element. * * @param element * @param column */ public void editElement(Object element, int column) { if (cellEditor != null) { applyEditorValue(); } setSelection(new StructuredSelection(element), true); Item[] selection = getSelection(); if (selection.length != 1) { return; } tableItem = selection[0]; // Make sure selection is visible showSelection(); columnNumber = column; activateCellEditor(); }
@Override public void applyEditorValue() { TableTreeEditorImpl.this.applyEditorValue(); } };
@Override public void focusLost(FocusEvent e) { applyEditorValue(); } };