示例#1
0
  private void edit() {
    IStructuredSelection selection = (IStructuredSelection) propsTableViewer.getSelection();
    ConfigPropType prop = (ConfigPropType) selection.getFirstElement();

    String title = "Edit";
    AddPropertyDialog dialog =
        new AddPropertyDialog(
            propsTableViewer.getControl().getShell(),
            title,
            new String[] {prop.getName(), prop.getType(), prop.getValue()});

    if (dialog.open() == Window.CANCEL) {
      return;
    }

    String[] pair = dialog.getNameValuePair();
    String name = pair[0];
    /*
    if (!name.equals(originalName)) {
        if (!overwrite(name)){
            return;
        }
    }
    */
    prop.setName(name);
    prop.setType(pair[1]);
    prop.setValue(pair[2]);
    ((PropsContentProvider) propsTableViewer.getContentProvider()).update(prop);

    container.update();
  }
示例#2
0
  /** Allows the user to enter a user property */
  private void addProperty() {
    String title = "Add";
    AddPropertyDialog dialog =
        new AddPropertyDialog(
            propsTableViewer.getControl().getShell(), title, new String[] {"", "", ""});
    if (dialog.open() == Window.CANCEL) {
      return;
    }

    String[] pair = dialog.getNameValuePair();
    String name = pair[0];
    /*
    if (!overwrite(name)) {
        return;
    }
    */

    List<ConfigPropType> propList = aoDef.getAoConfigProps();

    ConfigPropType prop = new ConfigPropType();
    prop.setName(name);
    prop.setType(pair[1]);
    prop.setValue(pair[2]);
    ((PropsContentProvider) propsTableViewer.getContentProvider()).add(prop);
    propList.add(prop);
    container.update();
  }