(final Base base, String path, final EditorState state,
final Mode mode)
| 155 | |
| 156 | |
| 157 | protected Editor(final Base base, String path, final EditorState state, |
| 158 | final Mode mode) throws EditorException { |
| 159 | super("Processing", state.getConfig()); |
| 160 | this.base = base; |
| 161 | this.state = state; |
| 162 | this.mode = mode; |
| 163 | |
| 164 | // Make sure Base.getActiveEditor() never returns null |
| 165 | base.checkFirstEditor(this); |
| 166 | |
| 167 | // This is a Processing window. Get rid of that ugly ass coffee cup. |
| 168 | Toolkit.setIcon(this); |
| 169 | |
| 170 | // add listener to handle window close box hit event |
| 171 | addWindowListener(new WindowAdapter() { |
| 172 | public void windowClosing(WindowEvent e) { |
| 173 | base.handleClose(Editor.this, false); |
| 174 | } |
| 175 | }); |
| 176 | // don't close the window when clicked, the app will take care |
| 177 | // of that via the handleQuitInternal() methods |
| 178 | // https://download.processing.org/bugzilla/440.html |
| 179 | setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
| 180 | |
| 181 | // When bringing a window to front, let the Base know |
| 182 | addWindowListener(new WindowAdapter() { |
| 183 | |
| 184 | public void windowActivated(WindowEvent e) { |
| 185 | base.handleActivated(Editor.this); |
| 186 | fileMenu.insert(Recent.getMenu(), 2); |
| 187 | Toolkit.setMenuMnemsInside(fileMenu); |
| 188 | |
| 189 | mode.insertImportMenu(sketchMenu); |
| 190 | Toolkit.setMenuMnemsInside(sketchMenu); |
| 191 | mode.insertToolbarRecentMenu(); |
| 192 | } |
| 193 | |
| 194 | public void windowDeactivated(WindowEvent e) { |
| 195 | // TODO call handleActivated(null)? or do we run the risk of the |
| 196 | // deactivate call for old window being called after the activate? |
| 197 | fileMenu.remove(Recent.getMenu()); |
| 198 | mode.removeImportMenu(sketchMenu); |
| 199 | mode.removeToolbarRecentMenu(); |
| 200 | } |
| 201 | }); |
| 202 | |
| 203 | timer = new Timer(); |
| 204 | |
| 205 | buildMenuBar(); |
| 206 | |
| 207 | JPanel contentPain = new JPanel(); |
| 208 | setContentPane(contentPain); |
| 209 | contentPain.setLayout(new BorderLayout()); |
| 210 | |
| 211 | Box box = Box.createVerticalBox(); |
| 212 | Box upper = Box.createVerticalBox(); |
| 213 | |
| 214 | rebuildModePopup(); |
nothing calls this directly
no test coverage detected