Java Code Examples for com.intellij.xdebugger.evaluation.EvaluationMode#EXPRESSION
The following examples show how to use
com.intellij.xdebugger.evaluation.EvaluationMode#EXPRESSION .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XDebuggerEvaluationDialog.java From consulo with Apache License 2.0 | 6 votes |
private void switchToMode(EvaluationMode mode, XExpression text) { if (myMode == mode) return; myMode = mode; if (mode == EvaluationMode.EXPRESSION) { text = new XExpressionImpl(StringUtil.convertLineSeparators(text.getExpression(), " "), text.getLanguage(), text.getCustomInfo()); } myInputComponent = createInputComponent(mode, text); myMainPanel.removeAll(); myInputComponent.addComponent(myMainPanel, myResultPanel); setTitle(myInputComponent.getTitle()); mySwitchModeAction.putValue(Action.NAME, getSwitchButtonText(mode)); getInputEditor().requestFocusInEditor(); }
Example 2
Source File: XDebuggerEvaluationDialog.java From consulo with Apache License 2.0 | 5 votes |
private void addToWatches() { if (myMode == EvaluationMode.EXPRESSION) { XExpression expression = getInputEditor().getExpression(); if (!XDebuggerUtilImpl.isEmptyExpression(expression)) { XDebugSessionTab tab = ((XDebugSessionImpl)mySession).getSessionTab(); if (tab != null) { tab.getWatchesView().addWatchExpression(expression, -1, true); getInputEditor().requestFocusInEditor(); } } } }
Example 3
Source File: XDebuggerEvaluationDialog.java From consulo with Apache License 2.0 | 5 votes |
private EvaluationInputComponent createInputComponent(EvaluationMode mode, XExpression text) { final Project project = mySession.getProject(); text = XExpressionImpl.changeMode(text, mode); if (mode == EvaluationMode.EXPRESSION) { return new ExpressionInputComponent(project, myEditorsProvider, mySourcePosition, text, myDisposable); } else { return new CodeFragmentInputComponent(project, myEditorsProvider, mySourcePosition, text, getDimensionServiceKey() + ".splitter", myDisposable); } }
Example 4
Source File: XDebuggerEvaluationDialog.java From consulo with Apache License 2.0 | 5 votes |
@Override public void actionPerformed(ActionEvent e) { XExpression text = getInputEditor().getExpression(); EvaluationMode newMode = (myMode == EvaluationMode.EXPRESSION) ? EvaluationMode.CODE_FRAGMENT : EvaluationMode.EXPRESSION; // remember only on user selection XDebuggerSettingManagerImpl.getInstanceImpl().getGeneralSettings().setEvaluationDialogMode(newMode); switchToMode(newMode, text); }
Example 5
Source File: XDebuggerExpressionEditor.java From consulo with Apache License 2.0 | 5 votes |
public XDebuggerExpressionEditor(Project project, @Nonnull XDebuggerEditorsProvider debuggerEditorsProvider, @Nullable @NonNls String historyId, @Nullable XSourcePosition sourcePosition, @Nonnull XExpression text, final boolean multiline, boolean editorFont, boolean showEditor) { super(project, debuggerEditorsProvider, multiline ? EvaluationMode.CODE_FRAGMENT : EvaluationMode.EXPRESSION, historyId, sourcePosition); myExpression = XExpressionImpl.changeMode(text, getMode()); myEditorTextField = new EditorTextField(createDocument(myExpression), project, debuggerEditorsProvider.getFileType(), false, !multiline) { @Override protected EditorEx createEditor() { final EditorEx editor = super.createEditor(); editor.setVerticalScrollbarVisible(multiline); editor.getColorsScheme().setEditorFontName(getFont().getFontName()); editor.getColorsScheme().setEditorFontSize(getFont().getSize()); return editor; } @Override public Object getData(@Nonnull Key dataId) { if (LangDataKeys.CONTEXT_LANGUAGES == dataId) { return new Language[]{myExpression.getLanguage()}; } else if (CommonDataKeys.PSI_FILE == dataId) { return PsiDocumentManager.getInstance(getProject()).getPsiFile(getDocument()); } return super.getData(dataId); } }; if (editorFont) { myEditorTextField.setFontInheritedFromLAF(false); myEditorTextField.setFont(EditorUtil.getEditorFont()); } myComponent = decorate(myEditorTextField, multiline, showEditor); }
Example 6
Source File: XDebuggerExpressionComboBox.java From consulo with Apache License 2.0 | 5 votes |
public XDebuggerExpressionComboBox(@Nonnull Project project, @Nonnull XDebuggerEditorsProvider debuggerEditorsProvider, @Nullable @NonNls String historyId, @Nullable XSourcePosition sourcePosition, boolean showEditor) { super(project, debuggerEditorsProvider, EvaluationMode.EXPRESSION, historyId, sourcePosition); myComboBox = new ComboBox<>(100); myComboBox.setEditable(true); myExpression = XExpressionImpl.EMPTY_EXPRESSION; Dimension minimumSize = new Dimension(myComboBox.getMinimumSize()); minimumSize.width = 100; myComboBox.setMinimumSize(minimumSize); initEditor(); fillComboBox(); myComponent = showEditor ? addMultilineButton(myComboBox) : myComboBox; }
Example 7
Source File: XDebuggerEditorBase.java From consulo with Apache License 2.0 | 5 votes |
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); //myChooseFactory.setEnabled(many && languages.contains(language)); if (language != null && language.getAssociatedFileType() != null) { Image fileTypeIcon = ImageEffects.layered(language.getAssociatedFileType().getIcon(), AllIcons.General.Dropdown); myChooseFactory.setIcon(TargetAWT.to(fileTypeIcon)); myChooseFactory.setDisabledIcon(TargetAWT.to(ImageEffects.grayed(fileTypeIcon))); } doSetText(text); }
Example 8
Source File: XDebuggerEvaluationDialog.java From consulo with Apache License 2.0 | 4 votes |
private static String getSwitchButtonText(EvaluationMode mode) { return mode != EvaluationMode.EXPRESSION ? XDebuggerBundle.message("button.text.expression.mode") : XDebuggerBundle.message("button.text.code.fragment.mode"); }
Example 9
Source File: XExpressionImpl.java From consulo with Apache License 2.0 | 4 votes |
public XExpressionImpl(@Nonnull String expression, Language language, String customInfo) { this(expression, language, customInfo, EvaluationMode.EXPRESSION); }
Example 10
Source File: XExpressionImpl.java From consulo with Apache License 2.0 | 4 votes |
@Nullable public static XExpressionImpl fromText(@Nullable String text) { return text != null ? new XExpressionImpl(text, null, null, EvaluationMode.EXPRESSION) : null; }