Search in sources :

Example 6 with XExpression

use of com.intellij.xdebugger.XExpression in project intellij-community by JetBrains.

the class ExpressionInputComponent method showHistory.

private void showHistory() {
    List<XExpression> expressions = myExpressionEditor.getRecentExpressions();
    if (!expressions.isEmpty()) {
        ListPopupImpl popup = new ListPopupImpl(new BaseListPopupStep<XExpression>(null, expressions) {

            @Override
            public PopupStep onChosen(XExpression selectedValue, boolean finalChoice) {
                myExpressionEditor.setExpression(selectedValue);
                myExpressionEditor.requestFocusInEditor();
                return FINAL_CHOICE;
            }
        }) {

            @Override
            protected ListCellRenderer getListElementRenderer() {
                return new ColoredListCellRenderer<XExpression>() {

                    @Override
                    protected void customizeCellRenderer(@NotNull JList list, XExpression value, int index, boolean selected, boolean hasFocus) {
                        append(value.getExpression());
                    }
                };
            }
        };
        popup.getList().setFont(EditorUtil.getEditorFont());
        popup.showUnderneathOf(myExpressionEditor.getEditorComponent());
    }
}
Also used : ListPopupImpl(com.intellij.ui.popup.list.ListPopupImpl) XExpression(com.intellij.xdebugger.XExpression) ColoredListCellRenderer(com.intellij.ui.ColoredListCellRenderer) NotNull(org.jetbrains.annotations.NotNull) BaseListPopupStep(com.intellij.openapi.ui.popup.util.BaseListPopupStep) PopupStep(com.intellij.openapi.ui.popup.PopupStep)

Example 7 with XExpression

use of com.intellij.xdebugger.XExpression in project intellij-community by JetBrains.

the class XValue method calculateEvaluationExpression.

/**
   * Asynchronously calculates expression which evaluates to the current value
   */
@NotNull
public Promise<XExpression> calculateEvaluationExpression() {
    String expression = getEvaluationExpression();
    XExpression res = expression != null ? XDebuggerUtil.getInstance().createExpression(expression, null, null, EvaluationMode.EXPRESSION) : null;
    return Promise.resolve(res);
}
Also used : XExpression(com.intellij.xdebugger.XExpression) NotNull(org.jetbrains.annotations.NotNull)

Example 8 with XExpression

use of com.intellij.xdebugger.XExpression in project intellij-community by JetBrains.

the class XDebuggerEditorBase method createLanguagePopup.

private ListPopup createLanguagePopup() {
    DefaultActionGroup actions = new DefaultActionGroup();
    for (Language language : getSupportedLanguages()) {
        //noinspection ConstantConditions
        actions.add(new AnAction(language.getDisplayName(), null, language.getAssociatedFileType().getIcon()) {

            @Override
            public void actionPerformed(@NotNull AnActionEvent e) {
                XExpression currentExpression = getExpression();
                setExpression(new XExpressionImpl(currentExpression.getExpression(), language, currentExpression.getCustomInfo()));
                requestFocusInEditor();
            }
        });
    }
    DataContext dataContext = DataManager.getInstance().getDataContext(getComponent());
    return JBPopupFactory.getInstance().createActionGroupPopup("Choose Language", actions, dataContext, JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, false);
}
Also used : DataContext(com.intellij.openapi.actionSystem.DataContext) Language(com.intellij.lang.Language) XExpressionImpl(com.intellij.xdebugger.impl.breakpoints.XExpressionImpl) XExpression(com.intellij.xdebugger.XExpression) AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) AnAction(com.intellij.openapi.actionSystem.AnAction)

Example 9 with XExpression

use of com.intellij.xdebugger.XExpression in project intellij-community by JetBrains.

the class ExpressionEditorWithHistory method showHistory.

private void showHistory() {
    List<XExpression> expressions = getRecentExpressions();
    if (!expressions.isEmpty()) {
        ListPopupImpl historyPopup = new ListPopupImpl(new BaseListPopupStep<XExpression>(null, expressions) {

            @Override
            public PopupStep onChosen(XExpression selectedValue, boolean finalChoice) {
                setExpression(selectedValue);
                requestFocusInEditor();
                return FINAL_CHOICE;
            }
        }) {

            @Override
            protected ListCellRenderer getListElementRenderer() {
                return new ColoredListCellRenderer<XExpression>() {

                    @Override
                    protected void customizeCellRenderer(@NotNull JList list, XExpression value, int index, boolean selected, boolean hasFocus) {
                        append(value.getExpression(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
                    }
                };
            }
        };
        historyPopup.getList().setFont(EditorUtil.getEditorFont());
        historyPopup.showUnderneathOf(getEditorComponent());
    }
}
Also used : ListPopupImpl(com.intellij.ui.popup.list.ListPopupImpl) XExpression(com.intellij.xdebugger.XExpression) ColoredListCellRenderer(com.intellij.ui.ColoredListCellRenderer) NotNull(org.jetbrains.annotations.NotNull) BaseListPopupStep(com.intellij.openapi.ui.popup.util.BaseListPopupStep) PopupStep(com.intellij.openapi.ui.popup.PopupStep)

Example 10 with XExpression

use of com.intellij.xdebugger.XExpression in project intellij-community by JetBrains.

the class WatchInplaceEditor method doOKAction.

@Override
public void doOKAction() {
    XExpression expression = getExpression();
    super.doOKAction();
    int index = myRootNode.removeChildNode(myNode);
    if (!XDebuggerUtilImpl.isEmptyExpression(expression) && index != -1) {
        myWatchesView.addWatchExpression(expression, index, false);
    }
    TreeUtil.selectNode(myTree, myNode);
}
Also used : XExpression(com.intellij.xdebugger.XExpression)

Aggregations

XExpression (com.intellij.xdebugger.XExpression)15 NotNull (org.jetbrains.annotations.NotNull)5 XExpressionImpl (com.intellij.xdebugger.impl.breakpoints.XExpressionImpl)3 PopupStep (com.intellij.openapi.ui.popup.PopupStep)2 BaseListPopupStep (com.intellij.openapi.ui.popup.util.BaseListPopupStep)2 ColoredListCellRenderer (com.intellij.ui.ColoredListCellRenderer)2 ListPopupImpl (com.intellij.ui.popup.list.ListPopupImpl)2 XDebugSession (com.intellij.xdebugger.XDebugSession)2 XLineBreakpoint (com.intellij.xdebugger.breakpoints.XLineBreakpoint)2 XBreakpointCustomPropertiesPanel (com.intellij.xdebugger.breakpoints.ui.XBreakpointCustomPropertiesPanel)2 XDebugSessionImpl (com.intellij.xdebugger.impl.XDebugSessionImpl)2 EvaluateException (com.intellij.debugger.engine.evaluation.EvaluateException)1 TextWithImportsImpl (com.intellij.debugger.engine.evaluation.TextWithImportsImpl)1 SuspendContextCommandImpl (com.intellij.debugger.engine.events.SuspendContextCommandImpl)1 Language (com.intellij.lang.Language)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 Editor (com.intellij.openapi.editor.Editor)1