Java 类org.eclipse.debug.core.model.IVariable 实例源码

项目:codehint    文件:SideEffectHandler.java   
private Set<IJavaObject> getAllReachableObjects(SubMonitor monitor) {
    try {
        Set<IJavaObject> objs = new HashSet<IJavaObject>();
        getReachableObjects(stack.getThis(), objs);
        for (IVariable var: stack.getLocalVariables())
            getReachableObjects((IJavaValue)var.getValue(), objs);
        for (ReferenceType type: getAllLoadedTypes(stack)) {
            for (Field field: type.allFields())
                if (field.isStatic() && isUsefulStaticDFSField(type.name(), field))
                    getReachableObjects(JDIValue.createValue((JDIDebugTarget)stack.getDebugTarget(), type.getValue(field)), objs);
            monitor.worked(1);
        }
        return objs;
    } catch (DebugException e) {
        throw new RuntimeException(e);
    }
}
项目:gemoc-studio-modeldebugging    文件:DSLStackFrameAdapter.java   
/**
 * {@inheritDoc}
 * 
 * @see org.eclipse.debug.core.model.IStackFrame#getVariables()
 */
public IVariable[] getVariables() throws DebugException {
    final List<IVariable> res = new ArrayList<IVariable>();

    for (Variable variable : getHost().getVariables()) {
        synchronized(variable) {
            final IVariable var = (IVariable)factory.adapt(variable, IVariable.class);
            if (var != null) {
                res.add(var);
            } else {
                throw new IllegalStateException("can't addapt Variable to IVariable.");
            }
        }
    }

    return res.toArray(new IVariable[res.size()]);
}
项目:gemoc-studio-modeldebugging    文件:DSLArrayValue.java   
/**
 * {@inheritDoc}
 * 
 * @see org.eclipse.debug.core.model.IValue#getValueString()
 */
public String getValueString() throws DebugException {
    StringBuilder builder = new StringBuilder(BUFFER_SIZE);

    builder.append('[');
    if (variables.length > 0) {
        for (IVariable variable : variables) {
            builder = builder.append(variable.getValue().getValueString());
            builder = builder.append(", ");
        }
        builder = builder.delete(builder.length() - ", ".length(), builder.length());
    }
    builder.append(']');

    return builder.toString();
}
项目:pandionj    文件:StackFrameModel.java   
private void handleVariables() throws DebugException {
    handleOutOfScopeVars();

    for(IVariable v : frame.getVariables()) {
        IJavaVariable jv = (IJavaVariable) v;
        String varName = v.getName();
        if(varName.equals("this")) {
            for (IVariable iv : jv.getValue().getVariables()) {
                IJavaVariable att = (IJavaVariable) iv;
                if(!att.isSynthetic() && !att.isStatic()) {
                    handleVar(att, true);
                }
            }
        }

        else if(!jv.isSynthetic()) {
            handleVar(jv, false);
        }
    }
}
项目:pandionj    文件:StackFrameModel.java   
private void handleOutOfScopeVars() throws DebugException {
        Iterator<Entry<String, IVariableModel<?>>> iterator = stackVars.entrySet().iterator();
        while(iterator.hasNext()) {
            Entry<String, IVariableModel<?>> e = iterator.next();
            String varName = e.getKey();
            boolean contains = false;
            for(IVariable v : frame.getVariables()) {
                if(v.getName().equals(varName))
                    contains = true;
//              else if(v.getName().equals("this")) {
//                  for (IVariable iv : v.getValue().getVariables())
//                      if(iv.getName().equals(varName))
//                          contains = true;
//              }
            }
            if(!contains) {
                e.getValue().setOutOfScope();
                iterator.remove();
                setChanged();
                notifyObservers(new StackEvent<IVariableModel<?>>(StackEvent.Type.VARIABLE_OUT_OF_SCOPE, e.getValue()));
            }
        }
    }
