IDEA-155291 Debugger customize data view show expression as "undefined" appcode/146.1541 clion/146.1540
authorEgor.Ushakov <egor.ushakov@jetbrains.com>
Wed, 27 Apr 2016 17:24:06 +0000 (20:24 +0300)
committerEgor.Ushakov <egor.ushakov@jetbrains.com>
Wed, 27 Apr 2016 17:25:50 +0000 (20:25 +0300)
java/debugger/impl/src/com/intellij/debugger/settings/CompoundRendererConfigurable.java

index 0b3adea0fb8210b97ed92db7176964a71b91713a..7b69683582691f167ec14de50c805a6968ba6e37 100644 (file)
@@ -225,9 +225,9 @@ class CompoundRendererConfigurable extends JPanel {
     final MyTableModel tableModel = new MyTableModel();
     myTable = new JBTable(tableModel);
     myListChildrenEditor = new XDebuggerExpressionEditor(myProject, editorsProvider, "NamedChildrenConfigurable", null, XExpressionImpl.EMPTY_EXPRESSION, false, false, false);
+    JComponent editorComponent = myListChildrenEditor.getComponent();
 
-    final TableColumn exprColumn = myTable.getColumnModel().getColumn(EXPRESSION_TABLE_COLUMN);
-    exprColumn.setCellEditor(new AbstractTableCellEditor() {
+    AbstractTableCellEditor editor = new AbstractTableCellEditor() {
       @Override
       public Object getCellEditorValue() {
         return TextWithImportsImpl.fromXExpression(myListChildrenEditor.getExpression());
@@ -236,9 +236,16 @@ class CompoundRendererConfigurable extends JPanel {
       @Override
       public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
         myListChildrenEditor.setExpression(TextWithImportsImpl.toXExpression((TextWithImports)value));
-        return myListChildrenEditor.getComponent();
+        return editorComponent;
       }
-    });
+    };
+    editorComponent.registerKeyboardAction(e -> editor.stopCellEditing(), KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),
+                           JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
+    editorComponent.registerKeyboardAction(e -> editor.cancelCellEditing(), KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
+                           JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
+
+    TableColumn exprColumn = myTable.getColumnModel().getColumn(EXPRESSION_TABLE_COLUMN);
+    exprColumn.setCellEditor(editor);
     exprColumn.setCellRenderer(new DefaultTableCellRenderer() {
       @NotNull
       @Override