Construct the frame. @param gc graphics configuration used, see javax.swing.JFrame#JFrame(java.awt.GraphicsConfiguration)
(GraphicsConfiguration gc)
| 510 | * see {@link javax.swing.JFrame#JFrame(java.awt.GraphicsConfiguration)} |
| 511 | */ |
| 512 | private MainFrame(GraphicsConfiguration gc) { |
| 513 | super(gc); |
| 514 | |
| 515 | // I thought this should only be needed if the method was called |
| 516 | // from outside the getInstance() method, but if we don't do this |
| 517 | // then the GUI never appears. We probably should figure out why. |
| 518 | instance = this; |
| 519 | |
| 520 | // kick this off here so that it does any resolving of creole metadata |
| 521 | // jars now rather than the first time you try and open the plugin |
| 522 | // manager, which is still a bit slow |
| 523 | PluginUpdateManager.loadDefaultPlugins(); |
| 524 | |
| 525 | // set the WM class |
| 526 | try { |
| 527 | Toolkit xToolkit = Toolkit.getDefaultToolkit(); |
| 528 | java.lang.reflect.Field awtAppClassNameField = |
| 529 | xToolkit.getClass().getDeclaredField("awtAppClassName"); |
| 530 | awtAppClassNameField.setAccessible(true); |
| 531 | awtAppClassNameField.set(xToolkit, "GATE Developer " + Main.version); |
| 532 | } catch(Exception e) { |
| 533 | // this happens every time on Windows and Mac so hide the exception |
| 534 | // unless we are debugging something |
| 535 | log.debug("Could not set WM Class (note that this is normal if you " + |
| 536 | "are not on an X11-based window system)", e); |
| 537 | } |
| 538 | |
| 539 | guiRoots.add(this); |
| 540 | if(fileChooser == null) { |
| 541 | fileChooser = new XJFileChooser(); |
| 542 | fileChooser.setMultiSelectionEnabled(false); |
| 543 | fileChooser.setAcceptAllFileFilterUsed(true); |
| 544 | guiRoots.add(fileChooser); |
| 545 | |
| 546 | // the JFileChooser seems to size itself better once it's been |
| 547 | // added to a top level container such as a dialog. |
| 548 | JDialog dialog = new JDialog(this, "", true); |
| 549 | java.awt.Container contentPane = dialog.getContentPane(); |
| 550 | contentPane.setLayout(new BorderLayout()); |
| 551 | contentPane.add(fileChooser, BorderLayout.CENTER); |
| 552 | dialog.pack(); |
| 553 | dialog.getContentPane().removeAll(); |
| 554 | dialog.dispose(); |
| 555 | dialog = null; |
| 556 | } |
| 557 | |
| 558 | if(resourceReferenceChooser == null) { |
| 559 | resourceReferenceChooser = new ResourceReferenceChooser(); |
| 560 | } |
| 561 | enableEvents(AWTEvent.WINDOW_EVENT_MASK); |
| 562 | initLocalData(); |
| 563 | initGuiComponents(); |
| 564 | initListeners(); |
| 565 | } // MainFrame(boolean simple) |
| 566 | |
| 567 | protected void initLocalData() { |
| 568 | resourcesTreeRoot = new DefaultMutableTreeNode("GATE", true); |
nothing calls this directly
no test coverage detected