// Path: uk/ac/bbsrc/babraham/FastQC/Dialogs/AboutDialog.java
// public class AboutDialog extends JDialog {
// 
//     /**
//      * Instantiates a new about dialog.
//      * 
//      * @param a The SeqMonk application.
//      */
//     public AboutDialog (FastQCApplication a) {
//     	super(a);
//         setTitle("About FastQC...");  
//         Container cont = getContentPane();
//         cont.setLayout(new BorderLayout());
//         
//         add(new FastQCTitlePanel(),BorderLayout.CENTER);
// 
//         JPanel buttonPanel = new JPanel();
//         
//         JButton closeButton = new JButton("Close");
//         getRootPane().setDefaultButton(closeButton);
//         closeButton.addActionListener(new ActionListener() {
//             public void actionPerformed(ActionEvent arg0) {
//                 setVisible(false);
//                 dispose();
//             }
//         });
//         buttonPanel.add(closeButton);
//         
//         cont.add(buttonPanel,BorderLayout.SOUTH);
//         
//         setSize(650,200);
//         setLocationRelativeTo(a);
//         setResizable(false);
//         setVisible(true);
//     }
//     
// }
// 
// Path: uk/ac/bbsrc/babraham/FastQC/Help/HelpDialog.java
// public class HelpDialog extends JDialog implements TreeSelectionListener {
// 	
// 	/** The tree. */
// 	private JTree tree;
// 	
// 	/** The current page. */
// 	private HelpPageDisplay currentPage = null;
// 	
// 	/** The main split. */
// 	private JSplitPane mainSplit;
// 	
// 	
// 	/**
// 	 * Instantiates a new help dialog.
// 	 * 
// 	 * @param parent the parent
// 	 * @param startingLocation the starting location
// 	 */
// 	public HelpDialog (JFrame parent, File startingLocation) {
// 		super(parent,"Help Contents");
// 		
// 		HelpIndexRoot root = new HelpIndexRoot(startingLocation);
// 		
// 		mainSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
// 		setContentPane(mainSplit);
// 		
// 		tree = new JTree(new DefaultTreeModel(root));
// 		
// 		JSplitPane leftSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
// 		leftSplit.setTopComponent(new JScrollPane(tree));
// 		leftSplit.setBottomComponent(new HelpSearchPanel(root,this));
// 		
// 		mainSplit.setLeftComponent(leftSplit);
// 		currentPage = new HelpPageDisplay(null);
// 		mainSplit.setRightComponent(currentPage);
// 
// 		tree.addTreeSelectionListener(this);
// 		
// 		
// 		setSize(800,500);
// 		setLocationRelativeTo(parent);
// 		setVisible(true);
// 		
// 		leftSplit.setDividerLocation(0.7);
// 		mainSplit.setDividerLocation(0.3);
// 		findStartingPage();
// 	}
// 
// 	/**
// 	 * Find starting page.
// 	 */
// 	private void findStartingPage () {
// 		DefaultMutableTreeNode currentNode = (DefaultMutableTreeNode)tree.getModel().getRoot();
// 
// 		DisplayPage((HelpPage)currentNode.getFirstLeaf());
// 	}
// 	
// 	/**
// 	 * Display page.
// 	 * 
// 	 * @param page the page
// 	 */
// 	public void DisplayPage(HelpPage page) {
// 		if (currentPage != null) {
// 			int d = mainSplit.getDividerLocation();
// 			mainSplit.remove(currentPage);
// 			currentPage = new HelpPageDisplay(page);
// 			mainSplit.setRightComponent(currentPage);
// 			mainSplit.setDividerLocation(d);
// 		}
// 	}
// 	
// 	/* (non-Javadoc)
// 	 * @see javax.swing.event.TreeSelectionListener#valueChanged(javax.swing.event.TreeSelectionEvent)
// 	 */
// 	public void valueChanged(TreeSelectionEvent tse) {
// 		
// 		if (tse.getNewLeadSelectionPath() == null) return;
// 		
// 		Object o = tse.getNewLeadSelectionPath().getLastPathComponent();
// 		if (o instanceof HelpPage && ((HelpPage)o).isLeaf()) {
// 			DisplayPage((HelpPage)o);
// 		}
// 	}
// 	
// }


