<commit_before>package nl.mpi.kinnate.ui.menu;

import java.io.IOException;
import java.net.URI;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.event.MenuEvent;
import javax.swing.event.MenuListener;
import nl.mpi.arbil.ArbilVersion;
import nl.mpi.arbil.ui.ArbilWindowManager;
import nl.mpi.arbil.userstorage.SessionStorage;
import nl.mpi.arbil.util.ApplicationVersion;
import nl.mpi.arbil.util.ApplicationVersionManager;
import nl.mpi.arbil.util.ArbilBugCatcher;
import nl.mpi.arbil.util.BugCatcherManager;
import nl.mpi.kinnate.ui.KinOathHelp;
import nl.mpi.kinnate.ui.window.AbstractDiagramManager;
import org.xml.sax.SAXException;

/**
 * Document : HelpMenu Created on : Dec 8, 2011, 4:25:49 PM
 *
 * @author <NAME>
 */
public class HelpMenu extends JMenu {

    public HelpMenu(final AbstractDiagramManager diagramWindowManager, final ArbilWindowManager dialogHandler, final SessionStorage sessionStorage, final ApplicationVersionManager versionManager) {
        this.setText("Help");
        JMenuItem aboutMenuItem = new JMenuItem("About");
        aboutMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                // todo: move this into the window manager
                ApplicationVersion appVersion = versionManager.getApplicationVersion();
                String messageString = "KinOath is an application for  Kinship and Archiving.\n"
                        + "Designed to be flexible and culturally nonspecific, such that\n"
                        + "culturally different social structures can equally be represented.\n\n"
                        + "By linking archived data to kinship individuals, queries can be\n"
                        + "performed to retrieve the archive data based on kinship relations.\n\n"
                        + "Max Planck Institute for Psycholinguistics Nijmegen\n"
                        + "Application design and programming by <NAME>\n"
                        + "KinOath also uses components of Arbil\n\n"
                        + "KinOath Version: " + appVersion.currentMajor + "." + appVersion.currentMinor + "." + appVersion.currentRevision + "\n"
                        + appVersion.lastCommitDate + "\n" + "Compile Date: " + appVersion.compileDate + "\n"
                        + "Arbil Version: " + new ArbilVersion().currentMajor + "." + new ArbilVersion().currentMinor + "." + new ArbilVersion().currentRevision + "\n"
                        + "Java version: " + System.getProperty("java.version") + " by " + System.getProperty("java.vendor");
                dialogHandler.addMessageDialogToQueue(messageString, "About " + versionManager.getApplicationVersion().applicationTitle);
            }
        });
        this.add(aboutMenuItem);
        JMenuItem helpMenuItem = new JMenuItem("Internal Help");
        helpMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F1, 0));
        helpMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                try {
                    diagramWindowManager.createDiagramWindow("Internal Help", new KinOathHelp(), null);
                } catch (IOException ex) {
                    dialogHandler.addMessageDialogToQueue("Could not start the help system:\n" + ex.getMessage(), "Internal Help");
                    BugCatcherManager.getBugCatcher().logError(ex);
                } catch (SAXException ex) {
                    dialogHandler.addMessageDialogToQueue("Could not start the help system:\n" + ex.getMessage(), "Internal Help");
                    BugCatcherManager.getBugCatcher().logError(ex);
                }
            }
        });<commit_msg>refs #2360 Added the internal help window and the hemp menu item.<commit_after>package nl.mpi.kinnate.ui.menu;

import java.io.IOException;
import java.net.URI;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.event.MenuEvent;
import javax.swing.event.MenuListener;
import nl.mpi.arbil.ArbilVersion;
import nl.mpi.arbil.ui.ArbilWindowManager;
import nl.mpi.arbil.userstorage.SessionStorage;
import nl.mpi.arbil.util.ApplicationVersion;
import nl.mpi.arbil.util.ApplicationVersionManager;
import nl.mpi.arbil.util.ArbilBugCatcher;
import nl.mpi.arbil.util.BugCatcherManager;
import nl.mpi.kinnate.ui.KinOathHelp;
import nl.mpi.kinnate.ui.window.AbstractDiagramManager;
import org.xml.sax.SAXException;

/**
 * Document : HelpMenu Created on : Dec 8, 2011, 4:25:49 PM
 *
 * @author <NAME>
 */
public class HelpMenu extends JMenu {

    JFrame helpWindow = null;

    public HelpMenu(final AbstractDiagramManager diagramWindowManager, final ArbilWindowManager dialogHandler, final SessionStorage sessionStorage, final ApplicationVersionManager versionManager) {
        this.setText("Help");
        JMenuItem aboutMenuItem = new JMenuItem("About");
        aboutMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                // todo: move this into the window manager
                ApplicationVersion appVersion = versionManager.getApplicationVersion();
                String messageString = "KinOath is an application for  Kinship and Archiving.\n"
                        + "Designed to be flexible and culturally nonspecific, such that\n"
                        + "culturally different social structures can equally be represented.\n\n"
                        + "By linking archived data to kinship individuals, queries can be\n"
                        + "performed to retrieve the archive data based on kinship relations.\n\n"
                        + "Max Planck Institute for Psycholinguistics Nijmegen\n"
                        + "Application design and programming by <NAME>\n"
                        + "KinOath also uses components of Arbil\n\n"
                        + "KinOath Version: " + appVersion.currentMajor + "." + appVersion.currentMinor + "." + appVersion.currentRevision + "\n"
                        + appVersion.lastCommitDate + "\n" + "Compile Date: " + appVersion.compileDate + "\n"
                        + "Arbil Version: " + new ArbilVersion().currentMajor + "." + new ArbilVersion().currentMinor + "." + new ArbilVersion().currentRevision + "\n"
                        + "Java version: " + System.getProperty("java.version") + " by " + System.getProperty("java.vendor");
                dialogHandler.addMessageDialogToQueue(messageString, "About " + versionManager.getApplicationVersion().applicationTitle);
            }
        });
        this.add(aboutMenuItem);
        JMenuItem helpMenuItem = new JMenuItem("Internal Help");
        helpMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F1, 0));
        helpMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                try {
                    if (helpWindow == null) {
                        helpWindow = diagramWindowManager.createHelpWindow("Internal Help", new KinOathHelp(), null);
                    } else {
                        helpWindow.setVisible(true);
                        helpWindow.toFront();
                    }
                } catch (IOException ex) {
                    dialogHandler.addMessageDialogToQueue("Could not start the help system:\n" + ex.getMessage(), "Internal Help");
                    BugCatcherManager.getBugCatcher().logError(ex);
                } catch (SAXException ex) {
                    dialogHandler.addMessageDialogToQueue("Could not start the help system:\n" + ex.getMessage(), "Internal Help");
                    BugCatcherManager.getBugCatcher().logError(ex);
                }
            }
        });
{'fraction_non_alphanumeric': 0.10017574692442882, 'fraction_numerical': 0.0035149384885764497, 'mean_word_length': 2.526781761841523, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '3399576', 'n_tokens_mistral': 2167, 'n_tokens_neox': 2050, 'n_words': 471}