本文整理汇总了Java中org.eclipse.debug.core.model.IVariable类的典型用法代码示例。如果您正苦于以下问题:Java IVariable类的具体用法?Java IVariable怎么用?Java IVariable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IVariable类属于org.eclipse.debug.core.model包,在下文中一共展示了IVariable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAllReachableObjects
import org.eclipse.debug.core.model.IVariable; //导入依赖的package包/类
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);
}
}
示例2: getVariables
import org.eclipse.debug.core.model.IVariable; //导入依赖的package包/类
/**
* {@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()]);
}
示例3: getValueString
import org.eclipse.debug.core.model.IVariable; //导入依赖的package包/类
/**
* {@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();
}
示例4: handleVariables
import org.eclipse.debug.core.model.IVariable; //导入依赖的package包/类
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);
}
}
}
示例5: handleOutOfScopeVars
import org.eclipse.debug.core.model.IVariable; //导入依赖的package包/类
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()));
}
}
}
示例6: getVariables
import org.eclipse.debug.core.model.IVariable; //导入依赖的package包/类
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$
}
}
示例7: transform
import org.eclipse.debug.core.model.IVariable; //导入依赖的package包/类
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;
}
示例8: displayVariable
import org.eclipse.debug.core.model.IVariable; //导入依赖的package包/类
/**
* 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);
}
}
}
示例9: hasChildren
import org.eclipse.debug.core.model.IVariable; //导入依赖的package包/类
@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;
}
示例10: setVariables
import org.eclipse.debug.core.model.IVariable; //导入依赖的package包/类
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;
}
示例11: getVariables
import org.eclipse.debug.core.model.IVariable; //导入依赖的package包/类
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;
}
示例12: handle
import org.eclipse.debug.core.model.IVariable; //导入依赖的package包/类
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);
}
示例13: handle
import org.eclipse.debug.core.model.IVariable; //导入依赖的package包/类
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);
}
示例14: initSupportedTypes
import org.eclipse.debug.core.model.IVariable; //导入依赖的package包/类
/**
* 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;
}
示例15: getVariable
import org.eclipse.debug.core.model.IVariable; //导入依赖的package包/类
/**
* 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;
}
}