Package org.eclipse.jface.databinding.viewers

Examples of org.eclipse.jface.databinding.viewers.ObservableValueEditingSupport


    tableViewer.setContentProvider(new ObservableListContentProvider());
    tableViewer.setInput(writableList);

    DataBindingContext ctx = new DataBindingContext();

    meterUnitColumn.setEditingSupport(new ObservableValueEditingSupport(
        tableViewer, ctx) {
      private TextCellEditor textEditor;

      @Override
      protected IObservableValue doCreateCellEditorObservable(
          CellEditor cellEditor) {
        return SWTObservables.observeText(cellEditor.getControl(),
            SWT.Modify);
      }

      @Override
      protected IObservableValue doCreateElementObservable(
          Object element, ViewerCell cell) {
        return BeansObservables.observeValue(element, "meterUnit");
      }

      @Override
      protected CellEditor getCellEditor(Object element) {
        if (textEditor == null) {
          textEditor = new TextCellEditor((Composite) tableViewer
              .getControl());
          tableViewer.getColumnViewerEditor()
              .addEditorActivationListener(
                  columnViewerActivationListener);
        }
        return textEditor;
      }
    });

    meterCountColumn.setEditingSupport(new ObservableValueEditingSupport(
        tableViewer, ctx) {
      private TextCellEditor textEditor;

      @Override
      protected IObservableValue doCreateCellEditorObservable(
          CellEditor cellEditor) {
        return SWTObservables.observeText(cellEditor.getControl(),
            SWT.Modify);
      }

      @Override
      protected IObservableValue doCreateElementObservable(
          Object element, ViewerCell cell) {
        return BeansObservables.observeValue(element, "meterCount");
      }

      @Override
      protected CellEditor getCellEditor(Object element) {
        if (textEditor == null) {
          textEditor = new TextCellEditor((Composite) tableViewer
              .getControl());

          tableViewer.getColumnViewerEditor()
              .addEditorActivationListener(
                  columnViewerActivationListener);
        }
        return textEditor;
      }
    });

    clefShapeColumn.setEditingSupport(new ObservableValueEditingSupport(
        tableViewer, ctx) {
      private ComboBoxViewerCellEditor cellEditor;

      @Override
      protected IObservableValue doCreateCellEditorObservable(
          CellEditor cellEditor) {
        return ViewersObservables
            .observeSingleSelection(((ComboBoxViewerCellEditor) cellEditor)
                .getViewer());
      }

      @Override
      protected IObservableValue doCreateElementObservable(
          Object element, ViewerCell cell) {
        return BeansObservables.observeValue(element, "clefShape");
      }

      @Override
      protected CellEditor getCellEditor(Object element) {
        if (cellEditor == null) {
          cellEditor = new ComboBoxViewerCellEditor(
              (Composite) tableViewer.getControl());
          cellEditor.setContentProvider(new ArrayContentProvider());
          cellEditor.setLabelProvider(new LabelProvider());
          cellEditor.setInput(DataCLEFSHAPE.values());
          tableViewer.getColumnViewerEditor()
              .addEditorActivationListener(
                  columnViewerActivationListener);
        }
        return cellEditor;
      }
    });

    keySigColumn.setEditingSupport(new ObservableValueEditingSupport(
        tableViewer, ctx) {
      private ComboBoxViewerCellEditor cellEditor;

      @Override
      protected IObservableValue doCreateCellEditorObservable(
View Full Code Here

TOP

Related Classes of org.eclipse.jface.databinding.viewers.ObservableValueEditingSupport

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.