diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/ExpressionInputComponent.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/ExpressionInputComponent.java index 19692d299253..7ce60e6fa5b0 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/ExpressionInputComponent.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/ExpressionInputComponent.java @@ -32,6 +32,7 @@ import com.intellij.ui.components.JBLabel; import com.intellij.ui.popup.list.ListPopupImpl; import com.intellij.util.ui.JBUI; import com.intellij.util.ui.UIUtil; +import com.intellij.util.ui.components.BorderLayoutPanel; import com.intellij.xdebugger.XDebuggerBundle; import com.intellij.xdebugger.XExpression; import com.intellij.xdebugger.XSourcePosition; @@ -53,7 +54,7 @@ import java.util.List; */ public class ExpressionInputComponent extends EvaluationInputComponent { private final XDebuggerExpressionEditor myExpressionEditor; - private final JPanel myMainPanel = JBUI.Panels.simplePanel(); + private final ExpressionInputForm myMainForm = new ExpressionInputForm(); public ExpressionInputComponent(final @NotNull Project project, @NotNull XDebuggerEditorsProvider editorsProvider, @@ -63,10 +64,16 @@ public class ExpressionInputComponent extends EvaluationInputComponent { @NotNull Disposable parentDisposable, boolean showHelp) { super(XDebuggerBundle.message("xdebugger.dialog.title.evaluate.expression")); + BorderLayoutPanel expressionPanel = JBUI.Panels.simplePanel(); //myMainPanel.add(new JLabel(XDebuggerBundle.message("xdebugger.evaluate.label.expression")), BorderLayout.WEST); myExpressionEditor = new XDebuggerExpressionEditor(project, editorsProvider, historyId, sourcePosition, - expression != null ? expression : XExpressionImpl.EMPTY_EXPRESSION, false, true, false); - myMainPanel.add(myExpressionEditor.getComponent(), BorderLayout.CENTER); + expression != null ? expression : XExpressionImpl.EMPTY_EXPRESSION, false, true, false) { + @Override + protected JComponent decorate(JComponent component, boolean multiline, boolean showEditor) { + return component; + } + }; + expressionPanel.add(myExpressionEditor.getComponent(), BorderLayout.CENTER); JButton historyButton = new FixedSizeButton(myExpressionEditor.getComponent()); historyButton.setIcon(AllIcons.General.MessageHistory); historyButton.setToolTipText(XDebuggerBundle.message("xdebugger.evaluate.history.hint")); @@ -76,14 +83,14 @@ public class ExpressionInputComponent extends EvaluationInputComponent { showHistory(); } }); - myMainPanel.add(historyButton, BorderLayout.EAST); + expressionPanel.add(historyButton, BorderLayout.EAST); final JBLabel help = new JBLabel(XDebuggerBundle.message("xdebugger.evaluate.addtowatches.hint", KeymapUtil.getKeystrokeText(XDebuggerEvaluationDialog.ADD_WATCH_KEYSTROKE)), SwingConstants.RIGHT); help.setBorder(JBUI.Borders.empty(2, 0, 6, 0)); help.setComponentStyle(UIUtil.ComponentStyle.SMALL); help.setFontColor(UIUtil.FontColor.BRIGHTER); - myMainPanel.add(help, BorderLayout.SOUTH); + expressionPanel.add(help, BorderLayout.SOUTH); help.setVisible(showHelp); if (expression != null) { @@ -91,6 +98,9 @@ public class ExpressionInputComponent extends EvaluationInputComponent { } myExpressionEditor.selectAll(); + myMainForm.addExpressionComponent(expressionPanel); + myMainForm.addLanguageComponent(myExpressionEditor.getLanguageChooser()); + new AnAction("XEvaluateDialog.ShowHistory") { @Override public void actionPerformed(AnActionEvent e) { @@ -101,7 +111,7 @@ public class ExpressionInputComponent extends EvaluationInputComponent { public void update(AnActionEvent e) { e.getPresentation().setEnabled(LookupManager.getActiveLookup(myExpressionEditor.getEditor()) == null); } - }.registerCustomShortcutSet(CustomShortcutSet.fromString("DOWN"), myMainPanel, parentDisposable); + }.registerCustomShortcutSet(CustomShortcutSet.fromString("DOWN"), myMainForm.getMainPanel(), parentDisposable); } private void showHistory() { @@ -133,11 +143,11 @@ public class ExpressionInputComponent extends EvaluationInputComponent { @Override public void addComponent(JPanel contentPanel, JPanel resultPanel) { contentPanel.add(resultPanel, BorderLayout.CENTER); - contentPanel.add(myMainPanel, BorderLayout.NORTH); + contentPanel.add(myMainForm.getMainPanel(), BorderLayout.NORTH); } public JPanel getMainComponent() { - return myMainPanel; + return myMainForm.getMainPanel(); } @NotNull diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/ExpressionInputForm.form b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/ExpressionInputForm.form new file mode 100644 index 000000000000..cc0f04292ca9 --- /dev/null +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/ExpressionInputForm.form @@ -0,0 +1,42 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/ExpressionInputForm.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/ExpressionInputForm.java new file mode 100644 index 000000000000..b3f370191ccb --- /dev/null +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/ExpressionInputForm.java @@ -0,0 +1,39 @@ +/* + * Copyright 2000-2017 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.xdebugger.impl.evaluate; + +import javax.swing.*; + +/** + * @author egor + */ +public class ExpressionInputForm { + private JPanel myLanguageChooserPanel; + private JPanel myExpressionPanel; + private JPanel myMainPanel; + + public void addLanguageComponent(JComponent component) { + myLanguageChooserPanel.add(component); + } + + public void addExpressionComponent(JComponent component) { + myExpressionPanel.add(component); + } + + public JPanel getMainPanel() { + return myMainPanel; + } +}