Exemplo n.º 1
0
  @Override
  public void refresh() {
    _inUpdate = true;
    try {
      org.eclipse.soa.sca.sca1_1.model.sca.Composite composite = getTargetObject();
      if (composite != null) {
        _businessObject = composite;
        if (_nameListener == null) {
          _nameListener = new NameListener();
        }
        composite.eAdapters().add(_nameListener);

        if (_nameText != null && !_nameText.isDisposed()) {
          String name = composite.getName();
          _nameText.setText(name == null ? "" : name); // $NON-NLS-1$
        }
        if (_targetNamespaceText != null && !_targetNamespaceText.isDisposed()) {
          // update TNS text box based on SY/composite settings
          String tns = composite.getTargetNamespace();
          _targetNamespaceText.setText(tns);
        }
      }
    } finally {
      _inUpdate = false;
    }
  }
Exemplo n.º 2
0
 private void undo(Control control) {
   if (control.equals(_targetNamespaceText)) {
     if (_targetNamespaceText != null && !_targetNamespaceText.isDisposed()) {
       // update TNS text box based on SY/composite settings
       if (_businessObject instanceof org.eclipse.soa.sca.sca1_1.model.sca.Composite) {
         final org.eclipse.soa.sca.sca1_1.model.sca.Composite composite =
             (org.eclipse.soa.sca.sca1_1.model.sca.Composite) _businessObject;
         _targetNamespaceText.setText(composite.getTargetNamespace());
       }
     }
   }
 }
  @Override
  public Object[] create(ICreateContext context) {
    Service newService = null;
    Composite composite =
        (Composite) getBusinessObjectForPictogramElement(context.getTargetContainer());
    BaseNewContractWizard wizard =
        new BaseNewContractWizard(
            "New Service",
            "Specify details for the new service.",
            ScaPackage.eINSTANCE.getService());
    Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
    WizardDialog wizDialog = new WizardDialog(shell, wizard);
    wizard.init(composite);
    int rtn_code = wizDialog.open();
    if (rtn_code == Window.OK) {
      newService = (Service) wizard.getContract();
    } else {
      _hasDoneChanges = false;
      return EMPTY;
    }

    composite.getService().add(newService);

    // do the add
    PictogramElement pe = addGraphicalRepresentation(context, newService);
    if (pe instanceof Shape) {
      // make sure the new service is positioned correctly.
      layoutPictogramElement(((Shape) pe).getContainer());
    }

    // activate direct editing after object creation
    getFeatureProvider().getDirectEditingInfo().setActive(true);

    // make sure we look like we actually did something.
    _hasDoneChanges = true;

    // return newly created business object(s)
    return new Object[] {newService};
  }
  @Override
  public Object[] create(ICreateContext context) {
    Reference newReference = null;
    Composite composite =
        (Composite) getBusinessObjectForPictogramElement(context.getTargetContainer());
    BaseNewContractWizard wizard =
        new BaseNewContractWizard(
            Messages.title_newCompositeReference,
            Messages.description_newCompositeReference,
            ScaPackage.eINSTANCE.getReference());
    Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
    WizardDialog wizDialog = new WizardDialog(shell, wizard);
    wizard.init(composite);
    int rtn_code = wizDialog.open();
    if (rtn_code == Window.OK) {
      newReference = (Reference) wizard.getContract();
      newReference.setMultiplicity(Multiplicity._01);
    } else {
      _hasDoneChanges = false;
      return EMPTY;
    }

    composite.getReference().add(newReference);

    // do the add
    PictogramElement pe = addGraphicalRepresentation(context, newReference);
    if (pe instanceof Shape) {
      // make sure the new reference is positioned correctly.
      layoutPictogramElement(((Shape) pe).getContainer());
    }

    // make sure we look like we actually did something.
    _hasDoneChanges = true;

    // return newly created business object(s)
    return new Object[] {newReference};
  }