示例#1
0
  @Override
  public void setBinding(Binding impl) {
    super.setBinding(impl);
    if (impl instanceof CamelBindingType) {
      this._binding = (CamelBindingType) impl;
      setInUpdate(true);
      if (this._binding.getConfigURI() != null) {
        _configURIText.setText(this._binding.getConfigURI());
      } else {
        _configURIText.setText(""); // $NON-NLS-1$
      }

      if (_opSelectorComposite != null && !_opSelectorComposite.isDisposed()) {
        OperationSelectorType opSelector =
            OperationSelectorUtil.getFirstOperationSelector(this._binding);
        _opSelectorComposite.setBinding(this._binding);
        _opSelectorComposite.setOperation((SwitchYardOperationSelectorType) opSelector);
      }
      if (_binding.getName() == null) {
        _nameText.setText(""); // $NON-NLS-1$
      } else {
        _nameText.setText(_binding.getName());
      }

      setInUpdate(false);
      validate();
    } else {
      this._binding = null;
    }
    addObservableListeners();
  }
  @Override
  public void setBinding(Binding impl) {
    super.setBinding(impl);
    if (impl instanceof CamelMailBindingType) {
      _binding = (CamelMailBindingType) impl;

      _bindingValue.setValue(_binding);

      if (_binding.getConsume() == null) {
        TransactionalEditingDomain domain = getDomain(_binding);
        if (domain != null) {
          domain
              .getCommandStack()
              .execute(
                  new RecordingCommand(domain) {
                    protected void doExecute() {
                      _binding.setConsume(MailFactory.eINSTANCE.createCamelMailConsumerType());
                    }
                  });
        } else {
          _binding.setConsume(MailFactory.eINSTANCE.createCamelMailConsumerType());
        }
      }

      // refresh the operation selector control
      if (_opSelectorComposite != null
          && !_opSelectorComposite.isDisposed()
          && getTargetObject() != null) {
        _opSelectorComposite.setTargetObject(getTargetObject());
      }

      _opSelectorComposite.setBinding(_binding);
    } else {
      _bindingValue.setValue(null);
    }
  }