Esempio n. 1
0
 @Override
 public void setBinding(Binding impl) {
   if (impl instanceof CamelSqlBindingType) {
     this._binding = (CamelSqlBindingType) impl;
     setInUpdate(true);
     if (this._binding.getQuery() != null) {
       _queryText.setText(this._binding.getQuery());
     }
     if (this._binding.getDataSourceRef() != null) {
       _dataSourceRefText.setText(this._binding.getDataSourceRef());
     }
     if (this._binding.getPlaceholder() != null) {
       _placeholderText.setText(this._binding.getPlaceholder());
     }
     _batchCheckbox.setSelection(this._binding.isBatch());
     populateOperationCombo();
     String opName = CamelBindingUtil.getOperationNameForStaticOperationSelector(this._binding);
     if (opName != null) {
       setTextValue(_operationSelectionCombo, opName);
     }
     super.setTabsBinding(_binding);
     setInUpdate(false);
     validate();
   } else {
     this._binding = null;
     populateOperationCombo();
   }
   addObservableListeners();
 }
  @Override
  public void setBinding(Binding impl) {
    if (impl instanceof CamelJPABindingType) {
      this._binding = (CamelJPABindingType) impl;
      setInUpdate(true);
      if (this._binding.getConsume() != null) {
        _deleteCheckbox.setSelection(this._binding.getConsume().isConsumeDelete());
        _lockEntityCheckbox.setSelection(this._binding.getConsume().isConsumeLockEntity());
        if (this._binding.getConsume().isSetMaximumResults()) {
          setTextValue(
              _maximumResultsText,
              PropTypeUtil.getPropValueString(this._binding.getConsume().getMaximumResults()));
        } else {
          _maximumResultsText.setText("");
        }
        if (this._binding.getConsume().getConsumerQuery() != null) {
          _queryText.setText(this._binding.getConsume().getConsumerQuery());
        } else {
          _queryText.setText("");
        }
        if (this._binding.getConsume().getConsumerNamedQuery() != null) {
          _namedQueryText.setText(this._binding.getConsume().getConsumerNamedQuery());
        } else {
          _namedQueryText.setText("");
        }
        if (this._binding.getConsume().getConsumerNativeQuery() != null) {
          _nativeQueryText.setText(this._binding.getConsume().getConsumerNativeQuery());
        } else {
          _nativeQueryText.setText("");
        }
        _transactedCheckbox.setSelection(this._binding.getConsume().isConsumerTransacted());
      }
      if (this._binding.getEntityClassName() != null) {
        _entityClassNameText.setText(this._binding.getEntityClassName());
      } else {
        _entityClassNameText.setText("");
      }
      if (this._binding.getPersistenceUnit() != null) {
        _persistenceUnitText.setText(this._binding.getPersistenceUnit().toString());
      } else {
        _persistenceUnitText.setText("");
      }
      if (this._binding.getTransactionManager() != null) {
        _transcationManagerText.setText(this._binding.getTransactionManager());
      } else {
        _transcationManagerText.setText("");
      }

      final Resource resource =
          MergedModelUtil.getSwitchYard((EObject) getTargetObject()).eResource();
      if (resource.getURI().isPlatformResource()) {
        final IFile file =
            ResourcesPlugin.getWorkspace()
                .getRoot()
                .getFile(new Path(resource.getURI().toPlatformString(true)));
        if (file != null) {
          _project = JavaCore.create(file.getProject());
        }
      }

      super.setTabsBinding(_binding);
      setInUpdate(false);
      validate();
    } else {
      this._binding = null;
    }
    addObservableListeners();
  }