Examples of IValueVariable


Examples of org.eclipse.core.variables.IValueVariable

  }

  public void setOrCreateVariable(final String value) throws CoreException
  {
    IStringVariableManager varMan = VariablesPlugin.getDefault().getStringVariableManager();
    IValueVariable var = varMan.getValueVariable(JunitLaunchListener.JMOCKIT_VAR_NAME);

    if (var == null)
    {
      var = varMan.newValueVariable(JunitLaunchListener.JMOCKIT_VAR_NAME, value, false, value);
      varMan.addVariables(new IValueVariable[]{var});
    }
    else
    {
      var.setValue(value);
      var.setDescription(value);
    }
  }
View Full Code Here

Examples of org.eclipse.core.variables.IValueVariable

  private void addPropertyVariables(Properties properties) {
    for (Object k : properties.keySet()) {
      String key = (String) k;
      String value = properties.getProperty(key);
      IValueVariable variable = manager.getValueVariable(key);
      if (variable == null) {
        variable = manager.newValueVariable(key, "", false, value);
        try {
          manager.addVariables(new IValueVariable[] { variable });
        } catch (CoreException e) {
          e.printStackTrace();
        }
      } else {
        variable.setValue(value);
      }
    }
  }
View Full Code Here

Examples of org.eclipse.core.variables.IValueVariable

        arg = text.substring(pos);
      }
    } else {
      name = text;
    }
    IValueVariable valueVariable = manager.getValueVariable(name);
    if (valueVariable == null) {
      IDynamicVariable dynamicVariable = manager.getDynamicVariable(name);
      if (dynamicVariable == null) {
        // no variables with the given name
        if (reportUndefinedVariables) {
          throw new CoreException(new Status(IStatus.ERROR, VariablesPlugin.getUniqueIdentifier(), VariablesPlugin.INTERNAL_ERROR, NLS.bind(VariablesMessages.StringSubstitutionEngine_3, new String[]{name}), null));
        }
        // leave as is
        return getOriginalVarText(var);
      }
     
      if (resolveVariables) {
        fSubs = true;
        return dynamicVariable.getValue(arg);
      }
      //leave as is
      return getOriginalVarText(var);
    }
   
    if (arg == null) {
      if (resolveVariables) {
        fSubs = true;
        return valueVariable.getValue();
      }
      //leave as is
      return getOriginalVarText(var);
    }
    // error - an argument specified for a value variable
    throw new CoreException(new Status(IStatus.ERROR, VariablesPlugin.getUniqueIdentifier(), VariablesPlugin.INTERNAL_ERROR, NLS.bind(VariablesMessages.StringSubstitutionEngine_4, new String[]{valueVariable.getName()}), null));
  }
View Full Code Here

