Search in sources :

Example 6 with XExpressionImpl

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;
}
Also used : XExpressionImpl(com.intellij.xdebugger.impl.breakpoints.XExpressionImpl) XExpression(com.intellij.xdebugger.XExpression)

Example 7 with XExpressionImpl

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);
}
Also used : LayeredIcon(com.intellij.ui.LayeredIcon) Language(com.intellij.lang.Language) XExpressionImpl(com.intellij.xdebugger.impl.breakpoints.XExpressionImpl)

Aggregations

XExpressionImpl (com.intellij.xdebugger.impl.breakpoints.XExpressionImpl)7 Language (com.intellij.lang.Language)3 XExpression (com.intellij.xdebugger.XExpression)3 EvaluateException (com.intellij.debugger.engine.evaluation.EvaluateException)1 TextWithImportsImpl (com.intellij.debugger.engine.evaluation.TextWithImportsImpl)1 UnsupportedExpressionException (com.intellij.debugger.engine.evaluation.expression.UnsupportedExpressionException)1 SuspendContextCommandImpl (com.intellij.debugger.engine.events.SuspendContextCommandImpl)1 AnAction (com.intellij.openapi.actionSystem.AnAction)1 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)1 DataContext (com.intellij.openapi.actionSystem.DataContext)1 DefaultActionGroup (com.intellij.openapi.actionSystem.DefaultActionGroup)1 InvalidDataException (com.intellij.openapi.util.InvalidDataException)1 PsiElement (com.intellij.psi.PsiElement)1 LayeredIcon (com.intellij.ui.LayeredIcon)1 XSourcePosition (com.intellij.xdebugger.XSourcePosition)1 XBreakpointBase (com.intellij.xdebugger.impl.breakpoints.XBreakpointBase)1 XDebuggerEvaluationDialog (com.intellij.xdebugger.impl.evaluate.XDebuggerEvaluationDialog)1 Set (java.util.Set)1 NotNull (org.jetbrains.annotations.NotNull)1 AsyncPromise (org.jetbrains.concurrency.AsyncPromise)1