import uk.ac.bbsrc.babraham.FastQC.Dialogs.AboutDialog;
import uk.ac.bbsrc.babraham.FastQC.Help.HelpDialog;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.io.File;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.KeyStroke;

		helpAbout.setMnemonic(KeyEvent.VK_A);
		helpAbout.setActionCommand("about");
		helpAbout.addActionListener(this);
		
		helpMenu.add(helpAbout);
		
		add(helpMenu);
		
	}

	public void actionPerformed(ActionEvent e) {

		String command = e.getActionCommand();
		
		if (command.equals("exit")) {
			System.exit(0);
		}
		else if (command.equals("open")) {
			application.openFile();
		}
		else if (command.equals("save")) {
			application.saveReport();
		}
		else if (command.equals("close")) {
			application.close();
		}
		else if (command.equals("close_all")) {
			application.closeAll();
		}
		else if (command.equals("help_contents")) {

// Path: uk/ac/bbsrc/babraham/FastQC/Dialogs/AboutDialog.java
// public class AboutDialog extends JDialog {
// 
//     /**
//      * Instantiates a new about dialog.
//      * 
//      * @param a The SeqMonk application.
//      */
//     public AboutDialog (FastQCApplication a) {
//     	super(a);
//         setTitle("About FastQC...");  
//         Container cont = getContentPane();
//         cont.setLayout(new BorderLayout());
//         
//         add(new FastQCTitlePanel(),BorderLayout.CENTER);
// 
//         JPanel buttonPanel = new JPanel();
//         
//         JButton closeButton = new JButton("Close");
//         getRootPane().setDefaultButton(closeButton);
//         closeButton.addActionListener(new ActionListener() {
//             public void actionPerformed(ActionEvent arg0) {
//                 setVisible(false);
//                 dispose();
//             }
//         });
//         buttonPanel.add(closeButton);
//         
//         cont.add(buttonPanel,BorderLayout.SOUTH);
//         
//         setSize(650,200);
//         setLocationRelativeTo(a);
//         setResizable(false);
//         setVisible(true);
//     }
//     
// }
// 
// Path: uk/ac/bbsrc/babraham/FastQC/Help/HelpDialog.java
// public class HelpDialog extends JDialog implements TreeSelectionListener {
// 	
// 	/** The tree. */
// 	private JTree tree;
// 	
// 	/** The current page. */
// 	private HelpPageDisplay currentPage = null;
// 	
// 	/** The main split. */
// 	private JSplitPane mainSplit;
// 	
// 	
// 	/**
// 	 * Instantiates a new help dialog.
// 	 * 
// 	 * @param parent the parent
// 	 * @param startingLocation the starting location
// 	 */
// 	public HelpDialog (JFrame parent, File startingLocation) {
// 		super(parent,"Help Contents");
// 		
// 		HelpIndexRoot root = new HelpIndexRoot(startingLocation);
// 		
// 		mainSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
// 		setContentPane(mainSplit);
// 		
// 		tree = new JTree(new DefaultTreeModel(root));
// 		
// 		JSplitPane leftSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
// 		leftSplit.setTopComponent(new JScrollPane(tree));
// 		leftSplit.setBottomComponent(new HelpSearchPanel(root,this));
// 		
// 		mainSplit.setLeftComponent(leftSplit);
// 		currentPage = new HelpPageDisplay(null);
// 		mainSplit.setRightComponent(currentPage);
// 
// 		tree.addTreeSelectionListener(this);
// 		
// 		
// 		setSize(800,500);
// 		setLocationRelativeTo(parent);
// 		setVisible(true);
// 		
// 		leftSplit.setDividerLocation(0.7);
// 		mainSplit.setDividerLocation(0.3);
// 		findStartingPage();
// 	}
// 
// 	/**
// 	 * Find starting page.
// 	 */
// 	private void findStartingPage () {
// 		DefaultMutableTreeNode currentNode = (DefaultMutableTreeNode)tree.getModel().getRoot();
// 
// 		DisplayPage((HelpPage)currentNode.getFirstLeaf());
// 	}
// 	
// 	/**
// 	 * Display page.
// 	 * 
// 	 * @param page the page
// 	 */
// 	public void DisplayPage(HelpPage page) {
// 		if (currentPage != null) {
// 			int d = mainSplit.getDividerLocation();
// 			mainSplit.remove(currentPage);
// 			currentPage = new HelpPageDisplay(page);
// 			mainSplit.setRightComponent(currentPage);
// 			mainSplit.setDividerLocation(d);
// 		}
// 	}
// 	
// 	/* (non-Javadoc)
// 	 * @see javax.swing.event.TreeSelectionListener#valueChanged(javax.swing.event.TreeSelectionEvent)
// 	 */
// 	public void valueChanged(TreeSelectionEvent tse) {
// 		
// 		if (tse.getNewLeadSelectionPath() == null) return;
// 		
// 		Object o = tse.getNewLeadSelectionPath().getLastPathComponent();
// 		if (o instanceof HelpPage && ((HelpPage)o).isLeaf()) {
// 			DisplayPage((HelpPage)o);
// 		}
// 	}
// 	
// }


// Path: uk/ac/bbsrc/babraham/FastQC/FastQCMenuBar.java
import uk.ac.bbsrc.babraham.FastQC.Dialogs.AboutDialog;
import uk.ac.bbsrc.babraham.FastQC.Help.HelpDialog;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.io.File;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.KeyStroke;

		helpAbout.setMnemonic(KeyEvent.VK_A);
		helpAbout.setActionCommand("about");
		helpAbout.addActionListener(this);
		
		helpMenu.add(helpAbout);
		
		add(helpMenu);
		
	}

	public void actionPerformed(ActionEvent e) {

		String command = e.getActionCommand();
		
		if (command.equals("exit")) {
			System.exit(0);
		}
		else if (command.equals("open")) {
			application.openFile();
		}
		else if (command.equals("save")) {
			application.saveReport();
		}
		else if (command.equals("close")) {
			application.close();
		}
		else if (command.equals("close_all")) {
			application.closeAll();
		}
		else if (command.equals("help_contents")) {

			new HelpDialog(application,new File(ClassLoader.getSystemResource("Help").getFile().replaceAll("%20", " ")));
