use of com.intellij.xdebugger.XExpression in project intellij-community by JetBrains.
the class JavaValue method calculateEvaluationExpression.
@NotNull
@Override
public Promise<XExpression> calculateEvaluationExpression() {
if (evaluationExpression != null) {
return Promise.resolve(evaluationExpression);
} else {
final AsyncPromise<XExpression> res = new AsyncPromise<>();
myEvaluationContext.getManagerThread().schedule(new SuspendContextCommandImpl(myEvaluationContext.getSuspendContext()) {
@Override
public Priority getPriority() {
return Priority.HIGH;
}
@Override
public void contextAction() throws Exception {
evaluationExpression = ApplicationManager.getApplication().runReadAction(new Computable<XExpression>() {
@Override
public XExpression compute() {
try {
PsiElement psiExpression = getDescriptor().getTreeEvaluation(JavaValue.this, getDebuggerContext());
if (psiExpression != null) {
XExpression res = TextWithImportsImpl.toXExpression(new TextWithImportsImpl(psiExpression));
// add runtime imports if any
Set<String> imports = psiExpression.getUserData(DebuggerTreeNodeExpression.ADDITIONAL_IMPORTS_KEY);
if (imports != null && res != null) {
if (res.getCustomInfo() != null) {
imports.add(res.getCustomInfo());
}
res = new XExpressionImpl(res.getExpression(), res.getLanguage(), StringUtil.join(imports, ","), res.getMode());
}
return res;
}
} catch (EvaluateException e) {
LOG.info(e);
}
return null;
}
});
res.setResult(evaluationExpression);
}
});
return res;
}
}
use of com.intellij.xdebugger.XExpression in project intellij-community by JetBrains.
the class DebuggerUtilsImpl method writeTextWithImports.
@Override
public void writeTextWithImports(Element root, String name, TextWithImports value) {
if (value.getKind() == CodeFragmentKind.EXPRESSION) {
JDOMExternalizerUtil.writeField(root, name, value.toExternalForm());
} else {
Element element = JDOMExternalizerUtil.writeOption(root, name);
XExpression expression = TextWithImportsImpl.toXExpression(value);
if (expression != null) {
XmlSerializer.serializeInto(new XExpressionState(expression), element, new SkipDefaultValuesSerializationFilters());
}
}
}
use of com.intellij.xdebugger.XExpression in project intellij-community by JetBrains.
the class XBreakpointActionsPanel method saveProperties.
@Override
void saveProperties() {
myBreakpoint.setLogMessage(myLogMessageCheckBox.isSelected());
if (myBreakpoint instanceof XLineBreakpoint) {
((XLineBreakpoint) myBreakpoint).setTemporary(myTemporaryCheckBox.isSelected());
}
if (myLogExpressionComboBox != null) {
XExpression expression = myLogExpressionComboBox.getExpression();
XExpression logExpression = !XDebuggerUtilImpl.isEmptyExpression(expression) ? expression : null;
myBreakpoint.setLogExpressionEnabled(logExpression == null || myLogExpressionCheckBox.isSelected());
myBreakpoint.setLogExpressionObject(logExpression);
myLogExpressionComboBox.saveTextInHistory();
}
}
use of com.intellij.xdebugger.XExpression in project intellij-community by JetBrains.
the class XBreakpointActionsPanel method loadProperties.
@Override
void loadProperties() {
myLogMessageCheckBox.setSelected(myBreakpoint.isLogMessage());
if (myBreakpoint instanceof XLineBreakpoint) {
myTemporaryCheckBox.setSelected(((XLineBreakpoint) myBreakpoint).isTemporary());
}
if (myLogExpressionComboBox != null) {
XExpression logExpression = myBreakpoint.getLogExpressionObjectInt();
myLogExpressionComboBox.setExpression(logExpression);
myLogExpressionCheckBox.setSelected(myBreakpoint.isLogExpressionEnabled() && logExpression != null);
}
onCheckboxChanged();
}
use of com.intellij.xdebugger.XExpression in project intellij-community by JetBrains.
the class XLightBreakpointPropertiesPanel method loadProperties.
public void loadProperties() {
mySubPanels.forEach(XBreakpointPropertiesSubPanel::loadProperties);
if (myConditionComboBox != null) {
XExpression condition = myBreakpoint.getConditionExpressionInt();
myConditionComboBox.setExpression(condition);
boolean hideCheckbox = !myShowAllOptions && condition == null;
myConditionEnabledCheckbox.setSelected(hideCheckbox || (myBreakpoint.isConditionEnabled() && condition != null));
myConditionEnabledPanel.removeAll();
if (hideCheckbox) {
JBLabel label = new JBLabel(XDebuggerBundle.message("xbreakpoints.condition.checkbox"));
label.setBorder(JBUI.Borders.empty(0, 4));
label.setLabelFor(myConditionComboBox.getComboBox());
myConditionEnabledPanel.add(label);
} else {
myConditionEnabledPanel.add(myConditionEnabledCheckbox);
}
onCheckboxChanged();
}
for (XBreakpointCustomPropertiesPanel customPanel : myCustomPanels) {
customPanel.loadFrom(myBreakpoint);
}
myEnabledCheckbox.setSelected(myBreakpoint.isEnabled());
myBreakpointNameLabel.setText(XBreakpointUtil.getShortText(myBreakpoint));
}
Aggregations