001//////////////////////////////////////////////////////////////////////////////// 002// checkstyle: Checks Java source code for adherence to a set of rules. 003// Copyright (C) 2001-2002 Oliver Burn 004// 005// This library is free software; you can redistribute it and/or 006// modify it under the terms of the GNU Lesser General Public 007// License as published by the Free Software Foundation; either 008// version 2.1 of the License, or (at your option) any later version. 009// 010// This library is distributed in the hope that it will be useful, 011// but WITHOUT ANY WARRANTY; without even the implied warranty of 012// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 013// Lesser General Public License for more details. 014// 015// You should have received a copy of the GNU Lesser General Public 016// License along with this library; if not, write to the Free Software 017// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 018//////////////////////////////////////////////////////////////////////////////// 019 020package com.puppycrawl.tools.checkstyle.gui; 021 022import java.io.File; 023 024import javax.swing.JFrame; 025 026import com.puppycrawl.tools.checkstyle.api.DetailAST; 027 028/** 029 * Entry point for starting the checkstyle GUI. 030 */ 031public class Main 032{ 033 static JFrame frame; 034 035 public static void main(String[] args) 036 { 037 frame = new JFrame("CheckStyle"); 038 final ParseTreeInfoPanel panel = new ParseTreeInfoPanel(); 039 frame.getContentPane().add(panel); 040 if (args.length >= 1) { 041 final File f = new File(args[0]); 042 panel.openFile(f, frame); 043 } 044 frame.pack(); 045 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 046 frame.setVisible(true); 047 } 048 049 public static void displayAst(DetailAST ast) 050 { 051 JFrame frame = new JFrame("CheckStyle"); 052 final ParseTreeInfoPanel panel = new ParseTreeInfoPanel(); 053 frame.getContentPane().add(panel); 054 panel.openAst(ast, frame); 055 frame.setSize(1500, 800); 056 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 057 frame.setVisible(true); 058 } 059}