use of com.intellij.xdebugger.impl.breakpoints.XExpressionImpl in project intellij-community by JetBrains.
the class XDebuggerHistoryManager method addRecentExpression.
public boolean addRecentExpression(@NotNull @NonNls String id, @Nullable XExpression expression) {
if (XDebuggerUtilImpl.isEmptyExpression(expression)) {
return false;
}
LinkedList<XExpression> list = myRecentExpressions.computeIfAbsent(id, k -> new LinkedList<>());
if (list.size() == MAX_RECENT_EXPRESSIONS) {
list.removeLast();
}
XExpression trimmedExpression = new XExpressionImpl(expression.getExpression().trim(), expression.getLanguage(), expression.getCustomInfo(), expression.getMode());
list.remove(trimmedExpression);
list.addFirst(trimmedExpression);
return true;
}
use of com.intellij.xdebugger.impl.breakpoints.XExpressionImpl in project intellij-community by JetBrains.
the class XDebuggerEditorBase method setExpression.
public void setExpression(@Nullable XExpression text) {
if (text == null) {
text = getMode() == EvaluationMode.EXPRESSION ? XExpressionImpl.EMPTY_EXPRESSION : XExpressionImpl.EMPTY_CODE_FRAGMENT;
}
Language language = text.getLanguage();
if (language == null) {
if (myContext != null) {
language = myContext.getLanguage();
}
if (language == null && mySourcePosition != null) {
language = LanguageUtil.getFileLanguage(mySourcePosition.getFile());
}
if (language == null) {
language = LanguageUtil.getFileTypeLanguage(getEditorsProvider().getFileType());
}
text = new XExpressionImpl(text.getExpression(), language, text.getCustomInfo(), text.getMode());
}
Collection<Language> languages = getSupportedLanguages();
boolean many = languages.size() > 1;
if (language != null) {
myChooseFactory.setVisible(many);
}
myChooseFactory.setVisible(myChooseFactory.isVisible() || many);
if (language != null && language.getAssociatedFileType() != null) {
LayeredIcon icon = JBUI.scale(new LayeredIcon(2));
icon.setIcon(language.getAssociatedFileType().getIcon(), 0);
icon.setIcon(AllIcons.General.Dropdown, 1, 3, 0);
myChooseFactory.setIcon(icon);
myChooseFactory.setDisabledIcon(IconLoader.getDisabledIcon(icon));
}
doSetText(text);
}
Aggregations