/**
   * Create a new InterfaceControlComposite.
   *
   * @param container the container
   * @param parent the parent composite
   * @param style the style bits
   */
  public InterfaceControlComposite(ICompositeContainer container, Composite parent, int style) {
    super(Contract.class, container, parent, style);

    _interfaceControl =
        new InterfaceControl(
            null, EnumSet.of(InterfaceType.Java, InterfaceType.WSDL, InterfaceType.ESB));

    int numColumns = 3;
    setLayout(new GridLayout(numColumns, false));

    _interfaceControl.createControl(this, numColumns);
    _interfaceControl.addSelectionChangedListener(
        new ISelectionChangedListener() {
          @Override
          public void selectionChanged(SelectionChangedEvent event) {
            final Interface intf = _interfaceControl.getInterface();
            if (intf != null && !_inUpdate) {
              if (_service != null) {
                wrapOperation(
                    new Runnable() {
                      public void run() {
                        _service.setInterface(intf);
                      }
                    });
              }
            }
          }
        });

    adaptChildren(this);
  }
  @Override
  public void refresh() {
    _inUpdate = true;
    Contract contract = getTargetObject();
    if (contract != null) {
      _interface = contract.getInterface();
      _service = contract;

      // init controls
      _interfaceControl.init(_interface, null);
    }
    _inUpdate = false;
  }