Ejemplo n.º 1
0
 protected void handleUndo(Control control) {
   if (_binding != null) {
     if (control.equals(_entityClassNameText)) {
       _entityClassNameText.setText(this._binding.getEntityClassName());
     } else if (control.equals(_persistenceUnitText)) {
       _persistenceUnitText.setText(this._binding.getPersistenceUnit().toString());
     } else if (control.equals(_transcationManagerText)) {
       _transcationManagerText.setText(this._binding.getTransactionManager());
     } else if (control.equals(_deleteCheckbox)) {
       _deleteCheckbox.setSelection(this._binding.getConsume().isConsumeDelete());
     } else if (control.equals(_lockEntityCheckbox)) {
       _lockEntityCheckbox.setSelection(this._binding.getConsume().isConsumeLockEntity());
     } else if (control.equals(_maximumResultsText)) {
       setTextValue(
           _maximumResultsText,
           PropTypeUtil.getPropValueString(this._binding.getConsume().getMaximumResults()));
     } else if (control.equals(_queryText)) {
       _queryText.setText(this._binding.getConsume().getConsumerQuery());
     } else if (control.equals(_namedQueryText)) {
       _namedQueryText.setText(this._binding.getConsume().getConsumerNamedQuery());
     } else if (control.equals(_nativeQueryText)) {
       _nativeQueryText.setText(this._binding.getConsume().getConsumerNativeQuery());
     } else if (control.equals(_transactedCheckbox)) {
       _transactedCheckbox.setSelection(this._binding.getConsume().isConsumerTransacted());
     } else {
       super.handleUndo(control);
     }
   }
   setHasChanged(false);
 }
Ejemplo n.º 2
0
  @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();
  }