@SuppressWarnings("HardCodedStringLiteral") @NotNull public String getDescription() { final StringBuilder buf = StringBuilderSpinAllocator.alloc(); try { buf.append("<html><body>"); buf.append(getDisplayName()); if (myInvalidMessage != null && !myInvalidMessage.isEmpty()) { buf.append("<br><font color='red'>"); buf.append(DebuggerBundle.message("breakpoint.warning", myInvalidMessage)); buf.append("</font>"); } buf.append(" <br> "); buf.append(DebuggerBundle.message("breakpoint.property.name.suspend.policy")).append(" : "); if (DebuggerSettings.SUSPEND_NONE.equals(getSuspendPolicy()) || !isSuspend()) { buf.append(DebuggerBundle.message("breakpoint.properties.panel.option.suspend.none")); } else if (DebuggerSettings.SUSPEND_ALL.equals(getSuspendPolicy())) { buf.append(DebuggerBundle.message("breakpoint.properties.panel.option.suspend.all")); } else if (DebuggerSettings.SUSPEND_THREAD.equals(getSuspendPolicy())) { buf.append(DebuggerBundle.message("breakpoint.properties.panel.option.suspend.thread")); } buf.append(" <br> "); buf.append(DebuggerBundle.message("breakpoint.property.name.log.message")).append(": "); buf.append(isLogEnabled() ? CommonBundle.getYesButtonText() : CommonBundle.getNoButtonText()); if (isLogExpressionEnabled()) { buf.append(" <br> "); buf.append(DebuggerBundle.message("breakpoint.property.name.log.expression")).append(": "); buf.append(XmlStringUtil.escapeString(getLogMessage().getText())); } if (isConditionEnabled() && getCondition() != null && getCondition().getText() != null && !getCondition().getText().isEmpty()) { buf.append(" <br> "); buf.append(DebuggerBundle.message("breakpoint.property.name.condition")).append(": "); buf.append(XmlStringUtil.escapeString(getCondition().getText())); } if (isCountFilterEnabled()) { buf.append(" <br> "); buf.append(DebuggerBundle.message("breakpoint.property.name.pass.count")).append(": "); buf.append(getCountFilter()); } if (isClassFiltersEnabled()) { buf.append(" <br> "); buf.append(DebuggerBundle.message("breakpoint.property.name.class.filters")).append(": "); ClassFilter[] classFilters = getClassFilters(); for (ClassFilter classFilter : classFilters) { buf.append(classFilter.getPattern()).append(" "); } } if (isInstanceFiltersEnabled()) { buf.append(" <br> "); buf.append(DebuggerBundle.message("breakpoint.property.name.instance.filters")); InstanceFilter[] instanceFilters = getInstanceFilters(); for (InstanceFilter instanceFilter : instanceFilters) { buf.append(Long.toString(instanceFilter.getId())).append(" "); } } buf.append("</body></html>"); return buf.toString(); } finally { StringBuilderSpinAllocator.dispose(buf); } }
private void runAction(final EvaluationContextImpl context, LocatableEvent event) { if (LOG_ENABLED || LOG_EXPRESSION_ENABLED) { final StringBuilder buf = StringBuilderSpinAllocator.alloc(); try { if (LOG_ENABLED) { buf.append(getEventMessage(event)); buf.append("\n"); } final DebugProcessImpl debugProcess = context.getDebugProcess(); final TextWithImports expressionToEvaluate = getLogMessage(); if (LOG_EXPRESSION_ENABLED && expressionToEvaluate != null && !"".equals(expressionToEvaluate.getText())) { if (!debugProcess.isAttached()) { return; } try { ExpressionEvaluator evaluator = DebuggerInvocationUtil.commitAndRunReadAction( getProject(), new EvaluatingComputable<ExpressionEvaluator>() { public ExpressionEvaluator compute() throws EvaluateException { return EvaluatorBuilderImpl.build( expressionToEvaluate, ContextUtil.getContextElement(context), ContextUtil.getSourcePosition(context)); } }); final Value eval = evaluator.evaluate(context); final String result = eval instanceof VoidValue ? "void" : DebuggerUtils.getValueAsString(context, eval); buf.append(result); } catch (EvaluateException e) { buf.append(DebuggerBundle.message("error.unable.to.evaluate.expression")); buf.append(" \""); buf.append(expressionToEvaluate); buf.append("\""); buf.append(" : "); buf.append(e.getMessage()); } buf.append("\n"); } if (buf.length() > 0) { debugProcess.printToConsole(buf.toString()); } } finally { StringBuilderSpinAllocator.dispose(buf); } } }