项目:chromedevtools    文件:ValueBase.java   
public IVariable[] getVariables() throws DebugException {
  try {
    // TODO: support clearing with cache clear.
    IVariable[] result = variablesRef.get();
    if (result != null) {
      return result;
    }
    IVariable[] variables = calculateVariables();
    variablesRef.compareAndSet(null, variables);
    return variablesRef.get();
  } catch (RuntimeException e) {
    // Log it, because Eclipse is likely to ignore it.
    ChromiumDebugPlugin.log(e);
    // We shouldn't throw RuntimeException from here, because calling
    // ElementContentProvider#update will forget to call update.done().
    throw new DebugException(new Status(IStatus.ERROR, ChromiumDebugPlugin.PLUGIN_ID,
        "Failed to read variables", e)); //$NON-NLS-1$
  }
}
项目:ModelDebugging    文件:DSLStackFrameAdapter.java   
/**
 * {@inheritDoc}
 * 
 * @see org.eclipse.debug.core.model.IStackFrame#getVariables()
 */
public IVariable[] getVariables() throws DebugException {
    final List<IVariable> res = new ArrayList<IVariable>();

    for (Variable variable : getHost().getVariables()) {
        synchronized(variable) {
            final IVariable var = (IVariable)factory.adapt(variable, IVariable.class);
            if (var != null) {
                res.add(var);
            } else {
                throw new IllegalStateException("can't addapt Variable to IVariable.");
            }
        }
    }

    return res.toArray(new IVariable[res.size()]);
}
项目:ModelDebugging    文件:DSLArrayValue.java   
/**
 * {@inheritDoc}
 * 
 * @see org.eclipse.debug.core.model.IValue#getValueString()
 */
public String getValueString() throws DebugException {
    StringBuilder builder = new StringBuilder(BUFFER_SIZE);

    builder.append('[');
    if (variables.length > 0) {
        for (IVariable variable : variables) {
            builder = builder.append(variable.getValue().getValueString());
            builder = builder.append(", ");
        }
        builder = builder.delete(builder.length() - ", ".length(), builder.length());
    }
    builder.append(']');

    return builder.toString();
}
项目:debukviz    文件:DebuKVizSynthesis.java   
public KNode transform(final IVariable variable) {
    DebuKVizDialog.resetShown();

    // Generate a top-level KNode and set some layout options
    KNode graph = KGraphUtil.createInitializedNode();
    graph.setProperty(CoreOptions.DIRECTION, Direction.DOWN);
    graph.setProperty(LayeredOptions.NODE_PLACEMENT_STRATEGY, NodePlacementStrategy.LINEAR_SEGMENTS);

    // Generate a transformation context
    VariableTransformationContext context = new VariableTransformationContext();

    // Start the mighty transformation!
    try {
        VariableTransformation.invokeFor(variable, graph, context);
    } catch (DebugException e) {
        StatusManager.getManager().handle(new Status(
                Status.ERROR,
                DebuKVizPlugin.PLUGIN_ID,
                "Error accessing the Eclipse debug framework.",
                e));
    }

    return graph;
}
项目:vebugger    文件:VisualDetailPane.java   
/**
 * Render a selected variable.
 * 
 * @param selection
 *            the selection object
 * @param element
 *            the variable element
 * @throws DebugException
 */
