(Editor eddie)
| 89 | |
| 90 | |
| 91 | public EditorHeader(Editor eddie) { |
| 92 | this.editor = eddie; |
| 93 | |
| 94 | updateTheme(); |
| 95 | |
| 96 | addMouseListener(new MouseAdapter() { |
| 97 | public void mousePressed(MouseEvent e) { |
| 98 | int x = e.getX(); |
| 99 | int y = e.getY(); |
| 100 | |
| 101 | if ((x > menuLeft) && (x < menuRight)) { |
| 102 | popup.show(EditorHeader.this, x, y); |
| 103 | } else { |
| 104 | Sketch sketch = editor.getSketch(); |
| 105 | for (Tab tab : tabs) { |
| 106 | if (tab.contains(x)) { |
| 107 | sketch.setCurrentCode(tab.index); |
| 108 | repaint(); |
| 109 | } |
| 110 | } |
| 111 | } |
| 112 | } |
| 113 | |
| 114 | public void mouseExited(MouseEvent e) { |
| 115 | // only clear if it's been set |
| 116 | if (lastNoticeName != null) { |
| 117 | // only clear if it's the same as what we set it to |
| 118 | editor.clearNotice(lastNoticeName); |
| 119 | lastNoticeName = null; |
| 120 | } |
| 121 | } |
| 122 | }); |
| 123 | |
| 124 | addMouseMotionListener(new MouseMotionAdapter() { |
| 125 | public void mouseMoved(MouseEvent e) { |
| 126 | int x = e.getX(); |
| 127 | for (Tab tab : tabs) { |
| 128 | if (tab.contains(x) && !tab.textVisible) { |
| 129 | lastNoticeName = editor.getSketch().getCode(tab.index).getPrettyName(); |
| 130 | editor.statusNotice(lastNoticeName); |
| 131 | } |
| 132 | } |
| 133 | } |
| 134 | }); |
| 135 | } |
| 136 | |
| 137 | |
| 138 | public void updateTheme() { |
nothing calls this directly
no test coverage detected