/**
   * This method is used to set the cell editors text
   *
   * @param toEdit String to be set in the cell editor
   */
  public void setEditText(String toEdit) {

    // Get the cell editor
    CellEditor cellEditor = getCellEditor();

    // IF the cell editor doesn't exist yet...
    if (cellEditor == null) {
      // Do nothing
      return;
    }

    // Get the Text Compartment Edit Part
    IXtextAwareEditPart textEP = (IXtextAwareEditPart) getEditPart();

    // Get the Text control
    StyledText textControl = (StyledText) cellEditor.getControl();

    // Set the Figures text
    textEP.setLabelText(toEdit);

    // See RATLC00522324
    if (cellEditor instanceof TextCellEditorEx) {
      ((TextCellEditorEx) cellEditor).setValueAndProcessEditOccured(toEdit);
    } else {
      cellEditor.setValue(toEdit);
    }

    // Set the controls text and position the caret at the end of the text
    textControl.setSelection(toEdit.length());
  }
示例#2
0
  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;
  }
    protected void doSetValue(Object value) {

      if (((IStructuredSelection) this.viewer.getSelection()).getFirstElement()
          instanceof MyModel3) {
        activeEditor = delegatingCheckBoxEditor;
      } else if (((IStructuredSelection) this.viewer.getSelection()).getFirstElement()
          instanceof MyModel2) {
        activeEditor = delegatingDropDownEditor;
      } else {
        activeEditor = delegatingTextEditor;
      }

      activeEditor.setValue(value);
    }
示例#4
0
  /*
   * (non-Javadoc)
   *
   * @see
   * org.eclipse.ui.views.properties.IPropertySheetEntry#getEditor(org.eclipse
   * .swt.widgets.Composite)
   */
  public CellEditor getEditor(Composite parent) {

    if (editor == null || editor.getControl().isDisposed()) {
      editor = descriptor.createPropertyEditor(parent);
      if (editor != null) {
        editor.addListener(cellEditorListener);
      }
    }
    // && !eq(editor.getValue(), editValue)
    if (editor != null) {
      editor.setValue(editValue);
    }
    return editor;
  }
示例#5
0
    protected void initializeCellEditorValue(CellEditor cellEditor, ViewerCell cell) {

      String selectedVersion;
      if (cell.getElement() instanceof JarDiff) {
        selectedVersion = ((JarDiff) cell.getElement()).getSelectedVersion();
      } else {
        PackageInfo pi = (PackageInfo) cell.getElement();
        selectedVersion = pi.getSelectedVersion();
      }

      String[] items = ((ComboBoxCellEditor) cellEditor).getItems();
      int idx = 0;
      for (int i = 0; i < items.length; i++) {
        if (items[i].equals(selectedVersion)) {
          idx = i;
          break;
        }
      }

      cellEditor.setValue(idx);
      cell.setText(selectedVersion);
    }
示例#6
0
    @Override
    protected void initializeCellEditorValue(CellEditor cellEditor, ViewerCell cell) {

      String selectedVersion = "";
      if (cell.getElement() instanceof Baseline) {
        selectedVersion = ((Baseline) cell.getElement()).getSuggestedVersion().toString();
      } else if (cell.getElement() instanceof Info) {
        selectedVersion = ((Info) cell.getElement()).suggestedVersion.toString();
      }

      String[] items = ((ComboBoxCellEditor) cellEditor).getItems();
      int idx = 0;
      for (int i = 0; i < items.length; i++) {
        if (items[i].equals(selectedVersion)) {
          idx = i;
          break;
        }
      }

      cellEditor.setValue(idx);
      cell.setText(selectedVersion);
    }