use of com.intellij.debugger.impl.DebuggerContextImpl in project intellij-community by JetBrains.
the class DebuggerTreeNodeImpl method calcLabel.
public void calcLabel() {
final DebuggerContextImpl context = getTree().getDebuggerContext();
update(context, () -> getDescriptor().updateRepresentation(context.createEvaluationContext(), new DescriptorLabelListener() {
@Override
public void labelChanged() {
updateCaches();
DebuggerTreeNodeImpl.this.labelChanged();
}
}), true);
}
use of com.intellij.debugger.impl.DebuggerContextImpl in project intellij-community by JetBrains.
the class EvaluationDescriptor method getModifier.
@Override
public XValueModifier getModifier(JavaValue value) {
return new JavaValueModifier(value) {
@Override
protected void setValueImpl(@NotNull String expression, @NotNull XModificationCallback callback) {
final EvaluationDescriptor evaluationDescriptor = EvaluationDescriptor.this;
if (evaluationDescriptor.canSetValue()) {
final DebuggerContextImpl debuggerContext = DebuggerManagerEx.getInstanceEx(getProject()).getContext();
set(expression, callback, debuggerContext, new SetValueRunnable() {
public void setValue(EvaluationContextImpl evaluationContext, Value newValue) throws ClassNotLoadedException, InvalidTypeException, EvaluateException {
final Modifier modifier = evaluationDescriptor.getModifier();
modifier.setValue(preprocessValue(evaluationContext, newValue, modifier.getExpectedType()));
update(debuggerContext);
}
public ReferenceType loadClass(EvaluationContextImpl evaluationContext, String className) throws InvocationException, ClassNotLoadedException, IncompatibleThreadStateException, InvalidTypeException, EvaluateException {
return evaluationContext.getDebugProcess().loadClass(evaluationContext, className, evaluationContext.getClassLoader());
}
});
}
}
};
}
use of com.intellij.debugger.impl.DebuggerContextImpl in project intellij-community by JetBrains.
the class FieldDescriptorImpl method getModifier.
@Override
public XValueModifier getModifier(JavaValue value) {
return new JavaValueModifier(value) {
@Override
protected void setValueImpl(@NotNull String expression, @NotNull XModificationCallback callback) {
final DebuggerContextImpl debuggerContext = DebuggerManagerEx.getInstanceEx(getProject()).getContext();
FieldDescriptorImpl fieldDescriptor = FieldDescriptorImpl.this;
final Field field = fieldDescriptor.getField();
if (!field.isStatic()) {
final ObjectReference object = fieldDescriptor.getObject();
if (object != null) {
set(expression, callback, debuggerContext, new SetValueRunnable() {
public void setValue(EvaluationContextImpl evaluationContext, Value newValue) throws ClassNotLoadedException, InvalidTypeException, EvaluateException {
object.setValue(field, preprocessValue(evaluationContext, newValue, field.type()));
update(debuggerContext);
}
public ReferenceType loadClass(EvaluationContextImpl evaluationContext, String className) throws InvocationException, ClassNotLoadedException, IncompatibleThreadStateException, InvalidTypeException, EvaluateException {
return evaluationContext.getDebugProcess().loadClass(evaluationContext, className, field.declaringType().classLoader());
}
});
}
} else {
// field is static
ReferenceType refType = field.declaringType();
if (refType instanceof ClassType) {
final ClassType classType = (ClassType) refType;
set(expression, callback, debuggerContext, new SetValueRunnable() {
public void setValue(EvaluationContextImpl evaluationContext, Value newValue) throws ClassNotLoadedException, InvalidTypeException, EvaluateException {
classType.setValue(field, preprocessValue(evaluationContext, newValue, field.type()));
update(debuggerContext);
}
public ReferenceType loadClass(EvaluationContextImpl evaluationContext, String className) throws InvocationException, ClassNotLoadedException, IncompatibleThreadStateException, InvalidTypeException, EvaluateException {
return evaluationContext.getDebugProcess().loadClass(evaluationContext, className, field.declaringType().classLoader());
}
});
}
}
}
};
}
use of com.intellij.debugger.impl.DebuggerContextImpl in project intellij-community by JetBrains.
the class ArrayElementDescriptorImpl method getModifier.
@Override
public XValueModifier getModifier(JavaValue value) {
return new JavaValueModifier(value) {
@Override
protected void setValueImpl(@NotNull String expression, @NotNull XModificationCallback callback) {
final ArrayElementDescriptorImpl elementDescriptor = ArrayElementDescriptorImpl.this;
final ArrayReference array = elementDescriptor.getArray();
if (array != null) {
if (VirtualMachineProxyImpl.isCollected(array)) {
// will only be the case if debugger does not use ObjectReference.disableCollection() because of Patches.IBM_JDK_DISABLE_COLLECTION_BUG
Messages.showWarningDialog(getProject(), DebuggerBundle.message("evaluation.error.array.collected") + "\n" + DebuggerBundle.message("warning.recalculate"), DebuggerBundle.message("title.set.value"));
//node.getParent().calcValue();
return;
}
final ArrayType arrType = (ArrayType) array.referenceType();
final DebuggerContextImpl debuggerContext = DebuggerManagerEx.getInstanceEx(getProject()).getContext();
set(expression, callback, debuggerContext, new SetValueRunnable() {
public void setValue(EvaluationContextImpl evaluationContext, Value newValue) throws ClassNotLoadedException, InvalidTypeException, EvaluateException {
array.setValue(elementDescriptor.getIndex(), preprocessValue(evaluationContext, newValue, arrType.componentType()));
update(debuggerContext);
}
public ReferenceType loadClass(EvaluationContextImpl evaluationContext, String className) throws InvocationException, ClassNotLoadedException, IncompatibleThreadStateException, InvalidTypeException, EvaluateException {
return evaluationContext.getDebugProcess().loadClass(evaluationContext, className, arrType.classLoader());
}
});
}
}
};
}
use of com.intellij.debugger.impl.DebuggerContextImpl in project android by JetBrains.
the class ResolveTypedIntegerCommand method action.
@Override
public void action() {
// TODO: see if it is possible to cache this evaluation
// if (myIsEvaluated) return;
DebugProcess debugProcess = myEvaluationContext.getDebugProcess();
if (!(debugProcess instanceof DebugProcessImpl)) {
return;
}
final DebuggerContextImpl debuggerContext = ((DebugProcessImpl) debugProcess).getDebuggerContext();
PsiAnnotation annotation = ApplicationManager.getApplication().runReadAction(new Computable<PsiAnnotation>() {
@Override
public PsiAnnotation compute() {
try {
return getAnnotation(debuggerContext);
} catch (IndexNotReadyException e) {
return null;
}
}
});
if (annotation != null) {
ResourceIdResolver resolver = ServiceManager.getService(myEvaluationContext.getProject(), ResourceIdResolver.class);
DynamicResourceIdResolver resolver1 = new DynamicResourceIdResolver(myEvaluationContext, resolver);
myResult = AnnotationsRenderer.render(resolver1, annotation, ((IntegerValue) myValue).value());
}
evaluationResult("");
}
Aggregations