public static void main()

in src/main/java/org/apache/sling/reqanalyzer/impl/gui/Main.java [31:67]


    public static void main(String[] args) throws IOException {
        if (GraphicsEnvironment.isHeadless()) {
            System.err.println("Cannot run in headless mode");
            System.exit(1);
        }

        if (args.length == 0) {
            System.err.println("Missing argument <file>");
            System.exit(1);
        }

        File file = new File(args[0]);
        if (!file.canRead()) {
            System.err.println("Cannot read from file " + file);
            System.exit(1);
        }

        final int limit;
        if (args.length >= 2) {
            limit = Integer.parseInt(args[1]);
        } else {
            limit = Integer.MAX_VALUE;
        }

        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();

        MainFrame frame = new MainFrame(file, limit, screenSize);
        frame.setVisible(true);

        // exit the application if the main frame is closed
        frame.addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosing(WindowEvent e) {
                System.exit(0);
            }
        });
    }