private void displayVariable(IStructuredSelection selection, IDebugElement element) throws DebugException {
    IValue value = ((IVariable) element).getValue();

    if (value instanceof IJavaPrimitiveValue) {
        setBrowserTextToPrimitive((IJavaPrimitiveValue) value);
    } else {
        TreePath firstElementTreePath = ((TreeSelection) selection).getPaths()[0];
        String watchExpression = generateWatchExpression(firstElementTreePath);
        String messageExpression = generateMessageExpression(watchExpression);

        // Iterate all threads and run our rendering
        // expression in them in the hopes that we can find
        // the relevant selection in only one thread
        // FIXME find a better way to derive the correct thread!
        IWatchExpressionDelegate delegate = DebugPlugin.getDefault().getExpressionManager()
                .newWatchExpressionDelegate(element.getModelIdentifier());
        for (IThread thread : element.getDebugTarget().getThreads()) {
            delegate.evaluateExpression(messageExpression, thread, this);
        }
    }
}
项目:Pydev    文件:ReferrersViewContentProvider.java   
@Override
public boolean hasChildren(Object element) {
    try {
        if (element instanceof XMLToReferrersInfo) {
            return true;
        }
        if (element instanceof IVariable) {
            Object[] objects = childrenCache.get(element);
            if (objects != null && objects.length > 0) {
                return true;
            }
            IVariable iVariable = (IVariable) element;
            return iVariable.getValue().hasVariables();
        }
    } catch (Exception e) {
        Log.log(e);
    }
    return false;

}
项目:Pydev    文件:ContainerOfVariables.java   
PyVariable[] setVariables(PyVariable[] newVars) {
    IVariable[] oldVars = this.variables;
    if (newVars == oldVars) {
        return newVars;
    }
    IVariablesContainerParent p = this.parent.get();
    if (p == null) {
        return newVars;
    }
    AbstractDebugTarget target = p.getTarget();
    this.variables = newVars;

    if (!gettingInitialVariables) {
        if (target != null) {
            target.fireEvent(new DebugEvent(p, DebugEvent.CHANGE, DebugEvent.CONTENT));
        }
    }
    return newVars;
}
项目:Pydev    文件:ContainerOfVariables.java   
public IVariable[] getVariables() throws DebugException {
    // System.out.println("get variables: " + super.toString() + " initial: " + this.variables);
    if (onAskGetNewVars) {
        synchronized (lock) {
            //double check idiom for accessing onAskGetNewVars.
            if (onAskGetNewVars) {
                gettingInitialVariables = true;
                try {
                    PyVariable[] vars = variablesLoader.fetchVariables();

                    setVariables(vars);
                    // Important: only set to false after variables have been set.
                    onAskGetNewVars = false;
                } finally {
                    gettingInitialVariables = false;
                }
            }
        }
    }
    return this.variables;
}
项目:codehint    文件:DemonstrateTypeHandler.java   
private static void handle(IVariable variable, String path, Shell shell, Matcher matcher, IJavaStackFrame stack) throws DebugException {
IJavaType varType = EclipseUtils.getTypeOfVariableAndLoadIfNeeded((IJavaVariable)variable, stack);
String varTypeName = EclipseUtils.sanitizeTypename(varType.getName());
String initValue = "";
if (matcher != null) {
    if (!matcher.group(2).equals(variable.getName())) {
        EclipseUtils.showError("Illegal variable.", "The first argument to the pdspec method, " + matcher.group(2) + ", must be the same as the variable on which you right-clicked, " + variable.getName() + ".", null);
        return;
    }
    initValue = matcher.group(1);
    if (initValue == null)
        initValue = varTypeName;
} else
    initValue = varTypeName;
InitialSynthesisDialog dialog = new InitialSynthesisDialog(shell, varTypeName, varType, stack, new TypePropertyDialog(path, varTypeName, stack, initValue, null), new SynthesisWorker(path, varType));
    Synthesizer.synthesizeAndInsertStatements(variable, path, dialog, stack, matcher != null);
  }
项目:codehint    文件:DemonstrateValueHandler.java   
private static void handle(IVariable variable, String path, Shell shell, Matcher matcher, IJavaStackFrame stack) throws DebugException {
String initValue = null;
if (matcher != null) {
    if (!matcher.group(1).equals(variable.getName())) {
        EclipseUtils.showError("Illegal variable.", "The first argument to the value method, " + matcher.group(1) + ", must be the same as the variable on which you right-clicked, " + variable.getName() + ".", null);
        return;
    }
    initValue = matcher.group(2);
} else
    initValue = "";
IJavaType varType = EclipseUtils.getTypeOfVariableAndLoadIfNeeded((IJavaVariable)variable, stack);
String varTypeName = EclipseUtils.sanitizeTypename(varType.getName());
PropertyDialog propertyDialog = null;
if (EclipseUtils.isObject(variable))
    propertyDialog = new ObjectValuePropertyDialog(path, varTypeName, stack, initValue, null);
else if (EclipseUtils.isArray(variable))
    propertyDialog = new ArrayValuePropertyDialog(path, varTypeName, stack, initValue, null);
else
    propertyDialog = new PrimitiveValuePropertyDialog(path, varTypeName, stack, initValue, null);
InitialSynthesisDialog dialog = new InitialSynthesisDialog(shell, varTypeName, varType, stack, propertyDialog, new SynthesisWorker(path, varType));
Synthesizer.synthesizeAndInsertStatements(variable, path, dialog, stack, initValue.length() > 0);
  }
