@Override protected CellEditor[] createCellEditors() { CellEditor[] editors = new CellEditor[columnNames.length]; TextCellEditor textEditor = new TextCellEditor(table); editors[0] = textEditor; textEditor = new TextCellEditor(table); editors[1] = textEditor; return editors; } }
public void keyPressed(KeyEvent e) { keyReleaseOccured(e); // as a result of processing the above call, clients may have // disposed this cell editor if ((getControl() == null) || getControl().isDisposed()) { return; } checkSelection(); // see explanation below checkDeleteable(); checkSelectable(); } });
/** * Processes a modify event that occurred in this text cell editor. * This framework method performs validation and sets the error message * accordingly, and then reports a change via <code>fireEditorValueChanged</code>. * Subclasses should call this method at appropriate times. Subclasses * may extend or reimplement. * * @param e the SWT modify event */ protected void editOccured(ModifyEvent e) { String value = text.getText(); if (value == null) { value = "";//$NON-NLS-1$ } Object typedValue = value; boolean oldValidState = isValueValid(); boolean newValidState = isCorrect(typedValue); if (!newValidState) { // try to insert the current value into the error message. setErrorMessage(MessageFormat.format(getErrorMessage(), new Object[] { value })); } valueChanged(oldValidState, newValidState); }
/** * The <code>TextCellEditor</code> implementation of this * <code>CellEditor</code> method cuts the * current selection to the clipboard. */ @Override public void performCut() { text.cut(); checkSelection(); checkDeleteable(); checkSelectable(); }
/** * The <code>TextCellEditor</code> implementation of this * <code>CellEditor</code> method selects all of the * current text. */ @Override public void performSelectAll() { text.selectAll(); checkSelection(); checkDeleteable(); }
TextCellEditor cellEditor = new TextCellEditor(table); cellEditor.getControl().pack(); fPropertiesTable.setCellEditors(new CellEditor[] {null, cellEditor}); fPropertiesTable.setColumnProperties(new String[] {"0", "1"}); // You must enter column properties to have cell editors //$NON-NLS-1$//$NON-NLS-2$
key.setWidth(150); final TextCellEditor editor = new TextCellEditor(tree); editor.setValidator(new ICellEditorValidator() { editor.addListener(new ICellEditorListener() {
Text text = (Text)selectedEditor.getControl(); selectedEditor.setFocus();
public void editorValueChanged(boolean oldValidState, boolean newValidState) { setErrorMessage(editor.getErrorMessage()); }
/** * The <code>TextCellEditor</code> implementation of this * <code>CellEditor</code> method pastes the * the clipboard contents over the current selection. */ @Override public void performPaste() { text.paste(); checkSelection(); checkDeleteable(); checkSelectable(); }
/** * The <code>TextCellEditor</code> implementation of this * <code>CellEditor</code> method selects all of the * current text. */ @Override public void performSelectAll() { text.selectAll(); checkSelection(); checkDeleteable(); }
@Override public CellEditor getCellEditor(IPresentationContext context, String columnId, Object element, Composite parent) { return new TextCellEditor(parent); }
/** * Processes a modify event that occurred in this text cell editor. * This framework method performs validation and sets the error message * accordingly, and then reports a change via <code>fireEditorValueChanged</code>. * Subclasses should call this method at appropriate times. Subclasses * may extend or reimplement. * * @param e the SWT modify event */ protected void editOccured(ModifyEvent e) { String value = text.getText(); if (value == null) { value = "";//$NON-NLS-1$ } Object typedValue = value; boolean oldValidState = isValueValid(); boolean newValidState = isCorrect(typedValue); if (!newValidState) { // try to insert the current value into the error message. setErrorMessage(MessageFormat.format(getErrorMessage(), value)); } valueChanged(oldValidState, newValidState); }
/** * The <code>TextCellEditor</code> implementation of this * <code>CellEditor</code> method cuts the * current selection to the clipboard. */ @Override public void performCut() { text.cut(); checkSelection(); checkDeleteable(); checkSelectable(); }
@Override public void keyPressed(KeyEvent e) { keyReleaseOccured(e); // as a result of processing the above call, clients may have // disposed this cell editor if ((getControl() == null) || getControl().isDisposed()) { return; } checkSelection(); // see explanation below checkDeleteable(); checkSelectable(); } });
/** * The <code>TextCellEditor</code> implementation of this * <code>CellEditor</code> method selects all of the * current text. */ public void performSelectAll() { text.selectAll(); checkSelection(); checkDeleteable(); }
@Override public CellEditor getCellEditor(IPresentationContext context, String columnId, Object element, Composite parent) { return new TextCellEditor(parent); }
/** * Processes a modify event that occurred in this text cell editor. * This framework method performs validation and sets the error message * accordingly, and then reports a change via <code>fireEditorValueChanged</code>. * Subclasses should call this method at appropriate times. Subclasses * may extend or reimplement. * * @param e the SWT modify event */ protected void editOccured(ModifyEvent e) { String value = text.getText(); if (value == null) { value = "";//$NON-NLS-1$ } Object typedValue = value; boolean oldValidState = isValueValid(); boolean newValidState = isCorrect(typedValue); if (!newValidState) { // try to insert the current value into the error message. setErrorMessage(MessageFormat.format(getErrorMessage(), new Object[] { value })); } valueChanged(oldValidState, newValidState); }
/** * The <code>TextCellEditor</code> implementation of this * <code>CellEditor</code> method pastes the * the clipboard contents over the current selection. */ @Override public void performPaste() { text.paste(); checkSelection(); checkDeleteable(); checkSelectable(); }
@Override public void keyPressed(KeyEvent e) { keyReleaseOccured(e); // as a result of processing the above call, clients may have // disposed this cell editor if ((getControl() == null) || getControl().isDisposed()) { return; } checkSelection(); // see explanation below checkDeleteable(); checkSelectable(); } });