예제 #1
0
  private String[] getAvailableProfiles() {
    String generator = config.getGenerator();

    // case generator was initial set in properties page
    if (generator.equals("")) {
      generator = generatorText.getText();
    }

    String[] profiles = util.getProfileNames(agx.getConfiguredProfiles(generator));
    String[] usedProfiles = profilesList.getItems();

    ArrayList<String> availableProfiles = new ArrayList<String>(0);
    for (int i = 0; i < profiles.length; i++) {
      String profile = profiles[i];
      boolean skip = false;
      for (int j = 0; j < usedProfiles.length; j++) {
        if (profile.equals(usedProfiles[j])) {
          skip = true;
        }
      }
      if (!skip) {
        availableProfiles.add(profile);
      }
    }
    return availableProfiles.toArray(new String[] {});
  }
예제 #2
0
  public boolean performOk() {
    try {
      config.setTarget(targetText.getText());
      config.setGenerator(generatorText.getText());
      config.setProfiles(profilesList.getItems());
      config.update();

      agxInfoLabel.setText(agx.getInfo(generatorText.getText()));

      // URI modelUri = URI.createURI(resource.getLocation().toString());
      // org.eclipse.uml2.uml.Package model = util.loadModel(modelUri);
    } catch (Exception e) {
      return false;
    }
    return true;
  }
예제 #3
0
  private void addGeneratorSection(Composite parent) {
    String generator = config.getGenerator();

    agxInfoLabel = new Label(parent, SWT.NONE);
    agxInfoLabel.setText(agx.getInfo(generator));

    Composite composite = createColComposite(parent);

    GridData labelGd = new GridData();
    labelGd.widthHint = convertWidthInCharsToPixels(LABEL_FIELD_WIDTH);

    Label generatorLabel = new Label(composite, SWT.NONE);
    generatorLabel.setLayoutData(labelGd);
    generatorLabel.setText(GENERATOR_TITLE);

    GridData textGd = new GridData();
    textGd.widthHint = convertWidthInCharsToPixels(TEXT_FIELD_WIDTH);

    generatorText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    generatorText.setLayoutData(textGd);
    generatorText.setText(generator);

    Button button = new Button(composite, SWT.PUSH);
    button.setText("browse");

    addGeneratorListener(button);
  }
예제 #4
0
  private void addProfilesSection(Composite parent) {
    Label profilesLabel = new Label(parent, SWT.NONE);
    profilesLabel.setText(PROFILES_TITLE);

    Composite composite = createColComposite(parent);

    GridData listGd = new GridData();
    listGd.heightHint = convertHeightInCharsToPixels(6);
    listGd.widthHint = convertWidthInCharsToPixels(LIST_FIELD_WIDTH);

    availableProfilesList = new List(composite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    availableProfilesList.setLayoutData(listGd);

    Composite buttonComposite = new Composite(composite, SWT.NULL);
    GridLayout buttonLayout = new GridLayout();
    buttonLayout.numColumns = 1;
    buttonComposite.setLayout(buttonLayout);

    GridData buttonGd = new GridData();
    buttonComposite.setLayoutData(buttonGd);

    Button addButton = new Button(buttonComposite, SWT.PUSH);
    addButton.setText(">>");

    addProfilesListener(addButton);

    Button removeButton = new Button(buttonComposite, SWT.PUSH);
    removeButton.setText("<<");

    removeProfilesListener(removeButton);

    profilesList = new List(composite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    profilesList.setLayoutData(listGd);
    profilesList.setItems(config.getProfiles());
    availableProfilesList.setItems(getAvailableProfiles());

    Button importButton = new Button(parent, SWT.PUSH);
    importButton.setText("import selected profiles");

    importProfilesListener(importButton);
  }
예제 #5
0
  private void addTargetSection(Composite parent) {
    Composite composite = createColComposite(parent);

    GridData labelGd = new GridData();
    labelGd.widthHint = convertWidthInCharsToPixels(LABEL_FIELD_WIDTH);

    Label targetLabel = new Label(composite, SWT.NONE);
    targetLabel.setLayoutData(labelGd);
    targetLabel.setText(TARGET_TITLE);

    GridData textGd = new GridData();
    textGd.widthHint = convertWidthInCharsToPixels(TEXT_FIELD_WIDTH);

    targetText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    targetText.setLayoutData(textGd);
    targetText.setText(config.getTarget());

    Button button = new Button(composite, SWT.PUSH);
    button.setText("browse");

    addTargetListener(button);
  }