Constructor. @param args command-line arguments @throws BaseXException database exception
(final String... args)
| 47 | * @throws BaseXException database exception |
| 48 | */ |
| 49 | public BaseXGUI(final String... args) throws BaseXException { |
| 50 | super(args); |
| 51 | parseArgs(); |
| 52 | |
| 53 | // create splash screen |
| 54 | final JFrame splash = splash(); |
| 55 | |
| 56 | // read options |
| 57 | final GUIOptions gopts = new GUIOptions(); |
| 58 | // initialize look and feel |
| 59 | init(gopts); |
| 60 | |
| 61 | // initialize fonts and colors |
| 62 | GUIConstants.init(gopts); |
| 63 | |
| 64 | SwingUtilities.invokeLater(() -> { |
| 65 | // open main window and close splash screen |
| 66 | final GUI gui = new GUI(context, gopts); |
| 67 | splash.dispose(); |
| 68 | |
| 69 | // open specified file |
| 70 | final ArrayList<IOFile> xqfiles = new ArrayList<>(); |
| 71 | for(final String file : files.finish()) { |
| 72 | if(file.contains(IO.BASEXSUFFIX)) continue; |
| 73 | |
| 74 | final IOFile io = new IOFile(file); |
| 75 | final boolean xml = file.endsWith(IO.XMLSUFFIX); |
| 76 | if(xml && BaseXDialog.confirm(gui, Util.info(CREATE_DB_FILE, io))) { |
| 77 | gopts.setFile(GUIOptions.INPUTPATH, io); |
| 78 | gopts.set(GUIOptions.DBNAME, io.dbName()); |
| 79 | DialogProgress.execute(gui, new Check(file)); |
| 80 | } else { |
| 81 | xqfiles.add(io); |
| 82 | } |
| 83 | } |
| 84 | gui.editor.init(xqfiles); |
| 85 | }); |
| 86 | |
| 87 | // guarantee correct shutdown of database context |
| 88 | Runtime.getRuntime().addShutdownHook(new Thread(context::close)); |
| 89 | } |
| 90 | |
| 91 | /** |
| 92 | * Creates a splash screen. |
nothing calls this directly
no test coverage detected