项目:gemoc-studio-modeldebugging    文件:DSLEclipseDebugIntegration.java   
/**
 * Initializes {@link DSLEclipseDebugIntegration#SUPPORTED_TYPES}.
 * 
 * @return the {@link Set} of
 *         {@link org.eclipse.emf.common.notify.AdapterFactory#isFactoryForType(Object) supported
 *         types}.
 */
private static Set<Object> initSupportedTypes() {
final Set<Object> res = new HashSet<Object>();

res.add(IThread.class);
res.add(IDebugTarget.class);
res.add(IStackFrame.class);
res.add(IVariable.class);
res.add(IBreakpoint.class);

return res;
}
项目:gemoc-studio-modeldebugging    文件:DSLEclipseDebugIntegration.java   
/**
 * Gets an {@link IVariable} form a {@link Variable}.
 * 
 * @param variable
 *            the {@link Variable}
 * @return the {@link IVariable}
 */
public DSLVariableAdapter getVariable(Variable variable) {
synchronized(variable) {
    final DSLVariableAdapter res = (DSLVariableAdapter)adapt(variable, IVariable.class);
    if (res == null) {
    throw new IllegalStateException("can't addapt Variable to IVariable.");
    }
    return res;
}
}
项目:gemoc-studio-modeldebugging    文件:DSLEObjectValueAdapter.java   
/**
 * {@inheritDoc}
 * 
 * @see org.eclipse.debug.core.model.IValue#getVariables()
 */
