Newer
Older
/* EditMenu.java
*
* created: Thu Dec 3 1998
*
* This file is part of Artemis
*
* Copyright (C) 1998,1999,2000,2001,2002 Genome Research Limited
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: //tmp/pathsoft/artemis/uk/ac/sanger/artemis/components/EditMenu.java,v 1.62 2009-08-17 12:29:04 tjc Exp $
**/
package uk.ac.sanger.artemis.components;
import uk.ac.sanger.artemis.*;
import uk.ac.sanger.artemis.sequence.*;
import uk.ac.sanger.artemis.util.*;
import uk.ac.sanger.artemis.components.genebuilder.BasicGeneBuilderFrame;
import uk.ac.sanger.artemis.components.genebuilder.GeneBuilderFrame;
import uk.ac.sanger.artemis.components.genebuilder.GeneUtils;
import uk.ac.sanger.artemis.components.genebuilder.GeneViewerPanel;
import uk.ac.sanger.artemis.components.genebuilder.gff.PropertiesPanel;
import uk.ac.sanger.artemis.io.Range;
import uk.ac.sanger.artemis.io.RangeVector;
import uk.ac.sanger.artemis.io.Key;
import uk.ac.sanger.artemis.io.Location;
import uk.ac.sanger.artemis.io.Qualifier;
import uk.ac.sanger.artemis.io.QualifierVector;
import uk.ac.sanger.artemis.io.InvalidRelationException;
import uk.ac.sanger.artemis.io.EntryInformation;
import uk.ac.sanger.artemis.io.EntryInformationException;
import uk.ac.sanger.artemis.io.OutOfDateException;
import uk.ac.sanger.artemis.io.RawStreamSequence;
import java.awt.*;
import java.awt.event.*;
import java.io.IOException;
import javax.swing.*;
import java.text.DecimalFormat;
import java.text.NumberFormat;
/**
* A menu with editing commands.
*
* @author Kim Rutherford
* @version $Id: EditMenu.java,v 1.62 2009-08-17 12:29:04 tjc Exp $
implements EntryGroupChangeListener, EntryChangeListener
{
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* The GotoEventSource object that was passed to the constructor.
**/
private GotoEventSource goto_event_source = null;
/**
* The EntryGroup object that was passed to the constructor.
**/
private EntryGroup entry_group = null;
/**
* The BasePlotGroup object that was passed to the constructor.
**/
private BasePlotGroup base_plot_group = null;
public static org.apache.log4j.Logger logger4j =
org.apache.log4j.Logger.getLogger(EditMenu.class);
/** records the gene builders that are open */
private static Hashtable geneBuilderHash;
/**
* Create a new EditMenu object.
* @param frame The JFrame that owns this JMenu.
* @param selection The Selection that the commands in the menu will
* operate on.
* @param goto_event_source The object the we will call makeBaseVisible()
* on.
* @param entry_group The EntryGroup object where new features/entries will
* be added.
* @param base_plot_group The BasePlotGroup associated with this JMenu -
* needed to call getCodonUsageAlgorithm()
* @param menu_name The name of the new menu.
**/
public EditMenu(final JFrame frame,
final Selection selection,
final GotoEventSource goto_event_source,
final EntryGroup entry_group,
final BasePlotGroup base_plot_group,
{
super(frame, menu_name, selection);
this.entry_group = entry_group;
this.goto_event_source = goto_event_source;
this.base_plot_group = base_plot_group;
getEntryGroup().addEntryGroupChangeListener(this);
getEntryGroup().addEntryChangeListener(this);
refreshMenu();
}
/**
* Create a new EditMenu object and use "Edit" as the menu name.
* @param frame The JFrame that owns this JMenu.
* @param selection The Selection that the commands in the menu will
* operate on.
* @param goto_event_source The object the we will call makeBaseVisible()
* on.
* @param entry_group The EntryGroup object where new features/entries will
* be added.
* @param base_plot_group The BasePlotGroup associated with this JMenu -
* needed to call getCodonUsageAlgorithm()
**/
public EditMenu(final JFrame frame,
final Selection selection,
final GotoEventSource goto_event_source,
final EntryGroup entry_group,
final BasePlotGroup base_plot_group,
final DisplayComponent owner)
{
this(frame, selection, goto_event_source, entry_group,
}
/**
* The shortcut for Edit Selected Features.
**/
final static KeyStroke EDIT_FEATURES_KEY =
KeyStroke.getKeyStroke(KeyEvent.VK_E,
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()); //InputEvent.CTRL_MASK);
final static public int EDIT_FEATURES_KEY_CODE = KeyEvent.VK_E;
/**
* The shortcut for Merge Selected Features.
**/
final static KeyStroke MERGE_FEATURES_KEY =
KeyStroke.getKeyStroke(KeyEvent.VK_M,
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()); // InputEvent.CTRL_MASK);
final static public int MERGE_FEATURES_KEY_CODE = KeyEvent.VK_M;
/**
* The shortcut for Duplicate Selected Features.
**/
final static KeyStroke DUPLICATE_KEY =
KeyStroke.getKeyStroke(KeyEvent.VK_D,
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()); // InputEvent.CTRL_MASK);
final static public int DUPLICATE_KEY_CODE = KeyEvent.VK_D;
/**
* The shortcut for Delete Selected Features.
**/
final static KeyStroke DELETE_FEATURES_KEY =
KeyStroke.getKeyStroke(KeyEvent.VK_DELETE,
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()); // InputEvent.CTRL_MASK);
final static public int DELETE_FEATURES_KEY_CODE = KeyEvent.VK_DELETE;
/**
* The shortcut for Trim Selected Features.
**/
final static KeyStroke TRIM_FEATURES_KEY =
KeyStroke.getKeyStroke(KeyEvent.VK_T,
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()); // InputEvent.CTRL_MASK);
Loading
Loading full blame...