| 87 | int imageW, imageH; |
| 88 | |
| 89 | public class Actions { |
| 90 | public final Action newTab = new SimpleAction(tr("New Tab"), |
| 91 | Keys.ctrlShift(KeyEvent.VK_N), |
| 92 | () -> editor.getSketchController().handleNewCode()); |
| 93 | |
| 94 | public final Action renameTab = new SimpleAction(tr("Rename"), |
| 95 | () -> editor.getSketchController().handleRenameCode()); |
| 96 | |
| 97 | public final Action deleteTab = new SimpleAction(tr("Delete"), () -> { |
| 98 | try { |
| 99 | editor.getSketchController().handleDeleteCode(); |
| 100 | } catch (IOException e) { |
| 101 | e.printStackTrace(); |
| 102 | } |
| 103 | }); |
| 104 | |
| 105 | public final Action prevTab = new SimpleAction(tr("Previous Tab"), |
| 106 | Keys.ctrlAlt(KeyEvent.VK_LEFT), () -> editor.selectPrevTab()); |
| 107 | |
| 108 | public final Action nextTab = new SimpleAction(tr("Next Tab"), |
| 109 | Keys.ctrlAlt(KeyEvent.VK_RIGHT), () -> editor.selectNextTab()); |
| 110 | |
| 111 | Actions() { |
| 112 | // Explicitly bind keybindings for the actions with accelerators above |
| 113 | // Normally, this happens automatically for any actions bound to menu |
| 114 | // items, but only for menus attached to a window, not for popup menus. |
| 115 | Keys.bind(EditorHeader.this, newTab); |
| 116 | Keys.bind(EditorHeader.this, prevTab); |
| 117 | Keys.bind(EditorHeader.this, nextTab); |
| 118 | |
| 119 | // Add alternative keybindings to switch tabs |
| 120 | Keys.bind(EditorHeader.this, prevTab, Keys.ctrlShift(KeyEvent.VK_TAB)); |
| 121 | Keys.bind(EditorHeader.this, nextTab, Keys.ctrl(KeyEvent.VK_TAB)); |
| 122 | } |
| 123 | } |
| 124 | public Actions actions = new Actions(); |
| 125 | |
| 126 | /** |
nothing calls this directly
no test coverage detected