Example #1
0
 protected void handleModify(final Control control) {
   if (control.equals(_configURIText)) {
     updateFeature(_binding, "configURI", _configURIText.getText().trim()); // $NON-NLS-1$
   } else if (control.equals(_opSelectorComposite)) {
     int opType = _opSelectorComposite.getSelectedOperationSelectorType();
     updateOperationSelectorFeature(
         opType, _opSelectorComposite.getSelectedOperationSelectorValue());
     fireChangedEvent(_opSelectorComposite);
   } else if (control.equals(_nameText)) {
     super.updateFeature(_binding, "name", _nameText.getText().trim()); // $NON-NLS-1$
   }
   super.handleModify(control);
   setHasChanged(false);
   setDidSomething(true);
 }
 @Override
 public void setTargetObject(EObject target) {
   super.setTargetObject(target);
   if (_opSelectorComposite != null && !_opSelectorComposite.isDisposed()) {
     _opSelectorComposite.setTargetObject((EObject) target);
   }
 }
 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);
 }
 protected void handleModify(final Control control) {
   if (control.equals(_entityClassNameText)) {
     updateFeature(_binding, "entityClassName", _entityClassNameText.getText().trim());
   } else if (control.equals(_persistenceUnitText)) {
     updateFeature(_binding, "persistenceUnit", _persistenceUnitText.getText().trim());
   } else if (control.equals(_transcationManagerText)) {
     updateFeature(_binding, "transactionManager", _transcationManagerText.getText().trim());
   } else if (control.equals(_deleteCheckbox)) {
     updateConsumeFeature("consumeDelete", _deleteCheckbox.getSelection());
   } else if (control.equals(_lockEntityCheckbox)) {
     updateConsumeFeature("consumeLockEntity", _lockEntityCheckbox.getSelection());
   } else if (control.equals(_maximumResultsText)) {
     try {
       Integer port = new Integer(_maximumResultsText.getText().trim());
       updateConsumeFeature("maximumResults", port.intValue());
     } catch (NumberFormatException nfe) {
       updateConsumeFeature("maximumResults", _maximumResultsText.getText().trim());
     }
   } else if (control.equals(_queryText)) {
     updateConsumeFeature("consumerQuery", _queryText.getText().trim());
   } else if (control.equals(_namedQueryText)) {
     updateConsumeFeature("consumerNamedQuery", _namedQueryText.getText().trim());
   } else if (control.equals(_nativeQueryText)) {
     updateConsumeFeature("consumerNativeQuery", _nativeQueryText.getText().trim());
   } else if (control.equals(_transactedCheckbox)) {
     updateConsumeFeature("consumerTransacted", _transactedCheckbox.getSelection());
   } else {
     super.handleModify(control);
   }
   validate();
   setHasChanged(false);
   setDidSomething(true);
 }
Example #5
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();
 }
Example #6
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();
  }
Example #7
0
 protected void handleUndo(Control control) {
   if (_binding != null) {
     if (control.equals(_configURIText)) {
       _configURIText.setText(this._binding.getConfigURI());
     } else if (control.equals(_nameText)) {
       _nameText.setText(_binding.getName() == null ? "" : _binding.getName()); // $NON-NLS-1$
     } else {
       super.handleUndo(control);
     }
   }
   setHasChanged(false);
 }
Example #8
0
 @Override
 protected boolean validate() {
   setErrorMessage(null);
   if (getBinding() != null) {
     if (_queryText.getText().trim().isEmpty()) {
       setErrorMessage("Query may not be empty.");
       return false;
     }
     if (_dataSourceRefText.getText().trim().isEmpty()) {
       setErrorMessage("Data Source Reference may not be empty.");
       return false;
     }
   }
   super.validateTabs();
   return (getErrorMessage() == null);
 }
Example #9
0
 protected void handleModify(final Control control) {
   if (control.equals(_queryText)) {
     updateFeature(_binding, "query", _queryText.getText().trim());
   } else if (control.equals(_dataSourceRefText)) {
     updateFeature(_binding, "dataSourceRef", _dataSourceRefText.getText().trim());
   } else if (control.equals(_placeholderText)) {
     updateFeature(_binding, "placeholder", _placeholderText.getText().trim());
   } else if (control.equals(_batchCheckbox)) {
     boolean value = _batchCheckbox.getSelection();
     updateFeature(_binding, "batch", value);
   } else if (control.equals(_operationSelectionCombo)) {
     updateCamelOperationSelectorFeature(
         "operationName", _operationSelectionCombo.getText().trim());
   }
   super.handleModify(control);
   validate();
   setHasChanged(false);
 }
 @Override
 protected boolean validate() {
   setErrorMessage(null);
   if (getBinding() != null) {
     if (_entityClassNameText.getText().trim().isEmpty()) {
       setErrorMessage("Entity Class Name may not be empty.");
     } else if (_entityClassNameText.getText().trim().isEmpty()) {
       setErrorMessage("Persistence Unit may not be empty.");
       //            } else if (!_maximumResultsText.getText().trim().isEmpty()) {
       //                try {
       //                    new Integer(_maximumResultsText.getText().trim());
       //                } catch (NumberFormatException nfe) {
       //                    setErrorMessage("Maximum Results must be a valid number.");
       //                }
     }
   }
   super.validateTabs();
   return (getErrorMessage() == null);
 }
Example #11
0
 protected void handleUndo(Control control) {
   if (_binding != null) {
     if (control.equals(_queryText)) {
       _queryText.setText(this._binding.getQuery());
     } else if (control.equals(_dataSourceRefText)) {
       _dataSourceRefText.setText(this._binding.getDataSourceRef());
     } else if (control.equals(_placeholderText)) {
       _placeholderText.setText(this._binding.getPlaceholder());
     } else if (control.equals(_batchCheckbox)) {
       _batchCheckbox.setSelection(this._binding.isBatch());
     } else if (control.equals(_operationSelectionCombo)) {
       String opName = CamelBindingUtil.getOperationNameForStaticOperationSelector(this._binding);
       setTextValue(_operationSelectionCombo, opName);
     } else {
       super.handleUndo(control);
     }
   }
   setHasChanged(false);
 }
  @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);
    }
  }
 /* (non-Javadoc)
  * @see org.switchyard.tools.ui.editor.diagram.shared.AbstractSwitchyardComposite#dispose()
  */
 @Override
 public void dispose() {
   _bindingValue.dispose();
   super.dispose();
 }
 protected void handleUndo(Control control) {
   if (_binding != null) {
     super.handleUndo(control);
   }
 }
  @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();
  }
 @Override
 public void setTargetObject(Object target) {
   super.setTargetObject(target);
 }