/*
   * In gtk, the focus lost event is fired _after_ the CR event, so we need to
   * remember the state when the proposal popup window is open.
   */
  @Override
  protected void focusLost() {
    if (SWT.getPlatform().equals("gtk")) {
      if (ignoreNextFocusLost) {
        ignoreNextFocusLost = false;
        return;
      }

      if (completionProposalAdapter.isProposalPopupOpen()) {
        ignoreNextFocusLost = true;
        return;
      }
    }

    if (!completionProposalAdapter.isProposalPopupOpen()) super.focusLost();
  }
 @Override
 protected void doSetValue(Object value) {
   if (value instanceof CellEditorPartialValue) {
     CellEditorPartialValue partialValue = (CellEditorPartialValue) value;
     xtextAdapter.getXtextDocument().set(partialValue.getWholeText());
     xtextAdapter.sourceviewer.setDocument(
         xtextAdapter.getXtextDocument(),
         xtextAdapter.sourceviewer.getAnnotationModel(),
         partialValue.getOffset(),
         partialValue.getLength());
   } else {
     super.doSetValue(value);
   }
   // Reset the undo manager to prevend deletion of complete text if the
   // user hits ctrl+z after cell editor opens
   xtextAdapter.sourceviewer.getUndoManager().reset();
 }
 @Override
 public void dispose() {
   xtextAdapter.dispose();
   super.dispose();
 }
 protected void keyReleaseOccured(KeyEvent keyEvent) {
   if (keyEvent.character == '\u001b') { // ESC
     return;
   }
   super.keyReleaseOccured(keyEvent);
 }