<commit_before>package org.smbarbour.mcu.packer.ui;

import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JPanel;

import org.smbarbour.mcu.packer.Version;

public class PackagerFrame extends JFrame {
	private static final long serialVersionUID = 7909185882605437761L;
	
	private JPanel _panel;

	public PackagerFrame() {
		this.setTitle("MCU ServerPackager - v"+Version.VERSION);
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.setBounds(100, 100, 1200, 700);
		
		_panel = new JPanel();
		this.add(_panel);
		
		JMenu fileMenu = new JMenu("File");
		
		JMenuBar menuBar = new JMenuBar();
		menuBar.add(fileMenu);
		this.setJMenuBar(menuBar);
		
		this.setVisible(true);
	}
}<commit_msg>Added menubar to packman<commit_after>package org.smbarbour.mcu.packer.ui;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;

import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.KeyStroke;

import org.smbarbour.mcu.packer.Version;

public class PackagerFrame extends JFrame implements ActionListener {
	private static final long serialVersionUID = 7909185882605437761L;
	
	private JPanel _panel;
	
	private JMenuItem _newItem;
	private JMenuItem _openItem;
	private JMenuItem _importFromDotMinecraft;
	private JMenuItem _importFromMultiMC;
	private JMenuItem _saveItem;
	private JMenuItem _saveAsItem;
	private JMenuItem _quitItem;

	public PackagerFrame() {
		this.setTitle("MCU ServerPackager - v"+Version.VERSION);
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.setBounds(100, 100, 1200, 700);
		
		_panel = new JPanel();
		this.add(_panel);
		
		initMenu();
		
		this.setVisible(true);
	}
	
	private void initMenu() {
		_newItem = new JMenuItem("New");
		_newItem.addActionListener(this);
		
		_openItem = new JMenuItem("Open Server Pack...");
		_openItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, ActionEvent.CTRL_MASK));
		_openItem.addActionListener(this);
		
		JMenu importMenu = new JMenu("Import");
		_importFromDotMinecraft = new JMenuItem("From .minecraft...");
		_importFromDotMinecraft.setEnabled(false);
		_importFromDotMinecraft.addActionListener(this);
		_importFromMultiMC = new JMenuItem("From MultiMC instance...");
		_importFromMultiMC.addActionListener(this);
		importMenu.add(_importFromDotMinecraft);
		importMenu.add(_importFromMultiMC);
		
		_saveItem = new JMenuItem("Save");
		_saveItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK));
		_saveItem.setEnabled(false);
		_saveItem.addActionListener(this);
		
		_saveAsItem = new JMenuItem("Save As...");
		_saveAsItem.setEnabled(false);
		_saveAsItem.addActionListener(this);
		
		_quitItem = new JMenuItem("Quit");
		_quitItem.addActionListener(this);
		
		JMenu fileMenu = new JMenu("File");
		fileMenu.add(_newItem);
		fileMenu.add(_openItem);
		fileMenu.add(importMenu);
		fileMenu.addSeparator();
		fileMenu.add(_saveItem);
		fileMenu.add(_saveAsItem);
		fileMenu.addSeparator();
		fileMenu.add(_quitItem);
		
		JMenuBar menuBar = new JMenuBar();
		menuBar.add(fileMenu);
		this.setJMenuBar(menuBar);
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		Object target = e.getSource();
		System.out.println(((JMenuItem)target).getText());
		if( target.equals(_newItem) ) {
			// Discard all changes and create a new server pack
			// TODO: check for unsaved pending changes
		} else if( target.equals(_openItem) ) {
			// Open an existing server pack xml
			// TODO: check for unsaved pending changes
		} else if( target.equals(_saveItem) ) {
			// Save current changes
		} else if( target.equals(_saveAsItem) ) {
			// Save with a new name
		} else if( target.equals(_importFromDotMinecraft) ) {
			// Import configuration from ~/.minecraft
		} else if( target.equals(_importFromMultiMC) ) {
			// Import configuration from a MultiMC instance
		} else if( target.equals(_quitItem) ) {
			// TODO: check for unsaved pending changes
			System.exit(NORMAL);
		}
	}
}
{'fraction_non_alphanumeric': 0.11210871147779665, 'fraction_numerical': 0.015530211113807329, 'mean_word_length': 4.822033898305085, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 1}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6614334', 'n_tokens_mistral': 1525, 'n_tokens_neox': 1345, 'n_words': 278}