<commit_before>/**
 * The content of this file is subject to the caAdapter Software License (the "License").  
 * A copy of the License is available at:
 * [caAdapter CVS home directory]\etc\license\caAdapter_license.txt. or at:
 * http://ncicb.nci.nih.gov/infrastructure/cacore_overview/caadapter/indexContent
 * /docs/caAdapter_License
 */

package gov.nih.nci.cbiit.cmts.ui.main;


import gov.nih.nci.cbiit.cmts.ui.actions.AbstractContextAction;
import gov.nih.nci.cbiit.cmts.ui.actions.DefaultCloseAllAction;
import gov.nih.nci.cbiit.cmts.ui.actions.DefaultCloseAction;
import gov.nih.nci.cbiit.cmts.ui.actions.DefaultSaveAction;
import gov.nih.nci.cbiit.cmts.ui.actions.DefaultSaveAsAction;
import gov.nih.nci.cbiit.cmts.ui.actions.DefaultExitAction;
import gov.nih.nci.cbiit.cmts.ui.actions.NewMapFileAction;
import gov.nih.nci.cbiit.cmts.ui.actions.NewTransformationAction;
import gov.nih.nci.cbiit.cmts.ui.actions.OpenMapFileAction;
import gov.nih.nci.cbiit.cmts.ui.common.ActionConstants;
import gov.nih.nci.cbiit.cmts.ui.common.MenuConstants;

import javax.swing.*;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

/**
 * This class manages the definitions and instantiations of menu items. It will
 * coordinate ContextManager class to deal with context sensitive menu
 * switches.
 *
 * @author <NAME>
 * @author LAST UPDATE $Author: wangeug $
 * @since     CMTS v1.0
 * @version    $Revision: 1.1 $
 * @date       $Date: 2009-11-23 18:30:56 $
 */
@SuppressWarnings("serial")
public class MainMenuBar extends JMenuBar 
{

	//ContextManager contextManager = null;
	MainFrame mainFrame = null;
	private Map<String, AbstractContextAction> actionMap;
	private Map<String, JMenuItem> menuItemMap;
	private Map<String, JMenu> menuMap;

	public MainMenuBar(MainFrame mf)//ContextManager contextManager) {
	{//this.contextManager = contextManager;
		this.mainFrame = mf;//contextManager.getMainFrame();
		initialize();
	}

	private void initialize()
	{
		actionMap = Collections.synchronizedMap(new HashMap<String, AbstractContextAction>());
		menuItemMap = Collections.synchronizedMap(new HashMap<String, JMenuItem>());
		menuMap = Collections.synchronizedMap(new HashMap<String, JMenu>());

		add(constructFileMenu());
	}


	/* (non-Javadoc)
	 * @see gov.nih.nci.caadapter.ui.main.AbstractMenuBar#enableAction(java.lang.String, boolean)
	 */
	public void enableAction(String actionConstant, boolean value)
	{
		Action action = getDefinedAction(actionConstant);// (Action)actionMap.get(actionConstant);
		if (action != null)
		{
			action.setEnabled(value);
		} else
		{<commit_msg>add "Help" menu<commit_after>/**
 * The content of this file is subject to the caAdapter Software License (the "License").  
 * A copy of the License is available at:
 * [caAdapter CVS home directory]\etc\license\caAdapter_license.txt. or at:
 * http://ncicb.nci.nih.gov/infrastructure/cacore_overview/caadapter/indexContent
 * /docs/caAdapter_License
 */

package gov.nih.nci.cbiit.cmts.ui.main;


import gov.nih.nci.cbiit.cmts.ui.actions.AbstractContextAction;
import gov.nih.nci.cbiit.cmts.ui.actions.DefaultCloseAllAction;
import gov.nih.nci.cbiit.cmts.ui.actions.DefaultCloseAction;
import gov.nih.nci.cbiit.cmts.ui.actions.DefaultSaveAction;
import gov.nih.nci.cbiit.cmts.ui.actions.DefaultSaveAsAction;
import gov.nih.nci.cbiit.cmts.ui.actions.DefaultExitAction;
import gov.nih.nci.cbiit.cmts.ui.actions.NewMapFileAction;
import gov.nih.nci.cbiit.cmts.ui.actions.NewTransformationAction;
import gov.nih.nci.cbiit.cmts.ui.actions.OpenMapFileAction;
import gov.nih.nci.cbiit.cmts.ui.common.ActionConstants;
import gov.nih.nci.cbiit.cmts.ui.common.MenuConstants;

import javax.swing.*;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

/**
 * This class manages the definitions and instantiations of menu items. It will
 * coordinate ContextManager class to deal with context sensitive menu
 * switches.
 *
 * @author <NAME>
 * @author LAST UPDATE $Author: wangeug $
 * @since     CMTS v1.0
 * @version    $Revision: 1.1 $
 * @date       $Date: 2009-11-23 18:30:56 $
 */
@SuppressWarnings("serial")
public class MainMenuBar extends JMenuBar 
{

	//ContextManager contextManager = null;
	MainFrame mainFrame = null;
	private Map<String, AbstractContextAction> actionMap;
	private Map<String, JMenuItem> menuItemMap;
	private Map<String, JMenu> menuMap;

	public MainMenuBar(MainFrame mf)//ContextManager contextManager) {
	{//this.contextManager = contextManager;
		this.mainFrame = mf;//contextManager.getMainFrame();
		initialize();
	}

	private void initialize()
	{
		actionMap = Collections.synchronizedMap(new HashMap<String, AbstractContextAction>());
		menuItemMap = Collections.synchronizedMap(new HashMap<String, JMenuItem>());
		menuMap = Collections.synchronizedMap(new HashMap<String, JMenu>());

		add(constructFileMenu());
		JMenu helpMenu=new JMenu("Help");
		helpMenu.add(new JMenuItem("About caAdapter CMTS"));
		helpMenu.add(new JMenuItem("Help - Content and Index"));
		add(helpMenu);
	}


	/* (non-Javadoc)
	 * @see gov.nih.nci.caadapter.ui.main.AbstractMenuBar#enableAction(java.lang.String, boolean)
	 */
	public void enableAction(String actionConstant, boolean value)
	{
		Action action = getDefinedAction(actionConstant);// (Action)actionMap.get(actionConstant);
		if (action != null)
		{
			action.setEnabled(value);
		} else
		{
{'fraction_non_alphanumeric': 0.12395929694727105, 'fraction_numerical': 0.0066604995374653095, 'mean_word_length': 4.901746724890829, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '7487446', 'n_tokens_mistral': 1900, 'n_tokens_neox': 1817, 'n_words': 355}