@Override protected Object doGetValue(Object source) { return ((CellEditor) source).getControl(); }
/** * Activate the editor but also inform the editor which event triggered its * activation. <b>The default implementation simply calls * {@link #activate()}</b> * * @param activationEvent * the editor activation event * @since 3.3 */ public void activate(ColumnViewerEditorActivationEvent activationEvent) { activate(); }
public CellEditor getEditor(Composite parent) { if (editor == null) { editor = descriptor.createPropertyEditor(parent); if (editor != null) { editor.addListener(cellEditorListener); } } if (editor != null) { editor.setValue(editValue); setErrorText(editor.getErrorMessage()); } return editor; }
@Override public void applyEditorValue() { fEditor.removeListener(this); modifyValue(fRow, fCol, fEditor.getValue()); }
/** * Processes a focus lost event that occurred in this cell editor. * <p> * The default implementation of this framework method applies the current * value and deactivates the cell editor. Subclasses should call this method * at appropriate times. Subclasses may also extend or reimplement. * </p> */ protected void focusLost() { if (isActivated()) { fireApplyEditorValue(); deactivate(); } }
/** * Processes a key release event that occurred in this cell editor. * <p> * The default implementation of this framework method cancels editing when * the ESC key is pressed. When the RETURN key is pressed the current value * is applied and the cell editor deactivates. Subclasses should call this * method at appropriate times. Subclasses may also extend or reimplement. * </p> * * @param keyEvent * the key event */ protected void keyReleaseOccured(KeyEvent keyEvent) { if (keyEvent.character == '\u001b') { // Escape character fireCancelEditor(); } else if (keyEvent.character == '\r') { // Return key fireApplyEditorValue(); deactivate(); } }
cellEditor.activate(); Control control = cellEditor.getControl(); if (control == null) { cellEditor.deactivate(); cellEditor = null; return; cellEditor.addListener(editorListener); CellEditor.LayoutData layout = cellEditor.getLayoutData(); treeEditor.horizontalAlignment = layout.horizontalAlignment; treeEditor.grabHorizontal = layout.grabHorizontal; setErrorMessage(cellEditor.getErrorMessage()); cellEditor.setFocus();
cellEditor = part.getEditingSupport().getCellEditor(element); if (cellEditor != null) { int timeout = cellEditor.getDoubleClickTimeout(); cellEditor.addListener(cellEditorListener); part.getEditingSupport().initializeCellEditorValue(cellEditor, cell); final Control control = cellEditor.getControl(); cellEditor.activate(activationEvent); if (control == null) { return false; setLayoutData(cellEditor.getLayoutData()); setEditor(control, (Item) cell.getItem(), cell.getColumnIndex()); cellEditor.setFocus(); if (cellEditor.dependsOnExternalFocusListener()) { if (focusListener == null) { focusListener = new FocusAdapter() {
fCellEditor = fCellEditors[fColumnNumber]; fCellEditor.addListener(fCellEditorListener); Object value = fCellModifier.getValue(element, property); fCellEditor.setValue(value); final Control control = fCellEditor.getControl(); fCellEditor.activate(); if (control == null) return; setLayoutData(fCellEditor.getLayoutData()); setEditor(control, fTableItem, fColumnNumber); fCellEditor.setFocus(); if (fFocusListener == null) { fFocusListener = new FocusAdapter() {
/** * Deactivates the currently active cell editor. */ public void applyEditorValue() { CellEditor c = fCellEditor; if (c != null) { // null out cell editor before calling save // in case save results in applyEditorValue being re-entered // see 1GAHI8Z: ITPUI:ALL - How to code event notification when // using cell editor ? fCellEditor = null; Item t = fTableItem; // don't null out table item -- same item is still selected if (t != null && !t.isDisposed()) { saveEditorValue(c, t); } setEditor(null, null, 0); c.removeListener(fCellEditorListener); Control control = c.getControl(); if (control != null) { if (fMouseListener != null) { control.removeMouseListener(fMouseListener); } if (fFocusListener != null) { control.removeFocusListener(fFocusListener); } } c.deactivate(); } }
if (t != null && !t.isDisposed() && c.isValueValid()) { saveEditorValue(c); c.removeListener(cellEditorListener); Control control = c.getControl(); if (control != null && !control.isDisposed()) { if (mouseListener != null) { c.deactivate(tmp);
Control control = editor.getControl(); editor.setValue(cellValue); editor.setFocus(); editor.addListener(fCellEditorListener);
CCombo combo = (CCombo) getCellEditor().getControl(); combo.setFont(label.getFont()); combo.setForeground(label.getForegroundColor()); getCellEditor().addListener(cellEditorListener); getCellEditor().setValue(new Integer(i)); break;
/** * Cancels the active cell editor, without saving the value back to the * domain model. */ public void cancelEditing() { if (cellEditor != null) { setEditor(null, null, 0); cellEditor.removeListener(cellEditorListener); CellEditor oldEditor = cellEditor; cellEditor = null; oldEditor.deactivate(); } }
protected void initCellEditor() { Text text = (Text)getCellEditor().getControl(); Label label = ((INamedEditPart) getEditPart()).getNameLabelFigure(); getCellEditor().setValue(initialLabelText);
_wrapped = new TextCellEditor(cell); _wrapped.addListener(new ICellEditorListener() { public void applyEditorValue() { fireApplyEditorValue(); _wrapped.addPropertyChangeListener(new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { _wrapped.getControl().setVisible(true); _wrapped.getControl().addListener(SWT.Hide, new Listener() { public void handleEvent(Event event) { Display.getCurrent().asyncExec(new Runnable() { return _wrapped.getControl();
protected void doSetFocus() { if (_wrapped != null && _wrapped.getControl() != null && !_wrapped.getControl().isDisposed()) { _wrapped.setFocus(); } else { _button.setFocus(); } }
public void activate() { Object element = fTreeItem.getData(); String value = cellModifier.getValue(element, fProperty).toString(); if (fControl instanceof Text) { Text text = (Text) fControl; int requiredSize = value.length() + 100; if (text.getTextLimit() < requiredSize) { text.setTextLimit(requiredSize); } } Rectangle r = fTreeItem.getBounds(); if (r != null) { fControl.setBounds(columnPosition + 5, r.y + 1, fTree1.getClientArea().width - (columnPosition + 5), r.height - 1); fControl.setVisible(true); fCellEditor.setValue(value); fCellEditor.addListener(this); fCellEditor.setFocus(); fControl.addFocusListener(this); } }
public void applyEditorValue() { if (editor == null) { return; } // Check if editor has a valid value if (!editor.isValueValid()) { setErrorText(editor.getErrorMessage()); return; } setErrorText(null); // See if the value changed and if so update Object newValue = editor.getValue(); boolean changed = false; if (values.length > 1) { changed = true; } else if (editValue == null) { if (newValue != null) { changed = true; } } else if (!editValue.equals(newValue)) { changed = true; } // Set the editor value if (changed) { setValue(newValue); } }
protected Object doGetValue() { return _wrapped.getValue(); }