use of com.intellij.debugger.engine.evaluation.EvaluateException in project intellij-community by JetBrains.
the class ExpressionChildrenRenderer method isExpandable.
public boolean isExpandable(Value value, final EvaluationContext context, NodeDescriptor parentDescriptor) {
final EvaluationContext evaluationContext = context.createEvaluationContext(value);
if (!StringUtil.isEmpty(myChildrenExpandable.getReferenceExpression().getText())) {
try {
Value expanded = myChildrenExpandable.getEvaluator(evaluationContext.getProject()).evaluate(evaluationContext);
if (expanded instanceof BooleanValue) {
return ((BooleanValue) expanded).booleanValue();
}
} catch (EvaluateException e) {
// ignored
}
}
try {
Value children = evaluateChildren(evaluationContext, parentDescriptor);
ChildrenRenderer defaultChildrenRenderer = DebugProcessImpl.getDefaultRenderer(value.type());
return defaultChildrenRenderer.isExpandable(children, evaluationContext, parentDescriptor);
} catch (EvaluateException e) {
return true;
}
}
use of com.intellij.debugger.engine.evaluation.EvaluateException in project intellij-community by JetBrains.
the class IconObjectRenderer method calcValueIcon.
@Override
public Icon calcValueIcon(final ValueDescriptor descriptor, final EvaluationContext evaluationContext, final DescriptorLabelListener listener) throws EvaluateException {
EvaluationContextImpl evalContext = ((EvaluationContextImpl) evaluationContext);
DebugProcessImpl debugProcess = evalContext.getDebugProcess();
if (!Registry.is("debugger.auto.fetch.icons") || DebuggerUtilsImpl.isRemote(debugProcess))
return null;
debugProcess.getManagerThread().schedule(new SuspendContextCommandImpl(evalContext.getSuspendContext()) {
@Override
public void contextAction() throws Exception {
String getterName = AllIcons.Debugger.Value.getIconHeight() <= 16 ? "iconToBytesPreviewNormal" : "iconToBytesPreviewRetina";
descriptor.setValueIcon(ImageObjectRenderer.getIcon(evaluationContext, descriptor.getValue(), getterName));
listener.labelChanged();
}
});
return null;
}
use of com.intellij.debugger.engine.evaluation.EvaluateException in project intellij-community by JetBrains.
the class LabelRenderer method calcLabel.
public String calcLabel(ValueDescriptor descriptor, EvaluationContext evaluationContext, DescriptorLabelListener labelListener) throws EvaluateException {
final Value value = descriptor.getValue();
String result;
final DebugProcess debugProcess = evaluationContext.getDebugProcess();
if (value != null) {
try {
final ExpressionEvaluator evaluator = myLabelExpression.getEvaluator(debugProcess.getProject());
if (!debugProcess.isAttached()) {
throw EvaluateExceptionUtil.PROCESS_EXITED;
}
EvaluationContext thisEvaluationContext = evaluationContext.createEvaluationContext(value);
Value labelValue = evaluator.evaluate(thisEvaluationContext);
result = DebuggerUtils.getValueAsString(thisEvaluationContext, labelValue);
} catch (final EvaluateException ex) {
throw new EvaluateException(DebuggerBundle.message("error.unable.to.evaluate.expression") + " " + ex.getMessage(), ex);
}
} else {
//noinspection HardCodedStringLiteral
result = "null";
}
return result;
}
use of com.intellij.debugger.engine.evaluation.EvaluateException in project intellij-community by JetBrains.
the class ClassRenderer method getChildValueExpression.
@Override
public PsiElement getChildValueExpression(DebuggerTreeNode node, DebuggerContext context) throws EvaluateException {
FieldDescriptor fieldDescriptor = (FieldDescriptor) node.getDescriptor();
PsiElementFactory elementFactory = JavaPsiFacade.getInstance(node.getProject()).getElementFactory();
try {
return elementFactory.createExpressionFromText("this." + fieldDescriptor.getField().name(), DebuggerUtils.findClass(fieldDescriptor.getObject().referenceType().name(), context.getProject(), context.getDebugProcess().getSearchScope()));
} catch (IncorrectOperationException e) {
throw new EvaluateException(DebuggerBundle.message("error.invalid.field.name", fieldDescriptor.getField().name()), null);
}
}
use of com.intellij.debugger.engine.evaluation.EvaluateException in project intellij-community by JetBrains.
the class RequestManagerImpl method addLocatableRequest.
private void addLocatableRequest(FilteredRequestor requestor, EventRequest request) {
if (DebuggerSettings.SUSPEND_ALL.equals(requestor.getSuspendPolicy())) {
request.setSuspendPolicy(EventRequest.SUSPEND_ALL);
} else {
//when requestor.SUSPEND_POLICY == SUSPEND_NONE
//we should pause thread in order to evaluate conditions
request.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);
}
// count filter has to be applied manually if condition is specified
if (requestor.isCountFilterEnabled() && !requestor.isConditionEnabled()) {
request.addCountFilter(requestor.getCountFilter());
}
if (requestor.isClassFiltersEnabled() && !(request instanceof BreakpointRequest)) /*no built-in class filters support for breakpoint requests*/
{
ClassFilter[] classFilters = requestor.getClassFilters();
if (DebuggerUtilsEx.getEnabledNumber(classFilters) == 1) {
for (final ClassFilter filter : classFilters) {
if (!filter.isEnabled()) {
continue;
}
final JVMName jvmClassName = ApplicationManager.getApplication().runReadAction(new Computable<JVMName>() {
public JVMName compute() {
PsiClass psiClass = DebuggerUtils.findClass(filter.getPattern(), myDebugProcess.getProject(), myDebugProcess.getSearchScope());
if (psiClass == null) {
return null;
}
return JVMNameUtil.getJVMQualifiedName(psiClass);
}
});
String pattern = filter.getPattern();
try {
if (jvmClassName != null) {
pattern = jvmClassName.getName(myDebugProcess);
}
} catch (EvaluateException ignored) {
}
addClassFilter(request, pattern);
// adding more than one inclusion filter does not work, only events that satisfy ALL filters are placed in the event queue.
break;
}
}
for (ClassFilter filter : requestor.getClassExclusionFilters()) {
if (filter.isEnabled()) {
addClassExclusionFilter(request, filter.getPattern());
}
}
}
registerRequestInternal(requestor, request);
}
Aggregations