(Base ibase, File file, int[] storedLocation, int[] defaultLocation, Platform platform)
| 239 | private Map<String, Tool> internalToolCache = new HashMap<String, Tool>(); |
| 240 | |
| 241 | public Editor(Base ibase, File file, int[] storedLocation, int[] defaultLocation, Platform platform) throws Exception { |
| 242 | super("Arduino"); |
| 243 | this.base = ibase; |
| 244 | this.platform = platform; |
| 245 | |
| 246 | Base.setIcon(this); |
| 247 | |
| 248 | // Install default actions for Run, Present, etc. |
| 249 | resetHandlers(); |
| 250 | |
| 251 | // add listener to handle window close box hit event |
| 252 | addWindowListener(new WindowAdapter() { |
| 253 | public void windowClosing(WindowEvent e) { |
| 254 | base.handleClose(Editor.this); |
| 255 | } |
| 256 | }); |
| 257 | // don't close the window when clicked, the app will take care |
| 258 | // of that via the handleQuitInternal() methods |
| 259 | // http://dev.processing.org/bugs/show_bug.cgi?id=440 |
| 260 | setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); |
| 261 | |
| 262 | // When bringing a window to front, let the Base know |
| 263 | addWindowListener(new WindowAdapter() { |
| 264 | public void windowActivated(WindowEvent e) { |
| 265 | base.handleActivated(Editor.this); |
| 266 | } |
| 267 | |
| 268 | // added for 1.0.5 |
| 269 | // http://dev.processing.org/bugs/show_bug.cgi?id=1260 |
| 270 | public void windowDeactivated(WindowEvent e) { |
| 271 | List<Component> toolsMenuItemsToRemove = new LinkedList<>(); |
| 272 | for (Component menuItem : toolsMenu.getMenuComponents()) { |
| 273 | if (menuItem instanceof JComponent) { |
| 274 | Object removeOnWindowDeactivation = ((JComponent) menuItem).getClientProperty("removeOnWindowDeactivation"); |
| 275 | if (removeOnWindowDeactivation != null && Boolean.valueOf(removeOnWindowDeactivation.toString())) { |
| 276 | toolsMenuItemsToRemove.add(menuItem); |
| 277 | } |
| 278 | } |
| 279 | } |
| 280 | for (Component menuItem : toolsMenuItemsToRemove) { |
| 281 | toolsMenu.remove(menuItem); |
| 282 | } |
| 283 | toolsMenu.remove(portMenu); |
| 284 | } |
| 285 | }); |
| 286 | |
| 287 | //PdeKeywords keywords = new PdeKeywords(); |
| 288 | //sketchbook = new Sketchbook(this); |
| 289 | |
| 290 | buildMenuBar(); |
| 291 | |
| 292 | // For rev 0120, placing things inside a JPanel |
| 293 | Container contentPain = getContentPane(); |
| 294 | contentPain.setLayout(new BorderLayout()); |
| 295 | JPanel pane = new JPanel(); |
| 296 | pane.setLayout(new BorderLayout()); |
| 297 | contentPain.add(pane, BorderLayout.CENTER); |
| 298 |
nothing calls this directly
no test coverage detected