mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
use meta+shift+enter to add to watches on mac
This commit is contained in:
@@ -70,7 +70,7 @@ xdebugger.button.evaluate=E&valuate
|
||||
xdebugger.evaluate.dialog.close=Close
|
||||
xdebugger.dialog.title.evaluate.expression=Evaluate Expression
|
||||
xdebugger.evaluate.label.expression=Expression:
|
||||
xdebugger.evaluate.addtowatches.hint=Use Control+Shift+Enter to add to Watches
|
||||
xdebugger.evaluate.addtowatches.hint=Use {0} to add to Watches
|
||||
dialog.title.evaluate.code.fragment=Evaluate Code Fragment
|
||||
button.text.code.fragment.mode=Code Fragment &Mode
|
||||
button.text.expression.mode=Expression &Mode
|
||||
|
||||
+4
-1
@@ -22,6 +22,7 @@ import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CustomShortcutSet;
|
||||
import com.intellij.openapi.editor.ex.util.EditorUtil;
|
||||
import com.intellij.openapi.keymap.KeymapUtil;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.FixedSizeButton;
|
||||
import com.intellij.openapi.ui.popup.PopupStep;
|
||||
@@ -72,7 +73,9 @@ public class ExpressionInputComponent extends EvaluationInputComponent {
|
||||
}
|
||||
});
|
||||
myMainPanel.add(historyButton, BorderLayout.EAST);
|
||||
final JBLabel help = new JBLabel(XDebuggerBundle.message("xdebugger.evaluate.addtowatches.hint"), SwingConstants.RIGHT);
|
||||
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);
|
||||
|
||||
+7
-2
@@ -22,6 +22,7 @@ import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.openapi.wm.WindowManager;
|
||||
@@ -58,6 +59,10 @@ import java.awt.event.KeyEvent;
|
||||
public class XDebuggerEvaluationDialog extends DialogWrapper {
|
||||
public static final DataKey<XDebuggerEvaluationDialog> KEY = DataKey.create("DEBUGGER_EVALUATION_DIALOG");
|
||||
|
||||
//can not use new SHIFT_DOWN_MASK etc because in this case ActionEvent modifiers do not match
|
||||
private static final int ADD_WATCH_MODIFIERS = (SystemInfo.isMac ? InputEvent.META_MASK : InputEvent.CTRL_MASK) | InputEvent.SHIFT_MASK;
|
||||
static KeyStroke ADD_WATCH_KEYSTROKE = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, ADD_WATCH_MODIFIERS);
|
||||
|
||||
private final JPanel myMainPanel;
|
||||
private final JPanel myResultPanel;
|
||||
private final XDebuggerTreePanel myTreePanel;
|
||||
@@ -120,7 +125,7 @@ public class XDebuggerEvaluationDialog extends DialogWrapper {
|
||||
doOKAction();
|
||||
addToWatches();
|
||||
}
|
||||
}.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK)), getRootPane(), myDisposable);
|
||||
}.registerCustomShortcutSet(new CustomShortcutSet(ADD_WATCH_KEYSTROKE), getRootPane(), myDisposable);
|
||||
|
||||
new AnAction() {
|
||||
@Override
|
||||
@@ -171,7 +176,7 @@ public class XDebuggerEvaluationDialog extends DialogWrapper {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
super.actionPerformed(e);
|
||||
if ((e.getModifiers() & (InputEvent.SHIFT_MASK | InputEvent.CTRL_MASK)) == (InputEvent.SHIFT_MASK | InputEvent.CTRL_MASK)) {
|
||||
if ((e.getModifiers() & ADD_WATCH_MODIFIERS) == ADD_WATCH_MODIFIERS) {
|
||||
addToWatches();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user