List of usage examples for org.eclipse.jface.databinding.viewers CellEditorProperties control
public static IValueProperty<CellEditor, Control> control()
From source file:ccw.preferences.HoverPreferencePage.java
License:Open Source License
protected DataBindingContext initDataBindings() { final DataBindingContext context = new DataBindingContext(); // Page Support PreferencePageSupport.create(this, context); // /////////////////////////// // Label/Content providers \\ // /////////////////////////// ObservableListContentProvider contentProvider = new ObservableListContentProvider(); IObservableMap[] columnsObservables = Properties.observeEach(contentProvider.getKnownElements(), HoverViewModel.hoverDisplayDomain); ObservableMapLabelProvider labelProvider = new ObservableMapLabelProvider(columnsObservables); fHoverTableViewer.setLabelProvider(labelProvider); fHoverTableViewer.setContentProvider(contentProvider); fHoverTableViewer.setInput(fViewModel.hoverObservableList); ////////////////////////// // Selected hover logic \\ ////////////////////////// final IObservableValue selectedHover = ViewersObservables.observeSingleSelection(fHoverTableViewer); final IObservableValue isHoverSelected = new ComputedValue(Boolean.TYPE) { @Override/* w ww . ja v a2s . c om*/ protected Object calculate() { return Boolean.valueOf(selectedHover.getValue() != null); } }; context.bindValue(WidgetProperties.enabled().observe(fGrpSummary), isHoverSelected); context.bindValue(WidgetProperties.enabled().observe(fSummaryHoverModifierStringText), isHoverSelected); final IObservableValue stateMaskOfSelected = HoverViewModel.hoverStateMask.observeDetail(selectedHover); final IObservableValue modifierStringOfSelected = HoverViewModel.hoverModifierString .observeDetail(selectedHover); final UpdateValueStrategy modifierStringStrategyConvert = new UpdateValueStrategy( UpdateValueStrategy.POLICY_CONVERT); modifierStringStrategyConvert.setConverter(new HoverViewModel.StateMaskToModifierConverter()); final Binding stateMaskToModifierBinding = context.bindValue(modifierStringOfSelected, stateMaskOfSelected, new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER), modifierStringStrategyConvert); if (!fViewModel.hoverObservableList.isEmpty()) { selectedHover.setValue(fViewModel.hoverObservableList.get(0)); } ////////////////////// // Validation logic \\ ////////////////////// MultiValidator validator = new MultiValidator() { @Override protected IStatus validate() { IStatus status = ValidationStatus.ok(); if (isHoverSelected.getValue() == Boolean.TRUE) { status = fViewModel.stateMaskValidator.validate(stateMaskOfSelected.getValue()); } if (status.isOK()) { Iterator<HoverDescriptor> it = fViewModel.checkedSet.iterator(); while (it.hasNext()) { int stateMask = it.next().getStateMask(); if (!fViewModel.isStateMaskUnique(stateMask)) { status = fViewModel.stateMaskError(stateMask); } } } return status; } }; context.addValidationStatusProvider(validator); ////////////////////////// // Checked hovers logic \\ ////////////////////////// // AR - because of some ordering issue problem, I am disabling the automatic // update from model to target of the checked hovers and... final UpdateSetStrategy checkedModelToTargetStrategy = new UpdateSetStrategy( UpdateValueStrategy.POLICY_ON_REQUEST); // AR - ... add an explicit binding that will be needed... final Binding checkedBindSet = context.bindSet( ViewersObservables.observeCheckedElements(fHoverTableViewer, HoverDescriptor.class), fViewModel.checkedSet, null, checkedModelToTargetStrategy); // AR - ...to manually trigger the update when new elements are added to the provider... IObservableSet realizedElements = contentProvider.getRealizedElements(); realizedElements.addChangeListener(new IChangeListener() { @Override public void handleChange(ChangeEvent event) { checkedBindSet.updateModelToTarget(); } }); ///////////////// // UI Bindings \\ ///////////////// EditingSupport modifierEditorSupport = ObservableValueEditingSupport.create(fHoverTableViewer, context, fHoverModifierStringTextCellEditor, CellEditorProperties.control().value(WidgetProperties.text(SWT.Modify)), HoverViewModel.hoverModifierString); fModifierTableViewerColumn.setEditingSupport(modifierEditorSupport); final UpdateValueStrategy statusMaskToModifierStrategy = new UpdateValueStrategy(); statusMaskToModifierStrategy.setConverter(new HoverViewModel.StateMaskToModifierConverter()); final UpdateValueStrategy modifierToStatusMaskStrategy = new UpdateValueStrategy(); modifierToStatusMaskStrategy.setConverter(new HoverViewModel.ModifierToStateMaskConverter()); context.bindValue(WidgetProperties.text().observe(fSummaryHoverNameLabel), HoverViewModel.hoverLabel.observeDetail(selectedHover)); context.bindValue(WidgetProperties.text().observe(fSummaryHoverDescriptionLabel), HoverViewModel.hoverDescription.observeDetail(selectedHover)); context.bindValue(WidgetProperties.text().observe(fSummaryHoverModifierStringText), HoverViewModel.hoverStateMask.observeDetail(selectedHover), modifierToStatusMaskStrategy, statusMaskToModifierStrategy); KeyListener stateMaskKeyListener = new KeyListener() { public void keyPressed(KeyEvent e) { boolean isPressedKeyModifier = e.keyCode > 0 && e.character == 0 && (e.keyCode & SWT.MODIFIER_MASK) != 0; boolean isStateKeyModifier = e.stateMask > 0 && (e.stateMask & SWT.MODIFIER_MASK) != 0; int mask = SWT.NONE; if (isPressedKeyModifier) { mask = e.keyCode; if (isStateKeyModifier) { mask |= e.stateMask; } stateMaskOfSelected.setValue(mask); stateMaskToModifierBinding.updateModelToTarget(); } } public void keyReleased(KeyEvent e) { if (e.keyCode == SWT.BS || e.keyCode == SWT.DEL) { stateMaskOfSelected.setValue(SWT.NONE); stateMaskToModifierBinding.updateModelToTarget(); } } }; fHoverModifierStringTextCellEditor.getControl().addKeyListener(stateMaskKeyListener); fSummaryHoverModifierStringText.addKeyListener(stateMaskKeyListener); return context; }
From source file:era.foss.typeeditor.common.Ui.java
License:Open Source License
/** * Create a column with EMF databinding for a table viewer * // w w w. j a v a2 s . com * <li>In case the top level structural feature is a reference display a combo box</li> <li>In case the top level * structural feature is a containment reference create element if it does not exist</li> <li>In case the structural * feature is a boolean show a checkbox</li> <li>Otherwise show a simple text field</li>. * * @param column the column * @param eStructuralFeatureList list to create a feature path from * @param refObservedObject the ref observed object * @param refEStructuralFeatureList the ref e structural feature list */ public void bindColumn(TableViewerColumn column, EStructuralFeature[] eStructuralFeatureList, EObject refObservedObject, EStructuralFeature[] refEStructuralFeatureList) { TableViewer tableViewer = (TableViewer) column.getViewer(); ObservableListContentProvider cp = (ObservableListContentProvider) tableViewer.getContentProvider(); assert (cp != null); // get the top level structural feature EStructuralFeature topStructuralFeature = eStructuralFeatureList[0]; // set label provider IValueProperty elementProperty = EMFEditProperties.value(editingDomain, FeaturePath.fromList(eStructuralFeatureList)); IObservableMap attributeMap = elementProperty.observeDetail(cp.getKnownElements()); column.setLabelProvider(new ObservableMapCellLabelProvider(attributeMap)); EditingSupport editingSupport = null; // Show combo box for references if (refObservedObject != null && refEStructuralFeatureList != null) { // Combo box: Create combo box to select choices for the reference ComboBoxViewerCellEditor combo = new ComboBoxViewerCellEditorSp((Composite) tableViewer.getControl(), SWT.READ_ONLY); // Combo box: Set Content Provider ObservableListContentProvider comboContentProvider = new ObservableListContentProvider(); combo.setContentProvider(comboContentProvider); IObservableMap comboAttributeMap = EMFProperties .value(eStructuralFeatureList[eStructuralFeatureList.length - 1]) .observeDetail(comboContentProvider.getKnownElements()); combo.setLabelProvider(new ObservableMapLabelProvider(comboAttributeMap)); // Combo box: set input IEMFListProperty dataTypeDefinitions = EMFProperties .list(FeaturePath.fromList(refEStructuralFeatureList)); combo.setInput(dataTypeDefinitions.observe(refObservedObject)); // Set editing support of table cell IValueProperty editorElementProperty = EMFEditProperties.value(editingDomain, topStructuralFeature); IValueProperty cellEditorProperty = ViewerProperties.singleSelection(); editingSupport = ObservableValueEditingSupport.create(tableViewer, dataBindContext, combo, cellEditorProperty, editorElementProperty); } // Simple text else { IValueProperty cellEditorProperty = CellEditorProperties.control() .value(WidgetProperties.text(SWT.Modify)); editingSupport = ObservableValueEditingSupport.create(tableViewer, dataBindContext, new TextCellEditor(tableViewer.getTable()), cellEditorProperty, elementProperty); } column.setEditingSupport(editingSupport); }
From source file:era.foss.typeeditor.spectype.SpecTypeForm.java
License:Open Source License
/** Create column for selecting the DatatypeDefinition associated with the AttributeDefinition */ private void createSpecAttributeNameColumn(AddDeleteTableViewer specAttributeTableViewer, TableColumnLayout columnLayout) { ///*from w ww . j ava 2 s. c o m*/ TableViewerColumn nameColumn = new TableViewerColumn(specAttributeTableViewer, SWT.NONE); nameColumn.getColumn().setText(Ui.getUiName(ErfPackage.Literals.IDENTIFIABLE__LONG_NAME)); nameColumn.getColumn().setResizable(true); nameColumn.getColumn().setMoveable(false); columnLayout.setColumnData(nameColumn.getColumn(), new ColumnWeightData(34, 100)); IValueProperty nameColumnElementProperty = EMFEditProperties.value(editingDomain, ErfPackage.Literals.IDENTIFIABLE__LONG_NAME); // add label provider IObservableMap nameColumnAttributeMap = nameColumnElementProperty.observeDetail( ((ObservableListContentProvider) specAttributeTableViewer.getContentProvider()).getKnownElements()); nameColumn.setLabelProvider(new ObservableMapCellLabelProvider(nameColumnAttributeMap)); // add editing support IValueProperty nameColumnCellEditorProperty = CellEditorProperties.control() .value(WidgetProperties.text(SWT.Modify)); EditingSupport editingSupport = ObservableValueEditingSupport.create(specAttributeTableViewer, dataBindContext, new TextCellEditor(specAttributeTableViewer.getTable()), nameColumnCellEditorProperty, nameColumnElementProperty); nameColumn.setEditingSupport(editingSupport); }
From source file:org.eclipse.emf.ecp.edit.internal.swt.table.NumberCellEditor.java
License:Open Source License
/** * * {@inheritDoc}/* ww w . ja v a 2s .c o m*/ * * @see org.eclipse.emf.ecp.edit.spi.swt.table.ECPCellEditor#getValueProperty() */ @Override public IValueProperty getValueProperty() { return CellEditorProperties.control().value(WidgetProperties.text(SWT.FocusOut)); }
From source file:org.openscada.prototype.da.spreadsheet.ControllerEditorPart.java
License:Open Source License
private void createItemTable(final Composite wrapper) { this.viewer = new TableViewer(wrapper, SWT.FULL_SELECTION); final TableLayout tableLayout = new TableLayout(); this.viewer.getTable().setLayout(tableLayout); this.viewer.getTable().setHeaderVisible(true); final ObservableSetContentProvider contentProvider = new ObservableSetContentProvider(); this.viewer.setContentProvider(contentProvider); {/*from w w w .j av a2s .c o m*/ final TableViewerColumn col = new TableViewerColumn(this.viewer, SWT.NONE); col.getColumn().setText("Item Id"); tableLayout.addColumnData(new ColumnWeightData(100)); col.setLabelProvider(new CellLabelProvider() { @Override public void update(final ViewerCell cell) { cell.setText(((PrototypeItem) cell.getElement()).getItemId()); } }); } { final TableViewerColumn col = new TableViewerColumn(this.viewer, SWT.NONE); col.getColumn().setText("Simulation Value"); tableLayout.addColumnData(new ColumnWeightData(50)); col.setLabelProvider(new ObservableMapCellLabelProvider( Properties.observeEach(contentProvider.getKnownElements(), BeanProperties.values( PrototypeItem.class, new String[] { PrototypeItem.PROP_SIMULATION_VALUE }))[0])); final TextCellEditor cellEditor = new TextCellEditor(this.viewer.getTable()); final IValueProperty cellEditorProperty = CellEditorProperties.control() .value(WidgetProperties.text(SWT.Modify)); final IValueProperty elementProperty = BeanProperties.value(PrototypeItem.PROP_SIMULATION_VALUE); col.setEditingSupport(new DefaultEditingSupport(this.viewer, this.dbc, cellEditorProperty, cellEditor, elementProperty) { @Override protected UpdateValueStrategy createTargetToModelStrategy() { final UpdateValueStrategy result = new UpdateValueStrategy(); result.setConverter(new Converter(String.class, Variant.class) { @Override public Object convert(final Object fromObject) { return VariantEditor.toVariant((String) fromObject); } }); return result; } }); } { createFlagColumn(tableLayout, contentProvider, "Subscribed", PrototypeItem.PROP_SUBSCRIBED, false); createFlagColumn(tableLayout, contentProvider, "Error", PrototypeItem.PROP_SIMULATION_ERROR_FLAG, true); createFlagColumn(tableLayout, contentProvider, "Alarm", PrototypeItem.PROP_SIMULATION_ALARM_FLAG, true); createFlagColumn(tableLayout, contentProvider, "Manual", PrototypeItem.PROP_SIMULATION_MANUAL_FLAG, true); createFlagColumn(tableLayout, contentProvider, "Block", PrototypeItem.PROP_SIMULATION_BLOCK_FLAG, true); createFlagColumn(tableLayout, contentProvider, "Ack", PrototypeItem.PROP_SIMULATION_ACK_FLAG, true); } this.viewer.setInput(this.serverController.getItems()); this.viewer.setComparator(new ViewerComparator() { @Override public int compare(final Viewer viewer, final Object e1, final Object e2) { return ((PrototypeItem) e1).getItemId().compareTo(((PrototypeItem) e2).getItemId()); } }); }
From source file:org.switchyard.tools.ui.editor.components.jca.JCAPropertyTable.java
License:Open Source License
/** * Constructor.//from w w w .jav a 2 s . com * * @param parent composite parent * @param style any SWT style bits * @param isReadOnly boolean flag * @param toolkit Form toolkit to use when creating controls * @param context the data binding context * @param featurePathToProperties the feature path to the Property list * @param domain the editing domain */ public JCAPropertyTable(Composite parent, int style, boolean isReadOnly, FormToolkit toolkit, DataBindingContext context, FeaturePath featurePathToProperties, EditingDomain domain) { super(parent, style); _isReadOnly = isReadOnly; _changeListeners = new ListenerList(); _bindingValue = new WritableValue(SWTObservables.getRealm(getDisplay()), null, JCABinding.class); int additionalStyles = SWT.NONE; if (isReadOnly) { additionalStyles = SWT.READ_ONLY; } final GridLayout gridLayout = new GridLayout(); gridLayout.marginWidth = 0; gridLayout.marginHeight = 0; gridLayout.numColumns = 2; setLayout(gridLayout); Composite tableComposite = new Composite(this, additionalStyles); GridData gd11 = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 5); gd11.heightHint = 100; tableComposite.setLayoutData(gd11); TableColumnLayout tableLayout = new TableColumnLayout(); tableComposite.setLayout(tableLayout); _propertyTreeTable = new TableViewer(tableComposite, SWT.BORDER | SWT.WRAP | SWT.V_SCROLL | SWT.FULL_SELECTION | additionalStyles); _propertyTreeTable.getTable().setHeaderVisible(true); TableViewerColumn nameColumn = new TableViewerColumn(_propertyTreeTable, SWT.LEFT); nameColumn.getColumn().setText(Messages.label_name); tableLayout.setColumnData(nameColumn.getColumn(), new ColumnWeightData(100, 150, true)); TableViewerColumn valueColumn = new TableViewerColumn(_propertyTreeTable, SWT.LEFT); valueColumn.getColumn().setText(Messages.label_value); tableLayout.setColumnData(valueColumn.getColumn(), new ColumnWeightData(100, 150, true)); IValueProperty nameProperty = domain == null ? EMFProperties.value(JcaPackage.Literals.PROPERTY__NAME) : EMFEditProperties.value(domain, JcaPackage.Literals.PROPERTY__NAME); IValueProperty valueProperty = domain == null ? EMFProperties.value(JcaPackage.Literals.PROPERTY__VALUE) : EMFEditProperties.value(domain, JcaPackage.Literals.PROPERTY__VALUE); IValueProperty cellEditorTextProperty = CellEditorProperties.control() .value(WidgetProperties.text(SWT.Modify)); final ObservableListContentProvider contentProvider; ObservableTracker.setIgnore(true); try { // ignore any observers created internally contentProvider = new ObservableListContentProvider(); } finally { ObservableTracker.setIgnore(false); } nameColumn.setEditingSupport(ObservableValueEditingSupport.create(_propertyTreeTable, context, new TextCellEditor(_propertyTreeTable.getTable()), cellEditorTextProperty, nameProperty)); nameColumn.setLabelProvider( new ObservableMapCellLabelProvider(nameProperty.observeDetail(contentProvider.getKnownElements()))); valueColumn.setEditingSupport(ObservableValueEditingSupport.create(_propertyTreeTable, context, new TextCellEditor(_propertyTreeTable.getTable()), cellEditorTextProperty, valueProperty)); valueColumn.setLabelProvider(new ObservableMapCellLabelProvider( valueProperty.observeDetail(contentProvider.getKnownElements()))); _propertyTreeTable.setContentProvider(contentProvider); _mAddButton = toolkit.createButton(this, Messages.button_add, SWT.NONE); _mAddButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); _mAddButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { addPropertyToList(); } }); _mAddButton.setEnabled(false); _propertyTreeTable.getTable().addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { updatePropertyButtons(); } }); _mRemoveButton = toolkit.createButton(this, Messages.button_remove, SWT.NONE); _mRemoveButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); _mRemoveButton.setEnabled(false); _mRemoveButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { removeFromList(); } }); final IObservableList propertiesList = (domain == null ? EMFProperties.list(featurePathToProperties) : EMFEditProperties.list(domain, featurePathToProperties)).observeDetail(_bindingValue); _propertyTreeTable.setInput(propertiesList); updatePropertyButtons(); }
From source file:org.switchyard.tools.ui.editor.components.soap.InterceptorTable.java
License:Open Source License
/** * Constructor./*w w w .j av a 2s . c o m*/ * * @param parent composite parent * @param style any SWT style bits * @param isReadOnly boolean flag * @param interceptorsListFeature list we're editing * @param interceptorsFeature actual interceptor list feature * @param interceptorType actual class for the interceptor type * @param context DataBindingContext to use */ public InterceptorTable(Composite parent, int style, boolean isReadOnly, EReference interceptorsListFeature, EReference interceptorsFeature, EClass interceptorType, DataBindingContext context) { super(parent, style); final EditingDomain domain = AdapterFactoryEditingDomain.getEditingDomainFor(getTargetObject()); this._isReadOnly = isReadOnly; this._changeListeners = new ListenerList(); _interceptorsListFeature = interceptorsListFeature; _interceptorsFeature = interceptorsFeature; _interceptorType = interceptorType; int additionalStyles = SWT.NONE; if (isReadOnly) { additionalStyles = SWT.READ_ONLY; } final GridLayout gridLayout = new GridLayout(); gridLayout.marginWidth = 0; gridLayout.marginHeight = 0; gridLayout.numColumns = 2; setLayout(gridLayout); Composite tableComposite = new Composite(this, additionalStyles); GridData gd11 = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 3); gd11.heightHint = 100; tableComposite.setLayoutData(gd11); _interceptorTable = new TableViewer(tableComposite, SWT.BORDER | SWT.WRAP | SWT.V_SCROLL | SWT.FULL_SELECTION | additionalStyles); this._interceptorTable.getTable().setHeaderVisible(true); TableColumnLayout tableLayout = new TableColumnLayout(); tableComposite.setLayout(tableLayout); TableViewerColumn nameColumn = new TableViewerColumn(_interceptorTable, SWT.LEFT); nameColumn.getColumn().setText(Messages.label_name); tableLayout.setColumnData(nameColumn.getColumn(), new ColumnWeightData(100, 150, true)); IValueProperty nameProperty = domain == null ? EMFProperties.value(_interceptorType.getEStructuralFeature("class")) : EMFEditProperties.value(domain, _interceptorType.getEStructuralFeature("class")); IValueProperty cellEditorTextProperty = CellEditorProperties.control() .value(WidgetProperties.text(SWT.Modify)); final ObservableListContentProvider contentProvider; ObservableTracker.setIgnore(true); try { // ignore any observers created internally contentProvider = new ObservableListContentProvider(); } finally { ObservableTracker.setIgnore(false); } nameColumn.setEditingSupport(ObservableValueEditingSupport.create(_interceptorTable, context, new TextCellEditor(_interceptorTable.getTable()), cellEditorTextProperty, nameProperty)); nameColumn.setLabelProvider( new ObservableMapCellLabelProvider(nameProperty.observeDetail(contentProvider.getKnownElements()))); _interceptorTable.setContentProvider(contentProvider); this._mAddButton = new Button(this, SWT.NONE); this._mAddButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); this._mAddButton.setText(Messages.button_add); this._mAddButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { addInterceptorTypeToList(); fireChangedEvent(e.getSource()); } }); this._mAddButton.setEnabled(false); _interceptorTable.getTable().addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { updateInterceptorTypeButtons(); } }); this._mEditButton = new Button(this, SWT.NONE); this._mEditButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); this._mEditButton.setText(Messages.button_edit); this._mEditButton.setEnabled(false); this._mEditButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { editInterceptorType(); fireChangedEvent(e.getSource()); } }); this._mRemoveButton = new Button(this, SWT.NONE); this._mRemoveButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); this._mRemoveButton.setText(Messages.button_remove); this._mRemoveButton.setEnabled(false); this._mRemoveButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { removeFromList(); fireChangedEvent(e.getSource()); } }); // set the input. we're observing a list on the binding value _bindingValue = new WritableValue(SWTObservables.getRealm(getDisplay()), null, SOAPBindingType.class); _interceptorTable .setInput(EMFProperties.list(FeaturePath.fromList(_interceptorsListFeature, _interceptorsFeature)) .observeDetail(_bindingValue)); updateInterceptorTypeButtons(); }
From source file:org.switchyard.tools.ui.editor.diagram.binding.CamelAdditionalURIPropertyTable.java
License:Open Source License
CamelAdditionalURIPropertyTable(Composite parent, int style, boolean isReadOnly, EReference additionalUriParametersFeature, EReference parameterFeature, EClass parameterType, DataBindingContext context) {//from w w w . j a va 2 s. c o m super(parent, style); final EditingDomain domain = AdapterFactoryEditingDomain.getEditingDomainFor(getTargetObject()); this._isReadOnly = isReadOnly; this._changeListeners = new ListenerList(); _additionalUriParametersFeature = additionalUriParametersFeature; _parameterFeature = parameterFeature; _parameterType = parameterType; int additionalStyles = SWT.NONE; if (isReadOnly) { additionalStyles = SWT.READ_ONLY; } final GridLayout gridLayout = new GridLayout(); gridLayout.marginWidth = 0; gridLayout.marginHeight = 0; gridLayout.numColumns = 2; setLayout(gridLayout); Composite tableComposite = new Composite(this, additionalStyles); GridData gd11 = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 2); gd11.heightHint = 100; tableComposite.setLayoutData(gd11); _propertyTreeTable = new TableViewer(tableComposite, SWT.BORDER | SWT.WRAP | SWT.V_SCROLL | SWT.FULL_SELECTION | additionalStyles); _propertyTreeTable.getTable().setHeaderVisible(true); TableColumnLayout tableLayout = new TableColumnLayout(); tableComposite.setLayout(tableLayout); TableViewerColumn nameColumn = new TableViewerColumn(_propertyTreeTable, SWT.LEFT); nameColumn.getColumn().setText(Messages.label_name); tableLayout.setColumnData(nameColumn.getColumn(), new ColumnWeightData(100, 150, true)); TableViewerColumn valueColumn = new TableViewerColumn(_propertyTreeTable, SWT.LEFT); valueColumn.getColumn().setText(Messages.label_value); tableLayout.setColumnData(valueColumn.getColumn(), new ColumnWeightData(100, 150, true)); // TODO: need to use EMFEditProperties if we're in an editing context IValueProperty nameProperty = domain == null ? EMFProperties.value(_parameterType.getEStructuralFeature("name")) : EMFEditProperties.value(domain, _parameterType.getEStructuralFeature("name")); IValueProperty valueProperty = domain == null ? EMFProperties.value(_parameterType.getEStructuralFeature("value")) : EMFEditProperties.value(domain, _parameterType.getEStructuralFeature("value")); IValueProperty cellEditorTextProperty = CellEditorProperties.control() .value(WidgetProperties.text(SWT.Modify)); final ObservableListContentProvider contentProvider; ObservableTracker.setIgnore(true); try { // ignore any observers created internally contentProvider = new ObservableListContentProvider(); } finally { ObservableTracker.setIgnore(false); } nameColumn.setEditingSupport(ObservableValueEditingSupport.create(_propertyTreeTable, context, new TextCellEditor(_propertyTreeTable.getTable()), cellEditorTextProperty, nameProperty)); nameColumn.setLabelProvider( new ObservableMapCellLabelProvider(nameProperty.observeDetail(contentProvider.getKnownElements()))); valueColumn.setEditingSupport(ObservableValueEditingSupport.create(_propertyTreeTable, context, new TextCellEditor(_propertyTreeTable.getTable()), cellEditorTextProperty, valueProperty)); valueColumn.setLabelProvider(new ObservableMapCellLabelProvider( valueProperty.observeDetail(contentProvider.getKnownElements()))); _propertyTreeTable.setContentProvider(contentProvider); _mAddButton = new Button(this, SWT.NONE); _mAddButton.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, false, false)); _mAddButton.setText(Messages.button_add); _mAddButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { addPropertyToList(); fireChangedEvent(e.getSource()); } }); _mAddButton.setEnabled(false); _propertyTreeTable.getTable().addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { updatePropertyButtons(); } }); _mRemoveButton = new Button(this, SWT.NONE); _mRemoveButton.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, false, false)); _mRemoveButton.setText(Messages.button_remove); _mRemoveButton.setEnabled(false); _mRemoveButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { removeFromList(); fireChangedEvent(e.getSource()); } }); // set the input. we're observing a list on the binding value _bindingValue = new WritableValue(SWTObservables.getRealm(getDisplay()), null, Binding.class); _propertyTreeTable.setInput( EMFProperties.list(FeaturePath.fromList(_additionalUriParametersFeature, _parameterFeature)) .observeDetail(_bindingValue)); updatePropertyButtons(); }