Beispiel #1
0
  @Override
  public void refresh() {
    fNameEntry.setValue(getPUT().getName(), true);
    fTypeEntry.setValue(getPUT().getType(), true);
    fWSDLEntry.setValue(getPUT().getWsdl(), true);

    super.refresh();
  }
Beispiel #2
0
  private void createTypeEntry(Composite content, FormToolkit toolkit) {

    fTypeEntry = new ComboEntry(content, toolkit, "Deployer");
    fTypeEntry.setItems(ExtensionControl.getDeployerMetaInformation());
    fTypeEntry.setFormEntryListener(
        new EntryAdapter(this) {

          @Override
          public void textValueChanged(TextEntry entry) {
            getPUT().setType(entry.getValue());
          }
        });

    fTypeEntry.addFocusListener(
        new FocusListener() {

          @Override
          public void focusLost(FocusEvent e) {

            try {
              List<Integer> unsupportedPropertyIndices = calcIncompatiblePropertyIndices();

              if (unsupportedPropertyIndices.size() > 0) {
                if (MessageDialog.openQuestion(
                    getShell(),
                    "Remove Deployer Options",
                    "Do you want to remove deployer options that are not supported by the chosen deployer?")) {
                  removePropertiesByIndex(unsupportedPropertyIndices);
                }
              }
            } catch (SpecificationException e1) {
            }
          }

          private void removePropertiesByIndex(List<Integer> unsupportedPropertyIndices) {
            for (int i : unsupportedPropertyIndices) {
              getPUT().removeProperty(i);
            }
          }

          private List<Integer> calcIncompatiblePropertyIndices() throws SpecificationException {
            String deployerName = fTypeEntry.getValue();
            IBPELDeployer deployer =
                ExtensionControl.findDeployerExtension(deployerName).createNew();

            List<String> possiblePropertyNames =
                ExtensionRegistry.getPossibleConfigurationOptions(deployer.getClass(), true);

            List<XMLProperty> currentProperties = getPUT().getPropertyList();

            List<Integer> unsupportedPropertyIndices = new ArrayList<Integer>();

            for (int i = 0; i < currentProperties.size(); i++) {
              XMLProperty p = currentProperties.get(i);
              if (!possiblePropertyNames.contains(p.getName())) {
                unsupportedPropertyIndices.add(i);
              }
            }
            return unsupportedPropertyIndices;
          }

          @Override
          public void focusGained(FocusEvent e) {}
        });
  }