public IVariable[] getVariables() throws DebugException {
    IVariable[] res = new IVariable[getHost().eClass().getEAllStructuralFeatures().size()];
    int i = 0;
    for (EStructuralFeature feature : getHost().eClass().getEAllStructuralFeatures()) {
        res[i] = (IVariable)factory.getVariable(feature.getEType().getName(), feature.getName(),
                getHost().eGet(feature));
        ++i;
    }
    return res;
}
项目:dsp4e    文件:DSPStackFrame.java   
@Override
public IVariable[] getVariables() throws DebugException {
    Scope[] scopes = complete(
            getDebugTarget().debugProtocolServer.scopes(new ScopesArguments().setFrameId(stackFrame.id))).scopes;
    List<DSPVariable> vars = new ArrayList<>();
    for (Scope scope : scopes) {
        DSPVariable variable = new DSPVariable(this, scope.variablesReference, scope.name, "");
        vars.add(variable);
    }
    return vars.toArray(new IVariable[vars.size()]);
}
项目:visuflow-plugin    文件:StackExaminer.java   
private static String getUnitFromTopStackFrame(IJavaThread thread) throws CoreException {
    if (!thread.hasStackFrames()) {
        return null;
    }

    IStackFrame top = thread.getTopStackFrame();
    if (top.getVariables().length > 0) {
        for (IVariable var : top.getVariables()) {
            try {
                IValue value = var.getValue();
                if (value instanceof IJavaValue) {
                    IJavaObject javaValue = (IJavaObject) value;
                    IJavaDebugTarget debugTarget = thread.getDebugTarget().getAdapter(IJavaDebugTarget.class);
                    IJavaValue arg = debugTarget.newValue("Fully Qualified Name");
                    // the signature (2nd argument) can be retrieved with javap. Unit extends soot.tagkit.Host for the tag support
                    // -> javap -cp soot-trunk.jar -s soot.tagkit.Host
                    // the signature is in the output under "descriptor"
                    IJavaType type = javaValue.getJavaType();
                    if (isTagHost(type)) { // check, if this is a unit, which contains Tags
                        IJavaValue fqnTag = javaValue.sendMessage("getTag", "(Ljava/lang/String;)Lsoot/tagkit/Tag;", new IJavaValue[] { arg }, thread,
                                false);
                        IJavaValue tagValue = ((IJavaObject) fqnTag).sendMessage("getValue", "()[B", new IJavaValue[0], thread, false);
                        IJavaArray byteArray = (IJavaArray) tagValue;
                        byte[] b = new byte[byteArray.getLength()];
                        for (int i = 0; i < b.length; i++) {
                            IJavaPrimitiveValue byteValue = (IJavaPrimitiveValue) byteArray.getValue(i);
                            b[i] = byteValue.getByteValue();
                        }
                        String currentUnitFqn = new String(b);
                        return currentUnitFqn;
                    }
                }
            } catch (Exception e) {
                logger.error("Couldn't retrieve variable " + var.getName() + " from top stack frame", e);
            }
        }
    }
    return null;
}
项目:chromedevtools    文件:Variable.java   
public String createWatchExpression(IVariable variable) throws CoreException {
  Variable castVariable = (Variable) variable;
  String expressionText = castVariable.createWatchExpression();
  if (expressionText == null) {
    throw new CoreException(new Status(IStatus.ERROR, ChromiumDebugPlugin.PLUGIN_ID,
        Messages.Variable_CANNOT_BUILD_EXPRESSION));
  }
  return expressionText;
}
项目:chromedevtools    文件:JavascriptThread.java   
private ExceptionStackFrame(EvaluateContext evaluateContext, ExceptionData exceptionData) {
  super(evaluateContext);
  this.exceptionData = exceptionData;

  Variable variable =
      Variable.forException(evaluateContext, exceptionData.getExceptionValue());
  variables = new IVariable[] { variable };
}
项目:chromedevtools    文件:ArrayValue.java   
private IVariable[] createElements() {
  JsArray jsArray = (JsArray) getJsValue();
  return StackFrame.wrapVariables(getEvaluateContext(), jsArray.getProperties(),
      ARRAY_HIDDEN_PROPERTY_NAMES,
      // Do not show internal properties for arrays (this may be an option).
      null, null, getExpressionTrackerNode());
}
项目:chromedevtools    文件:ArrayValue.java   
private IVariable[] getElements() {
  IVariable[] result = elementsRef.get();
  if (result == null) {
    result = createElements();
    elementsRef.compareAndSet(null, result);
    return elementsRef.get();
  } else {
    return result;
  }
}
项目:chromedevtools    文件:StackFrame.java   
public IVariable[] getVariables() throws DebugException {
  if (variables == null) {
    try {
      variables = wrapScopes(getEvaluateContext(), stackFrame.getVariableScopes(),
          stackFrame.getReceiverVariable(), ExpressionTracker.STACK_FRAME_FACTORY);
    } catch (RuntimeException e) {
      // We shouldn't throw RuntimeException from here, because calling
      // ElementContentProvider#update will forget to call update.done().
      throw new DebugException(new Status(IStatus.ERROR, ChromiumDebugPlugin.PLUGIN_ID,
          "Failed to read variables", e)); //$NON-NLS-1$
    }
  }
  return variables;
}
项目:chromedevtools    文件:ValueBase.java   
public ErrorMessageValue(EvaluateContext evaluateContext, String message,
    JsValue exceptionValue) {
  super(evaluateContext);
  this.message = message;
  if (exceptionValue == null) {
    innerVariables = Value.EMPTY_VARIABLES;
  } else {
    innerVariables =
        new IVariable[] { Variable.forException(evaluateContext, exceptionValue) };
  }
}
项目:chromedevtools    文件:Value.java   
protected IVariable[] calculateVariables() {
  JsObject asObject = value.asObject();
  if (asObject == null) {
    return EMPTY_VARIABLES;
  }
  List<Variable> functionScopes = calculateFunctionScopesVariable(asObject);
  return StackFrame.wrapVariables(getEvaluateContext(),
      asObject.getProperties(), Collections.<String>emptySet(),
      asObject.getInternalProperties(), functionScopes, expressionNode);
}
项目:ModelDebugging    文件:DSLEclipseDebugIntegration.java   
/**
 * Initializes {@link DSLEclipseDebugIntegration#SUPPORTED_TYPES}.
 * 
 * @return the {@link Set} of
 *         {@link org.eclipse.emf.common.notify.AdapterFactory#isFactoryForType(Object) supported
 *         types}.
 */
