コード例 #1
2
  /** {@inheritDoc} */
  @Override
  public void refresh(final Resource resource) {
    this.dcdResource = resource;

    final DeviceConfiguration dcd = ModelUtil.getDeviceConfiguration(this.dcdResource);

    setEditable(!getPage().getEditingDomain().isReadOnly(this.dcdResource));

    for (final Binding binding : this.bindings) {
      binding.dispose();
    }
    this.bindings.clear();

    final SoftPkg model = getSoftPkg();
    if (model == null) {
      return;
    }

    final DataBindingContext context = this.getPage().getEditor().getDataBindingContext();

    this.bindings.add(
        context.bindValue(
            WidgetProperties.text(SWT.Modify)
                .observeDelayed(
                    SCAFormEditor.getFieldBindingDelay(), this.client.getIdEntry().getText()),
            EMFEditObservables.observeValue(
                getEditingDomain(), dcd, DcdPackage.Literals.DEVICE_CONFIGURATION__ID),
            new EMFEmptyStringToNullUpdateValueStrategy(),
            null));

    this.bindings.add(
        context.bindValue(
            WidgetProperties.text(SWT.Modify)
                .observeDelayed(
                    SCAFormEditor.getFieldBindingDelay(), this.client.getNameEntry().getText()),
            EMFEditObservables.observeValue(
                getEditingDomain(), dcd, DcdPackage.Literals.DEVICE_CONFIGURATION__NAME),
            new EMFEmptyStringToNullUpdateValueStrategy(),
            null));

    this.bindings.add(
        context.bindValue(
            WidgetProperties.text(SWT.Modify)
                .observeDelayed(
                    SCAFormEditor.getFieldBindingDelay(),
                    this.client.getDescriptionEntry().getText()),
            EMFEditObservables.observeValue(
                getEditingDomain(), dcd, DcdPackage.Literals.DEVICE_CONFIGURATION__DESCRIPTION),
            new EMFEmptyStringToNullUpdateValueStrategy(),
            null));

    this.client.setEditable(SCAEditorUtil.isEditableResource(getPage(), this.dcdResource));
  }
コード例 #2
0
 private DeviceConfiguration getDeviceConfiguration() {
   return ModelUtil.getDeviceConfiguration(this.dcdResource);
 }