use of com.intellij.xdebugger.impl.ui.tree.nodes.XEvaluationCallbackBase in project intellij-community by JetBrains.
the class XValueHint method evaluateAndShowHint.
@Override
protected void evaluateAndShowHint() {
myEvaluator.evaluate(myExpression, new XEvaluationCallbackBase() {
@Override
public void evaluated(@NotNull final XValue result) {
result.computePresentation(new XValueNodePresentationConfigurator.ConfigurableXValueNodeImpl() {
private XFullValueEvaluator myFullValueEvaluator;
private boolean myShown = false;
@Override
public void applyPresentation(@Nullable Icon icon, @NotNull XValuePresentation valuePresenter, boolean hasChildren) {
if (isHintHidden()) {
return;
}
SimpleColoredText text = new SimpleColoredText();
text.append(StringUtil.trimMiddle(myValueName, 200), XDebuggerUIConstants.VALUE_NAME_ATTRIBUTES);
XValueNodeImpl.buildText(valuePresenter, text);
if (!hasChildren) {
SimpleColoredComponent component = HintUtil.createInformationComponent();
text.appendToComponent(component);
if (myFullValueEvaluator != null) {
component.append(myFullValueEvaluator.getLinkText(), XDebuggerTreeNodeHyperlink.TEXT_ATTRIBUTES, (Consumer<MouseEvent>) event -> DebuggerUIUtil.showValuePopup(myFullValueEvaluator, event, getProject(), getEditor()));
LinkMouseListenerBase.installSingleTagOn(component);
}
showHint(component);
} else if (getType() == ValueHintType.MOUSE_CLICK_HINT) {
if (!myShown) {
showTree(result);
}
} else {
if (getType() == ValueHintType.MOUSE_OVER_HINT) {
text.insert(0, "(" + KeymapUtil.getFirstKeyboardShortcutText("ShowErrorDescription") + ") ", SimpleTextAttributes.GRAYED_ATTRIBUTES);
}
JComponent component = createExpandableHintComponent(text, () -> showTree(result));
showHint(component);
}
myShown = true;
}
@Override
public void setFullValueEvaluator(@NotNull XFullValueEvaluator fullValueEvaluator) {
myFullValueEvaluator = fullValueEvaluator;
}
@Override
public boolean isObsolete() {
return isHintHidden();
}
}, XValuePlace.TOOLTIP);
}
@Override
public void errorOccurred(@NotNull final String errorMessage) {
if (getType() == ValueHintType.MOUSE_CLICK_HINT) {
ApplicationManager.getApplication().invokeLater(() -> showHint(HintUtil.createErrorLabel(errorMessage)));
}
LOG.debug("Cannot evaluate '" + myExpression + "':" + errorMessage);
}
}, myExpressionPosition);
}
Aggregations