private static Set<Object> initSupportedTypes() {
final Set<Object> res = new HashSet<Object>();

res.add(IThread.class);
res.add(IDebugTarget.class);
res.add(IStackFrame.class);
res.add(IVariable.class);
res.add(IBreakpoint.class);

return res;
}
项目:ModelDebugging    文件:DSLEclipseDebugIntegration.java   
/**
 * Gets an {@link IVariable} form a {@link Variable}.
 * 
 * @param variable
 *            the {@link Variable}
 * @return the {@link IVariable}
 */
public DSLVariableAdapter getVariable(Variable variable) {
synchronized(variable) {
    final DSLVariableAdapter res = (DSLVariableAdapter)adapt(variable, IVariable.class);
    if (res == null) {
    throw new IllegalStateException("can't addapt Variable to IVariable.");
    }
    return res;
}
}
项目:ModelDebugging    文件:DSLEObjectValueAdapter.java   
/**
 * {@inheritDoc}
 * 
 * @see org.eclipse.debug.core.model.IValue#getVariables()
 */
public IVariable[] getVariables() throws DebugException {
    IVariable[] res = new IVariable[getHost().eClass().getEAllStructuralFeatures().size()];
    int i = 0;
    for (EStructuralFeature feature : getHost().eClass().getEAllStructuralFeatures()) {
        res[i] = (IVariable)factory.getVariable(feature.getEType().getName(), feature.getName(),
                getHost().eGet(feature));
        ++i;
    }
    return res;
}
项目:debukviz    文件:VariablesDiagramViewPart.java   
/**
 * {@inheritDoc}
 * 
 * If selection is an instance of {@link StructuredSelection} and the first element is an
 * instance of {@link IVariable}, update our variables diagram view.
 */
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
    if (selection instanceof StructuredSelection) {
        Object firstElement = ((StructuredSelection) selection).getFirstElement();
        if (firstElement instanceof IVariable) {
            IVariable var = (IVariable) firstElement;

            if (getViewContext() == null) {
                initialize(var, null, null);
            } else {
                DiagramViewManager.updateView(getViewContext(), var);
            }
        }
    }
}
项目:debukviz    文件:VariableTransformation.java   
/**
 * Invokes a transformation that transforms the given variable into its visual representation. Does
 * nothing if the variable already has a visual representation associated with it in the context or
 * if the recursion or node count limits have already been reached. Thus, after calling this method,
 * the variable to be transformed might not actually have been associated with a visual
 * representation in the transformation context.
 * 
 * <p>To find the node associated with the given variable (if any) after calling this method, use
 * {@link VariableTransformationContext#findAssociation(IVariable)}.</p>
 * 
 * @param variable the variable to transform.
 * @param graph the parent graph to add the transformed representation to.
 * @param context the transformation context to pass to the transformation.
 * @throws DebugException if anything goes wrong when accessing the Eclipse debug system.
 */
public static final void invokeFor(final IVariable variable, final KNode graph,
        final VariableTransformationContext context) throws DebugException {

    // Check if the maximum node count or maximum transformation depth are already reached
    if (context.getTransformationDepth() >= DebuKVizPlugin.MAX_REFERENCES_FOLLOWED) {
        // TODO Perhaps create a certain kind of dummy node here?
        //      That would make it clear that the transformation stopped there
        return;
    }

    // Check if the variable was already transformed
    if (context.findAssociation(variable) != null) {
        return;
    }

    // Fetch a transformation that can handle this variable's type
    VariableTransformation transformation =
            DebuKVizTransformationService.INSTANCE.transformationFor(variable);

    if (transformation != null) {
        // Invoke transformation
        context.increaseTransformationDepth();
        transformation.transform(variable, graph, context);
        context.decreaseTransformationDepth();
    }
}
项目:debukviz    文件:VariableTransformation.java   
/**
 * Determine whether the given value contains a variable with the given name.
 * 
 * @param value a value
 * @param name a variable name
 * @return true if the value contains a variable with the given name
 * @throws DebugException if accessing the debug model fails
 */
