//
// MainFrame.java
//

package imagej.gui;

import imagej.plugin.PluginEntry;
import imagej.plugin.PluginUtils;

import java.awt.BorderLayout;
import java.util.ArrayList;
import java.util.List;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenuBar;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;

/** A simple and dumb Swing-based main window for ImageJ2. */
public class MainFrame {
	
	private String info = "Hello, ImageJ";

	/** Creates a new ImageJ frame that runs as an application. */
	public MainFrame() {
		final JFrame frame = new JFrame("ImageJ");
		createMenuBar(frame);
		createContentPane(frame);
		frame.pack();
		frame.setVisible(true);
	}

	private void createContentPane(JFrame frame) {
		final JPanel pane = new JPanel();
		frame.setContentPane(pane);
		pane.setLayout(new BorderLayout());
		pane.setBorder(new EmptyBorder(15, 15, 15, 15));
		pane.add(new JLabel(info));
	}

	private void createMenuBar(JFrame frame) {
		final List<PluginEntry> entries = PluginUtils.findPlugins();
		final List<String> menuPath = new ArrayList<String>();
		menuPath.add("File");
		menuPath.add("Import");
		entries.add(new PluginEntry("loci.plugins.in.Importer", menuPath, "Bio-Formats", ""));
		info = "Discovered " + entries.size() + " plugins";//TEMP
		final JMenuBar menubar = new MenuBuilder().buildMenuBar(entries);
		frame.setJMenuBar(menubar);
	}

	public static void main(String[] args) {
		new MainFrame();
	}

}

@@ -427,17 +427,16 @@
 Frame %7B%0A
-%09
 %0A%09privat
@@ -1103,147 +1103,8 @@
 ();%0A
-%09%09menuPath.add(%22File%22);%0A%09%09menuPath.add(%22Import%22);%0A%09%09entries.add(new PluginEntry(%22loci.plugins.in.Importer%22, menuPath, %22Bio-Formats%22, %22%22));%0A
 %09%09in
@@ -1156,14 +1156,8 @@
 ns%22;
-//TEMP
 %0A%09%09f

Remove debugging code.