Examples of org.eclipse.core.variables.IValueVariable

   *
   * @param variable the variable that has changed
   */
  protected void notifyChanged(IValueVariable variable) {
    if (!fInternalChange) {
      IValueVariable existing = getValueVariable(variable.getName());
      if (variable.equals(existing)) {
        // do not do change notification for unregistered variables
        getNotifier().notify(new IValueVariable[]{variable}, CHANGED);
      }
    }
View Full Code Here

Examples of org.eclipse.core.variables.IValueVariable

        continue;
      }
      String description= element.getAttribute(ATTR_DESCRIPTION);
      boolean isReadOnly = TRUE_VALUE.equals(element.getAttribute(ATTR_READ_ONLY));
     
      IValueVariable variable = new ContributedValueVariable(name, description, isReadOnly, element);
      Object old = fValueVariables.put(name, variable);
      if (old != null) {
        StringVariable oldVariable = (StringVariable)old;
        VariablesPlugin.logMessage(NLS.bind("Contributed variable extension from bundle ''{0}'' overrides existing extension variable ''{1}'' from  bundle ''{2}''", //$NON-NLS-1$
            new String[] {element.getDeclaringExtension().getContributor().getName(),oldVariable.getName(),
View Full Code Here

Examples of org.eclipse.core.variables.IValueVariable

        if (name.length() > 0) {
          String value= element.getAttribute(VALUE_TAG);
          String description= element.getAttribute(DESCRIPTION_TAG);
          boolean readOnly= TRUE_VALUE.equals(element.getAttribute(READ_ONLY_TAG));
       
          IValueVariable existing = getValueVariable(name);
          if (existing == null){
            ValueVariable variable = new ValueVariable(name, description, readOnly, value);
            fValueVariables.put(name, variable);
          } else if (!existing.isReadOnly() && value != null){
            existing.setValue(value);
          }
        } else {
          VariablesPlugin.logMessage("Invalid variable entry encountered while loading value variables. Variable name is null.", null); //$NON-NLS-1$
        }
      }
View Full Code Here

Examples of org.eclipse.core.variables.IValueVariable

   */
  public synchronized void addVariables(IValueVariable[] variables) throws CoreException {
    initialize();
    MultiStatus status = new MultiStatus(VariablesPlugin.getUniqueIdentifier(), VariablesPlugin.INTERNAL_ERROR, VariablesMessages.StringVariableManager_26, null);
    for (int i = 0; i < variables.length; i++) {
      IValueVariable variable = variables[i];
      if (getValueVariable(variable.getName()) != null) {
        status.add(new Status(IStatus.ERROR, VariablesPlugin.getUniqueIdentifier(), VariablesPlugin.INTERNAL_ERROR, NLS.bind(VariablesMessages.StringVariableManager_27, new String[]{variable.getName()}), null));
      }     
    }
    if (status.isOK()) {
      for (int i = 0; i < variables.length; i++) {
        IValueVariable variable = variables[i];
        fValueVariables.put(variable.getName(), variable);
      }
      IValueVariable[] copy = new IValueVariable[variables.length];
      System.arraycopy(variables, 0, copy, 0, variables.length);
      getNotifier().notify(copy, ADDED);
      return;
View Full Code Here

Examples of org.eclipse.core.variables.IValueVariable

   */
  public synchronized void removeVariables(IValueVariable[] variables) {
    initialize();
    List removed = new ArrayList(variables.length);
    for (int i = 0; i < variables.length; i++) {
      IValueVariable variable = variables[i];
      if (fValueVariables.remove(variable.getName()) != null) {
        removed.add(variable);
      }
    }
    if (removed.size() > 0) {
      getNotifier().notify((IValueVariable[])removed.toArray(new IValueVariable[removed.size()]), REMOVED);
View Full Code Here

Examples of org.eclipse.core.variables.IValueVariable

    Document document= getDocument();
    Element rootElement= document.createElement(VALUE_VARIABLES_TAG);
    document.appendChild(rootElement);
    for (int i = 0; i < variables.length; i++) {
      IValueVariable variable = variables[i];
      if (!variable.isReadOnly()){
        // don't persist read-only variables or un-initialized contributed variables
        if (!variable.isContributed() || ((ContributedValueVariable)variable).isInitialized()) {
          Element element= document.createElement(VALUE_VARIABLE_TAG);
          element.setAttribute(NAME_TAG, variable.getName());
          String value= variable.getValue();
          if (value != null) {
            element.setAttribute(VALUE_TAG, value);
          }
          element.setAttribute(READ_ONLY_TAG, variable.isReadOnly() ? TRUE_VALUE : FALSE_VALUE);
          String description= variable.getDescription();
          if (description != null) {
            element.setAttribute(DESCRIPTION_TAG, description);
          }
          rootElement.appendChild(element);
        }
View Full Code Here

Examples of org.eclipse.core.variables.IValueVariable

    public void testPythonCommandLine() throws Exception {
        PythonNature nature = PythonNature.getPythonNature(mod1);

        // Create a temporary variable for testing
        IStringVariableManager variableManager = VariablesPlugin.getDefault().getStringVariableManager();
        IValueVariable myCustomVariable = variableManager.newValueVariable("pydev_python_runner_config_test_var", "",
                true, "my_custom_value");
        variableManager.addVariables(new IValueVariable[] { myCustomVariable });

        try {
            IInterpreterManager manager = PydevPlugin.getPythonInterpreterManager(true);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.