protected final boolean hasNamedVariable(IValue value, String name) throws DebugException {
    for (IVariable v : value.getVariables()) {
        if (v.getName().equals(name)) {
            return true;
        }
    }
    return false;
}
项目:debukviz    文件:VariableTransformation.java   
/**
 * Retrieve a variable with given name referenced from the given value.
 * 
 * @param value a value
 * @param name the name of a variable referenced by {@code value}
 * @return the first variable matching the given name
 * @throws DebugException if accessing the debug model fails
 */
protected final IVariable getNamedVariable(IValue value, String name) throws DebugException {
    for (IVariable v : value.getVariables()) {
        if (v.getName().equals(name)) {
            return v;
        }
    }
    throw new IllegalArgumentException("The given variable name was not found: " + name);
}
项目:debukviz    文件:VariableTransformation.java   
/**
 * Return the value of a variable as an int number.
 * 
 * @param variable a variable
 * @return the value of the given variable interpreted as int
 * @throws DebugException if accessing the debug model fails
 */
protected final int getIntValue(IVariable variable) throws DebugException {
    try {
        return Integer.parseInt(variable.getValue().getValueString());
    } catch (NumberFormatException exception) {
        throw new IllegalArgumentException(exception);
    }
}
项目:debukviz    文件:VariableTransformation.java   
/**
 * Return the value of a variable as a byte number.
 * 
 * @param variable a variable
 * @return the value of the given variable interpreted as byte
 * @throws DebugException if accessing the debug model fails
 */
protected final byte getByteValue(IVariable variable) throws DebugException {
    try {
        return Byte.parseByte(variable.getValue().getValueString());
    } catch (NumberFormatException exception) {
        throw new IllegalArgumentException(exception);
    }
}
项目:debukviz    文件:VariableTransformation.java   
/**
 * Return the value of a variable as a long number.
 * 
 * @param variable a variable
 * @return the value of the given variable interpreted as long
 * @throws DebugException if accessing the debug model fails
 */
protected final long getLongValue(IVariable variable) throws DebugException {
    try {
        return Long.parseLong(variable.getValue().getValueString());
    } catch (NumberFormatException exception) {
        throw new IllegalArgumentException(exception);
    }
}
项目:debukviz    文件:VariableTransformation.java   
/**
 * Return the value of a variable as a float number.
 * 
 * @param variable a variable
 * @return the value of the given variable interpreted as float
 * @throws DebugException if accessing the debug model fails
 */
protected final float getFloatValue(IVariable variable) throws DebugException {
    try {
        return Float.parseFloat(variable.getValue().getValueString());
    } catch (NumberFormatException exception) {
        throw new IllegalArgumentException(exception);
    }
}
项目:debukviz    文件:VariableTransformation.java   
/**
 * Return the value of a variable as a double number.
 * 
 * @param variable a variable
 * @return the value of the given variable interpreted as double
 * @throws DebugException if accessing the debug model fails
 */
protected final double getDoubleValue(IVariable variable) throws DebugException {
    try {
        return Double.parseDouble(variable.getValue().getValueString());
    } catch (NumberFormatException exception) {
        throw new IllegalArgumentException(exception);
    }
}
项目:debukviz    文件:NodeBuilder.java   
/**
 * Creates a new node builder for a node that is associated with a variable. Once the node is
 * created, the node builder will establish the association in the transformation context.
 * 
 * @param variable the variable the node will be created for.
 * @param graph the graph the created node will be added to.
 * @param context the transformation context that will be updated as the node is created.
 * @return the node builder.
 */
public static NodeBuilder forVariable(final IVariable variable, final KNode graph,
        final VariableTransformationContext context) {

    if (variable == null) {
        throw new NullPointerException("variable cannot be null");
    }

    NodeBuilder builder = forPlainNode(graph, context);
    builder.variable = variable;

    return builder;
}