Package org.apache.uima.aae.deployment.impl

Examples of org.apache.uima.aae.deployment.impl.NameValue


   */
  public class EnvVariableLabelProvider extends LabelProvider implements ITableLabelProvider {
    public String getColumnText(Object element, int columnIndex)  {
      String result = null;
      if (element != null) {
        NameValue var = (NameValue) element;
        switch (columnIndex) {
          case 0: // variable
            result = var.getName();
            break;
          case 1: // value
            result = var.getValue();
            break;
        }
      }
      return result;
    }
View Full Code Here


  /**
   * Creates an editor for the value of the selected environment variable.
   */
  private void handleEditButton() {
    IStructuredSelection sel= (IStructuredSelection) envTableViewer.getSelection();
    NameValue var= (NameValue) sel.getFirstElement();
    if (var == null) {
      return;
    }
    String oldName  = var.getName();
    EditParamWizard wizard = new EditParamWizard(Messages.DDE_EnvVariable_Wizard_EDIT_Title,
            Messages.DDE_EnvVariable_Wizard_EDIT_Description, var.getName(), var.getValue());
    WizardDialog dialog = new WizardDialog(form.getShell(), wizard);
   
    if (dialog.open() != Window.OK) {
      return;
    }
    String name  = wizard.getName();
    String value = wizard.getValue();
   
    // Delete OLD name/value from Map
    envName2NameValueMap.remove(oldName);
   
    if (name.length() == 0) {
      // Delete OLD name/value from Table
      envTableViewer.remove(var);
      envTableViewer.refresh();
      updateEnvironmentVariables ();
      return;
    }

    if (!oldName.equals(name)) {
      envTableViewer.remove(var);
      var = new NameValue(name, value);
      addAndCheckVariable(var);
    } else {
      var.setValue(value);
      envTableViewer.update(var, null);
    }
    envName2NameValueMap.put(name, var);
    updateEnvironmentVariables ();
  }
View Full Code Here

    String name  = wizard.getName();
    String value = wizard.getValue();
    if (name.length() == 0) {
      return;
    }
    NameValue nv = new NameValue(name, value);
    addAndCheckVariable(nv);
    envName2NameValueMap.put(name, nv);
    updateEnvironmentVariables ();
  }
View Full Code Here

    updateEnvironmentVariables ();
  }
 
  private void handleDeleteButton() {
    IStructuredSelection sel= (IStructuredSelection) envTableViewer.getSelection();
    NameValue var= (NameValue) sel.getFirstElement();
    if (var == null) {
      return;
    }
    envName2NameValueMap.remove(var.getName());
    envTableViewer.remove(var);
    envTableViewer.refresh();
    updateEnvironmentVariables ();
  }
View Full Code Here

 
  protected boolean addAndCheckVariable(NameValue variable) {
    String name= variable.getName();
    TableItem[] items = envTableViewer.getTable().getItems();
    for (int i = 0; i < items.length; i++) {
      NameValue existingVariable = (NameValue) items[i].getData();
      // Duplicate name ?
      if (existingVariable.getName().equals(name)) {
        envTableViewer.remove(existingVariable);
        break;
      }
    }
    envTableViewer.add(variable);
View Full Code Here

  /**
   * Creates an editor for the value of the selected environment variable.
   */
  private void handleEditButton() {
    IStructuredSelection sel= (IStructuredSelection) envTableViewer.getSelection();
    NameValue var= (NameValue) sel.getFirstElement();
    if (var == null) {
      return;
    }
    String oldName  = var.getName();
    EditParamWizard wizard = new EditParamWizard(Messages.DDE_EnvVariable_Wizard_EDIT_Title,
            Messages.DDE_EnvVariable_Wizard_EDIT_Description, var.getName(), var.getValue());
    WizardDialog dialog = new WizardDialog(form.getShell(), wizard);
   
    if (dialog.open() != Window.OK) {
      return;
    }
    String name  = wizard.getName();
    String value = wizard.getValue();
   
    // Delete OLD name/value from Map
    envName2NameValueMap.remove(oldName);
   
    if (name.length() == 0) {
      // Delete OLD name/value from Table
      envTableViewer.remove(var);
      envTableViewer.refresh();
      updateEnvironmentVariables ();
      return;
    }

    if (!oldName.equals(name)) {
      envTableViewer.remove(var);
      var = new NameValue(name, value);
      addAndCheckVariable(var);
    } else {
      var.setValue(value);
      envTableViewer.update(var, null);
    }
    envName2NameValueMap.put(name, var);
    updateEnvironmentVariables ();
  }
View Full Code Here

    String name  = wizard.getName();
    String value = wizard.getValue();
    if (name.length() == 0) {
      return;
    }
    NameValue nv = new NameValue(name, value);
    addAndCheckVariable(nv);
    envName2NameValueMap.put(name, nv);
    updateEnvironmentVariables ();
  }
View Full Code Here

    updateEnvironmentVariables ();
  }
 
  private void handleDeleteButton() {
    IStructuredSelection sel= (IStructuredSelection) envTableViewer.getSelection();
    NameValue var= (NameValue) sel.getFirstElement();
    if (var == null) {
      return;
    }
    envName2NameValueMap.remove(var.getName());
    envTableViewer.remove(var);
    envTableViewer.refresh();
    updateEnvironmentVariables ();
  }
View Full Code Here

 
  protected boolean addAndCheckVariable(NameValue variable) {
    String name= variable.getName();
    TableItem[] items = envTableViewer.getTable().getItems();
    for (int i = 0; i < items.length; i++) {
      NameValue existingVariable = (NameValue) items[i].getData();
      // Duplicate name ?
      if (existingVariable.getName().equals(name)) {
        envTableViewer.remove(existingVariable);
        break;
      }
    }
    envTableViewer.add(variable);
View Full Code Here

   */
  public class EnvVariableLabelProvider extends LabelProvider implements ITableLabelProvider {
    public String getColumnText(Object element, int columnIndex)  {
      String result = null;
      if (element != null) {
        NameValue var = (NameValue) element;
        switch (columnIndex) {
          case 0: // variable
            result = var.getName();
            break;
          case 1: // value
            result = var.getValue();
            break;
        }
      }
      return result;
    }
View Full Code Here

TOP

Related Classes of org.apache.uima.aae.deployment.impl.NameValue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.