Coverage Report - de.glossmaker.gui.gloss.main.definition.DefinitionPanel
 
Classes in this File Line Coverage Branch Coverage Complexity
DefinitionPanel
0%
0/459
0%
0/116
3,952
DefinitionPanel$1
0%
0/6
0%
0/2
3,952
DefinitionPanel$DefinitionTextPaneMouseListener
0%
0/8
0%
0/4
3,952
 
 1  
 package de.glossmaker.gui.gloss.main.definition;
 2  
 
 3  
 import java.awt.BorderLayout;
 4  
 import java.awt.event.ActionEvent;
 5  
 import java.awt.event.ActionListener;
 6  
 import java.awt.event.InputEvent;
 7  
 import java.awt.event.MouseAdapter;
 8  
 import java.awt.event.MouseEvent;
 9  
 import java.beans.PropertyChangeEvent;
 10  
 import java.beans.PropertyChangeListener;
 11  
 import java.util.ArrayList;
 12  
 
 13  
 import javax.swing.JMenu;
 14  
 import javax.swing.JMenuBar;
 15  
 import javax.swing.JMenuItem;
 16  
 import javax.swing.JPanel;
 17  
 import javax.swing.JPopupMenu;
 18  
 import javax.swing.JScrollPane;
 19  
 import javax.swing.JSeparator;
 20  
 import javax.swing.JTextPane;
 21  
 import javax.swing.JToolBar;
 22  
 import javax.swing.KeyStroke;
 23  
 import javax.swing.text.BadLocationException;
 24  
 
 25  
 import org.apache.log4j.Logger;
 26  
 
 27  
 import de.glossmaker.bib.datastructure.ABibItem;
 28  
 import de.glossmaker.bib.datastructure.BibItems;
 29  
 import de.glossmaker.bib.datastructure.EBibTeXReference;
 30  
 import de.glossmaker.common.document.LaTeXStyledDocument;
 31  
 import de.glossmaker.gloss.datastructure.GlossItem;
 32  
 import de.glossmaker.gloss.datastructure.GlossItems;
 33  
 import de.glossmaker.gloss.datastructure.IItem;
 34  
 import de.glossmaker.gloss.datastructure.gui.Config;
 35  
 import de.glossmaker.gloss.language.Translation;
 36  
 import de.glossmaker.gloss.listener.EActionCommands;
 37  
 import de.glossmaker.gloss.observer.GlossItemsChangePublisher;
 38  
 import de.glossmaker.gloss.observer.SelectionChangePublisher;
 39  
 import de.glossmaker.gui.gloss.AUpdateDocumentListener;
 40  
 import de.glossmaker.gui.gloss.bars.HelpItemChangeListener;
 41  
 import de.glossmaker.gui.gloss.main.BibTeXItemsFrame;
 42  
 import de.glossmaker.gui.gloss.main.HelpFocusListener;
 43  
 
 44  
 /**
 45  
  * 
 46  
  * 
 47  
  * @author Markus Flingelli
 48  
  */
 49  0
 public class DefinitionPanel extends JPanel implements PropertyChangeListener, ActionListener{
 50  
         private static final long serialVersionUID = -758454691385177509L;
 51  0
         private static final Logger mLogger = Logger.getLogger(DefinitionPanel.class);
 52  
         
 53  0
         private JTextPane mDefinitionTextPane = null;
 54  0
         private JScrollPane mScrollPane = null;
 55  0
         private JPopupMenu mPopupMenu = null;
 56  0
         private JPanel mMainPanel = null;
 57  0
         private JToolBar mToolBar = null;
 58  0
         private JMenuBar mMenuBar = null;
 59  
         
 60  0
         private AUpdateDocumentListener mDefinitionTextDocumentListener = null;
 61  
         private GlossItem mSelectedItem;
 62  0
         private Translation mTranslation = null;
 63  0
         private GlossItemsChangePublisher mGlossItemsChangePublisher = null;
 64  0
         private GlossItems mGlossItems = null;
 65  
         private JMenu mInsertMenu;
 66  
         private JMenu mInsertEnumerations;
 67  
         private JMenu mInsertCodeEnvironment;
 68  
         private JMenu mInsertFormulas;
 69  
         private JMenu mInsertQuotations;
 70  
         private JMenuItem mInsertItemization;
 71  
         private JMenuItem mInsertEnumeration;
 72  
         private JMenuItem mInsertDescription;
 73  
         private JMenuItem mInsertCode;
 74  
         private JMenuItem mInsertCodeWhiteSpace;
 75  
         private JMenuItem mInsertEmbeddedCode;
 76  
         private JMenuItem mInsertEmbeddedCodeWhiteSpace;
 77  
         private JMenuItem mInsertEmbeddedFormula;
 78  
         private JMenuItem mInsertFormula;
 79  
         private JMenuItem mInsertEnumeratedFormula;
 80  
         private JMenuItem mInsertEquationArray;
 81  
         private JMenuItem mInsertShortQuotation;
 82  
         private JMenuItem mInsertQuotation;
 83  
         private JMenuItem mInsertVerse;
 84  
         private JMenu mFormatMenu;
 85  
         private JMenu mFontFamily;
 86  
         private JMenu mFontShapes;
 87  
         private JMenu mFontSeries;
 88  
         private JMenuItem mRoman;
 89  
         private JMenuItem mSansSerif;
 90  
         private JMenuItem mTypewriter;
 91  
         private JMenuItem mVertical;
 92  
         private JMenuItem mItalic;
 93  
         private JMenuItem mSlanted;
 94  
         private JMenuItem mSmallCaps;
 95  
         private JMenuItem mMedium;
 96  
         private JMenuItem mBold;
 97  
         private LaTeXStyledDocument mLaTeXStyledDocument;
 98  
         
 99  0
         public DefinitionPanel(GlossItems items) {
 100  0
                 mGlossItems = items;
 101  0
                 mTranslation = Translation.getInstance();
 102  0
                 initialize();
 103  0
                 mGlossItemsChangePublisher = GlossItemsChangePublisher.getInstance(items);
 104  0
                 SelectionChangePublisher.getInstance().addPropertyChangeListener(this);
 105  0
                 GlossItemsChangePublisher.getInstance(items).addPropertyChangeListener(this);                
 106  0
         }
 107  
         
 108  
         private void initialize() {
 109  0
                 this.setLayout(new BorderLayout());
 110  0
                 this.add(getMainPanel(), BorderLayout.CENTER);
 111  0
                 changeLanguage();
 112  0
         }
 113  
         
 114  
         private JPanel getMainPanel() {
 115  0
                 if (mMainPanel == null) {
 116  0
                         mMainPanel = new JPanel(new BorderLayout());
 117  0
                         mMainPanel.add(getToolBar(), BorderLayout.NORTH);
 118  0
                         mMainPanel.add(getScrollPane(), BorderLayout.CENTER);
 119  
                 }
 120  
                 
 121  0
                 return mMainPanel;
 122  
         }
 123  
         
 124  
         private JMenuBar getMenuBar() {
 125  0
                 if (mMenuBar == null) {
 126  0
                         mMenuBar = new JMenuBar();
 127  0
                         mMenuBar.add(getInsertMenu());
 128  0
                         mMenuBar.add(getFormatMenu());
 129  0
                         mMenuBar.setVisible(false);
 130  
                 }
 131  0
                 return mMenuBar;
 132  
         }
 133  
         
 134  
         private void changeLanguage() {
 135  0
                 mInsertMenu.setText(mTranslation.getValue("definition.toolbar.menu.insert.text"));
 136  0
                 mInsertMenu.setToolTipText(mTranslation.getValue("definition.toolbar.menu.insert.tooltip"));
 137  
                 
 138  0
                 mInsertEnumerations.setText(mTranslation.getValue("definition.toolbar.menu.insert.enumerations.text"));
 139  0
                 mInsertEnumerations.setToolTipText(mTranslation.getValue("definition.toolbar.menu.insert.enumerations.tooltip"));
 140  0
                 mInsertItemization.setText( mTranslation.getValue("definition.toolbar.menu.insert.enumerations.itemization.text"));
 141  0
                 mInsertItemization.setToolTipText(mTranslation.getValue("definition.toolbar.menu.insert.enumerations.itemization.tooltip"));
 142  0
                 mInsertEnumeration.setText(mTranslation.getValue("definition.toolbar.menu.insert.enumerations.enumeration.text"));
 143  0
                 mInsertEnumeration.setToolTipText(mTranslation.getValue("definition.toolbar.menu.insert.enumerations.enumeration.tooltip"));
 144  0
                 mInsertDescription.setText(mTranslation.getValue("definition.toolbar.menu.insert.enumerations.description.text"));
 145  0
                 mInsertDescription.setToolTipText(mTranslation.getValue("definition.toolbar.menu.insert.enumerations.description.tooltip"));
 146  
                 
 147  0
                 mInsertCodeEnvironment.setText(mTranslation.getValue("definition.toolbar.menu.insert.code_environments.text"));
 148  0
                 mInsertCodeEnvironment.setToolTipText(mTranslation.getValue("definition.toolbar.menu.insert.code_environments.tooltip"));
 149  0
                 mInsertCode.setText(mTranslation.getValue("definition.toolbar.menu.insert.code_environments.code.text"));
 150  0
                 mInsertCode.setToolTipText(mTranslation.getValue("definition.toolbar.menu.insert.code_environments.code.tooltip"));
 151  0
                 mInsertCodeWhiteSpace.setText(mTranslation.getValue("definition.toolbar.menu.insert.code_environments.code_white_space.text"));
 152  0
                 mInsertCodeWhiteSpace.setToolTipText(mTranslation.getValue("definition.toolbar.menu.insert.code_environments.code_white_space.tooltip"));
 153  0
                 mInsertEmbeddedCode.setText(mTranslation.getValue("definition.toolbar.menu.insert.code_environments.embededd_code.text"));
 154  0
                 mInsertEmbeddedCode.setToolTipText(mTranslation.getValue("definition.toolbar.menu.insert.code_environments.embedded_code.tooltip"));
 155  0
                 mInsertEmbeddedCodeWhiteSpace.setText(mTranslation.getValue("definition.toolbar.menu.insert.code_environments.embedded_code_white_space.text"));
 156  0
                 mInsertEmbeddedCodeWhiteSpace.setToolTipText(mTranslation.getValue("definition.toolbar.menu.insert.code_environments.embededd_code_white_space.tooltip"));
 157  
                 
 158  0
                 mInsertFormulas.setText(mTranslation.getValue("definition.toolbar.menu.insert.formulas.text"));
 159  0
                 mInsertFormulas.setToolTipText(mTranslation.getValue("definition.toolbar.menu.insert.formulas.tooltip"));
 160  0
                 mInsertEmbeddedFormula.setText(mTranslation.getValue("definition.toolbar.menu.insert.formulas.embededd_formula.text"));
 161  0
                 mInsertEmbeddedFormula.setToolTipText(mTranslation.getValue("definition.toolbar.menu.insert.formulas.embededd_formula.tooltip"));
 162  0
                 mInsertFormula.setText(mTranslation.getValue("definition.toolbar.menu.insert.formulas.formula.text"));
 163  0
                 mInsertFormula.setToolTipText(mTranslation.getValue("definition.toolbar.menu.insert.formulas.formula.tooltip"));
 164  0
                 mInsertEnumeratedFormula.setText(mTranslation.getValue("definition.toolbar.menu.insert.formulas.enumerated_formula.text"));
 165  0
                 mInsertEnumeratedFormula.setToolTipText(mTranslation.getValue("definition.toolbar.menu.insert.formulas.enumerated_formula.tooltip"));
 166  0
                 mInsertEquationArray.setText(mTranslation.getValue("definition.toolbar.menu.insert.formulas.equation_array.text"));
 167  0
                 mInsertEquationArray.setToolTipText(mTranslation.getValue("definition.toolbar.menu.insert.formulas.equation_array.tooltip"));
 168  
                 
 169  0
                 mInsertQuotations.setText(mTranslation.getValue("definition.toolbar.menu.insert.quotations.text"));
 170  0
                 mInsertQuotations.setToolTipText(mTranslation.getValue("definition.toolbar.menu.insert.quotations.tooltip"));
 171  0
                 mInsertShortQuotation.setText(mTranslation.getValue("definition.toolbar.menu.insert.quotations.short_quotation.text"));
 172  0
                 mInsertShortQuotation.setToolTipText(mTranslation.getValue("definition.toolbar.menu.insert.quotations.short_quotation.tooltip"));
 173  0
                 mInsertQuotation.setText(mTranslation.getValue("definition.toolbar.menu.insert.quotations.quotation.text"));
 174  0
                 mInsertQuotation.setToolTipText(mTranslation.getValue("definition.toolbar.menu.insert.quotations.quotation.tooltip"));
 175  0
                 mInsertVerse.setText(mTranslation.getValue("definition.toolbar.menu.insert.quotations.verse.text"));
 176  0
                 mInsertVerse.setToolTipText(mTranslation.getValue("definition.toolbar.menu.insert.quotations.verse.tooltip"));
 177  
                 
 178  0
                 mFormatMenu.setText(mTranslation.getValue("definition.toolbar.menu.format.text"));
 179  0
                 mFormatMenu.setToolTipText(mTranslation.getValue("definition.toolbar.menu.format.tooltip"));
 180  0
                 mFontFamily.setText(mTranslation.getValue("definition.toolbar.menu.format.font_family.text"));
 181  0
                 mFontFamily.setToolTipText(mTranslation.getValue("definition.toolbar.menu.format.font_family.tooltip"));
 182  0
                 mRoman.setText(mTranslation.getValue("definition.toolbar.menu.format.font_family.roman.text"));
 183  0
                 mRoman.setToolTipText(mTranslation.getValue("definition.toolbar.menu.format.font_family.roman.tooltip"));
 184  0
                 mSansSerif.setText(mTranslation.getValue("definition.toolbar.menu.format.font_family.sans_serif.text"));
 185  0
                 mSansSerif.setToolTipText(mTranslation.getValue("definition.toolbar.menu.format.font_family.sans_serif.tooltip"));
 186  0
                 mTypewriter.setText(mTranslation.getValue("definition.toolbar.menu.format.font_family.typewriter.text"));
 187  0
                 mTypewriter.setToolTipText(mTranslation.getValue("definition.toolbar.menu.format.font_family.typewriter.tooltip"));
 188  
                 
 189  0
                 mFontShapes.setText(mTranslation.getValue("definition.toolbar.menu.format.font_shapes.text"));
 190  0
                 mFontShapes.setToolTipText(mTranslation.getValue("definition.toolbar.menu.format.font_shapes.tooltip"));
 191  0
                 mVertical.setText(mTranslation.getValue("definition.toolbar.menu.format.font_shapes.vertical.text"));
 192  0
                 mVertical.setToolTipText(mTranslation.getValue("definition.toolbar.menu.format.font_shapes.vertical.tooltip"));
 193  0
                 mItalic.setText(mTranslation.getValue("definition.toolbar.menu.format.font_shapes.italic.text"));
 194  0
                 mItalic.setToolTipText(mTranslation.getValue("definition.toolbar.menu.format.font_shapes.italic.tooltip"));
 195  0
                 mSlanted.setText(mTranslation.getValue("definition.toolbar.menu.format.font_shapes.slanted.text"));
 196  0
                 mSlanted.setToolTipText(mTranslation.getValue("definition.toolbar.menu.format.font_shapes.slanted.tooltip"));
 197  0
                 mSmallCaps.setText(mTranslation.getValue("definition.toolbar.menu.format.font_shapes.small_caps.text"));
 198  0
                 mSmallCaps.setToolTipText(mTranslation.getValue("definition.toolbar.menu.format.font_shapes.small_caps.tooltip"));
 199  
                 
 200  0
                 mFontSeries.setText(mTranslation.getValue("definition.toolbar.menu.format.font_series.text"));
 201  0
                 mFontSeries.setToolTipText(mTranslation.getValue("definition.toolbar.menu.format.font_series.tooltip"));
 202  0
                 mMedium.setText(mTranslation.getValue("definition.toolbar.menu.format.font_series.medium.text"));
 203  0
                 mMedium.setToolTipText(mTranslation.getValue("definition.toolbar.menu.format.font_series.medium.tooltip"));
 204  0
                 mBold.setText(mTranslation.getValue("definition.toolbar.menu.format.font_series.bold.text"));
 205  0
                 mBold.setToolTipText(mTranslation.getValue("definition.toolbar.menu.format.font_series.bold.tooltip"));
 206  0
         }
 207  
         
 208  
         private JMenu getInsertMenu() {                        
 209  0
                 if (mInsertMenu == null) {
 210  0
                         mInsertMenu = new JMenu();
 211  0
                         mInsertMenu.addChangeListener(new HelpItemChangeListener("section.input_panel.definition.insert"));
 212  
                         
 213  0
                         mInsertEnumerations = new JMenu();
 214  0
                         mInsertEnumerations.addChangeListener(new HelpItemChangeListener("section.input_panel.definition.insert"));
 215  0
                         mInsertMenu.add(mInsertEnumerations);
 216  
                         
 217  0
                         mInsertItemization = new JMenuItem();                
 218  0
                         mInsertItemization.setActionCommand(EDefinitionAction.ITEMIZATION.toString());
 219  0
                         mInsertItemization.addActionListener(this);
 220  0
                         mInsertItemization.addChangeListener(new HelpItemChangeListener("section.input_panel.definition.insert.itemization"));
 221  0
                         mInsertEnumerations.add(mInsertItemization);
 222  
                         
 223  0
                         mInsertEnumeration = new JMenuItem();
 224  0
                         mInsertEnumeration.setActionCommand(EDefinitionAction.ENUMERATION.toString());
 225  0
                         mInsertEnumeration.addActionListener(this);
 226  0
                         mInsertEnumeration.addChangeListener(new HelpItemChangeListener("section.input_panel.definition.insert.enumeration"));
 227  0
                         mInsertEnumerations.add(mInsertEnumeration);
 228  
                         
 229  0
                         mInsertDescription = new JMenuItem();                
 230  0
                         mInsertDescription.setActionCommand(EDefinitionAction.DESCRIPTION.toString());
 231  0
                         mInsertDescription.addActionListener(this);
 232  0
                         mInsertDescription.addChangeListener(new HelpItemChangeListener("section.input_panel.definition.insert.description"));
 233  0
                         mInsertEnumerations.add(mInsertDescription);
 234  
                         
 235  0
                         mInsertCodeEnvironment = new JMenu();
 236  0
                         mInsertCodeEnvironment.addChangeListener(new HelpItemChangeListener("section.input_panel.definition.insert.code_environments"));
 237  0
                         mInsertMenu.add(mInsertCodeEnvironment);
 238  
                         
 239  0
                         mInsertCode = new JMenuItem();
 240  0
                         mInsertCode.addChangeListener(new HelpItemChangeListener("section.input_panel.definition.insert.code_environments.code"));
 241  0
                         mInsertCode.setActionCommand(EDefinitionAction.CODE.toString());
 242  0
                         mInsertCode.addActionListener(this);
 243  0
                         mInsertCodeEnvironment.add(mInsertCode);
 244  
                         
 245  0
                         mInsertCodeWhiteSpace = new JMenuItem();
 246  0
                         mInsertCodeWhiteSpace.addChangeListener(new HelpItemChangeListener("section.input_panel.definition.insert.code_environments.code_white_space"));
 247  0
                         mInsertCodeWhiteSpace.setActionCommand(EDefinitionAction.CODE_WHITE_SPACE.toString());
 248  0
                         mInsertCodeWhiteSpace.addActionListener(this);
 249  0
                         mInsertCodeEnvironment.add(mInsertCodeWhiteSpace);
 250  
                         
 251  0
                         mInsertEmbeddedCode = new JMenuItem();
 252  0
                         mInsertEmbeddedCode.addChangeListener(new HelpItemChangeListener("section.input_panel.definition.insert.code_environments.embedded_code"));
 253  0
                         mInsertEmbeddedCode.setActionCommand(EDefinitionAction.EMBEDDED_CODE.toString());
 254  0
                         mInsertEmbeddedCode.addActionListener(this);
 255  0
                         mInsertCodeEnvironment.add(mInsertEmbeddedCode);
 256  
                         
 257  0
                         mInsertEmbeddedCodeWhiteSpace = new JMenuItem();
 258  0
                         mInsertEmbeddedCodeWhiteSpace.addChangeListener(new HelpItemChangeListener("section.input_panel.definition.insert.code_environments.embededde_code_white_space"));
 259  0
                         mInsertEmbeddedCodeWhiteSpace.setActionCommand(EDefinitionAction.EMBEDDED_CODE_WHITE_SPACE.toString());
 260  0
                         mInsertEmbeddedCodeWhiteSpace.addActionListener(this);
 261  0
                         mInsertCodeEnvironment.add(mInsertEmbeddedCodeWhiteSpace);
 262  
                         
 263  0
                         mInsertFormulas = new JMenu();
 264  0
                         mInsertFormulas.addChangeListener(new HelpItemChangeListener("section.input_panel.definition.insert.formulas"));
 265  0
                         mInsertMenu.add(mInsertFormulas);
 266  
                         
 267  0
                         mInsertEmbeddedFormula = new JMenuItem();
 268  0
                         mInsertEmbeddedFormula.addChangeListener(new HelpItemChangeListener("section.input_panel.definition.insert.formulas.embedded_formula"));
 269  0
                         mInsertEmbeddedFormula.setActionCommand(EDefinitionAction.EMBEDDED_FORMULA.toString());
 270  0
                         mInsertEmbeddedFormula.addActionListener(this);
 271  0
                         mInsertFormulas.add(mInsertEmbeddedFormula);
 272  
                         
 273  0
                         mInsertFormula = new JMenuItem();
 274  0
                         mInsertFormula.addChangeListener(new HelpItemChangeListener("section.input_panel.definition.insert.formulas.formula"));
 275  0
                         mInsertFormula.setActionCommand(EDefinitionAction.FORMULA.toString());
 276  0
                         mInsertFormula.addActionListener(this);
 277  0
                         mInsertFormulas.add(mInsertFormula);
 278  
                         
 279  0
                         mInsertEnumeratedFormula = new JMenuItem();
 280  0
                         mInsertEnumeratedFormula.addChangeListener(new HelpItemChangeListener("section.input_panel.definition.insert.formulas.enumerated_equation"));
 281  0
                         mInsertEnumeratedFormula.setActionCommand(EDefinitionAction.ENUMERATED_FORMULA.toString());
 282  0
                         mInsertEnumeratedFormula.addActionListener(this);
 283  0
                         mInsertFormulas.add(mInsertEnumeratedFormula);
 284  
                         
 285  0
                         mInsertEquationArray = new JMenuItem();
 286  0
                         mInsertEquationArray.addChangeListener(new HelpItemChangeListener("section.input_panel.definition.insert.formulas.equation_array"));
 287  0
                         mInsertEquationArray.setActionCommand(EDefinitionAction.EQUATION_ARRAY.toString());
 288  0
                         mInsertEquationArray.addActionListener(this);
 289  0
                         mInsertFormulas.add(mInsertEquationArray);
 290  
                         
 291  0
                         mInsertQuotations = new JMenu();
 292  0
                         mInsertQuotations.addChangeListener(new HelpItemChangeListener("section.input_panel.definition.insert.quotations"));
 293  0
                         mInsertQuotations.setActionCommand(EDefinitionAction.ENUMERATED_FORMULA.toString());
 294  0
                         mInsertMenu.add(mInsertQuotations);
 295  
                         
 296  0
                         mInsertShortQuotation = new JMenuItem();
 297  0
                         mInsertShortQuotation.addChangeListener(new HelpItemChangeListener("section.input_panel.definition.insert.quotations.short_quotation"));
 298  0
                         mInsertShortQuotation.setActionCommand(EDefinitionAction.SHORT_QUOTATATION.toString());
 299  0
                         mInsertShortQuotation.addActionListener(this);
 300  0
                         mInsertQuotations.add(mInsertShortQuotation);
 301  
                         
 302  0
                         mInsertQuotation = new JMenuItem();
 303  0
                         mInsertQuotation.addChangeListener(new HelpItemChangeListener("section.input_panel.definition.insert.quotations.quotation"));
 304  0
                         mInsertQuotation.setActionCommand(EDefinitionAction.QUOTATION.toString());
 305  0
                         mInsertQuotation.addActionListener(this);
 306  0
                         mInsertQuotations.add(mInsertQuotation);
 307  
                         
 308  0
                         mInsertVerse = new JMenuItem();
 309  0
                         mInsertVerse.addChangeListener(new HelpItemChangeListener("section.input_panel.definition.insert.quotations.verse"));
 310  0
                         mInsertVerse.setActionCommand(EDefinitionAction.VERSE.toString());
 311  0
                         mInsertVerse.addActionListener(this);
 312  0
                         mInsertQuotations.add(mInsertVerse);
 313  
                 }
 314  
                 
 315  0
                 return mInsertMenu;
 316  
         }
 317  
         
 318  
         private JMenu getFormatMenu() {
 319  0
                 if (mFormatMenu == null) {
 320  0
                         mFormatMenu = new JMenu();
 321  0
                         mFormatMenu.addChangeListener(new HelpItemChangeListener("section.input_panel.definition.format"));
 322  
                         
 323  0
                         mFontFamily = new JMenu();
 324  0
                         mFontFamily.addChangeListener(new HelpItemChangeListener("section.input_panel.definitin.format.font_family"));
 325  0
                         mFormatMenu.add(mFontFamily);
 326  
                         
 327  0
                         mRoman = new JMenuItem();
 328  0
                         mRoman.addChangeListener(new HelpItemChangeListener("section.input_panel.definitin.format.font_family"));
 329  0
                         mRoman.setActionCommand(EDefinitionAction.ROMAN.toString());
 330  0
                         mRoman.addActionListener(this);
 331  0
                         mFontFamily.add(mRoman);
 332  
                         
 333  0
                         mSansSerif = new JMenuItem();
 334  0
                         mSansSerif.addChangeListener(new HelpItemChangeListener("section.input_panel.definitin.format.font_family"));
 335  0
                         mSansSerif.setActionCommand(EDefinitionAction.SANS_SERIF.toString());
 336  0
                         mSansSerif.addActionListener(this);
 337  0
                         mFontFamily.add(mSansSerif);
 338  
                         
 339  0
                         mTypewriter = new JMenuItem();
 340  0
                         mTypewriter.addChangeListener(new HelpItemChangeListener("section.input_panel.definitin.format.font_family"));
 341  0
                         mTypewriter.setActionCommand(EDefinitionAction.TYPEWRITER.toString());
 342  0
                         mTypewriter.addActionListener(this);
 343  0
                         mFontFamily.add(mTypewriter);
 344  
                         
 345  0
                         mFontShapes = new JMenu();
 346  0
                         mFontShapes.addChangeListener(new HelpItemChangeListener("section.input_panel.definitin.format.font_shapes"));
 347  0
                         mFormatMenu.add(mFontShapes);
 348  
                         
 349  0
                         mVertical = new JMenuItem();
 350  0
                         mVertical.addChangeListener(new HelpItemChangeListener("section.input_panel.definitin.format.font_shapes"));
 351  0
                         mVertical.setActionCommand(EDefinitionAction.VERTICAL.toString());
 352  0
                         mVertical.addActionListener(this);
 353  0
                         mFontShapes.add(mVertical);
 354  
                         
 355  0
                         mItalic = new JMenuItem();
 356  0
                         mItalic.addChangeListener(new HelpItemChangeListener("section.input_panel.definitin.format.font_shapes"));
 357  0
                         mItalic.setActionCommand(EDefinitionAction.ITALIC.toString());
 358  0
                         mItalic.addActionListener(this);
 359  0
                         mFontShapes.add(mItalic);
 360  
                         
 361  0
                         mSlanted = new JMenuItem();
 362  0
                         mSlanted.addChangeListener(new HelpItemChangeListener("section.input_panel.definitin.format.font_shapes"));
 363  0
                         mSlanted.setActionCommand(EDefinitionAction.SLANTED.toString());
 364  0
                         mSlanted.addActionListener(this);
 365  0
                         mFontShapes.add(mSlanted);
 366  
                         
 367  0
                         mSmallCaps = new JMenuItem();
 368  0
                         mSmallCaps.addChangeListener(new HelpItemChangeListener("section.input_panel.definitin.format.font_shapes"));
 369  0
                         mSmallCaps.setActionCommand(EDefinitionAction.SMALL_CAPS.toString());
 370  0
                         mSmallCaps.addActionListener(this);
 371  0
                         mFontShapes.add(mSmallCaps);
 372  
                         
 373  0
                         mFontSeries = new JMenu();
 374  0
                         mFontSeries.addChangeListener(new HelpItemChangeListener("section.input_panel.definitin.format.font_series"));
 375  0
                         mFormatMenu.add(mFontSeries);
 376  
                         
 377  0
                         mMedium = new JMenuItem();
 378  0
                         mMedium.addChangeListener(new HelpItemChangeListener("section.input_panel.definitin.format.font_series"));
 379  0
                         mMedium.setActionCommand(EDefinitionAction.MEDIUM.toString());
 380  0
                         mMedium.addActionListener(this);
 381  0
                         mFontSeries.add(mMedium);
 382  
                         
 383  0
                         mBold = new JMenuItem();
 384  0
                         mBold.addChangeListener(new HelpItemChangeListener("section.input_panel.definitin.format.font_series"));
 385  0
                         mBold.setActionCommand(EDefinitionAction.BOLD.toString());
 386  0
                         mBold.addActionListener(this);
 387  0
                         mFontSeries.add(mBold);
 388  
                 }
 389  
                 
 390  0
                 return mFormatMenu;
 391  
         }
 392  
         
 393  
         private JToolBar getToolBar() {
 394  0
                 if (mToolBar == null) {
 395  0
                         mToolBar = new JToolBar();
 396  0
                         mToolBar.add(getMenuBar());
 397  
                 }
 398  
                 
 399  0
                 return mToolBar;
 400  
         }
 401  
         
 402  
         private JScrollPane getScrollPane() {
 403  0
                 if (mScrollPane == null) {
 404  0
                         mScrollPane = new JScrollPane();
 405  0
                         mScrollPane.setViewportView(getDefintionTextPane());
 406  
                 }
 407  
                 
 408  0
                 return mScrollPane;
 409  
         }
 410  
         
 411  
         private JTextPane getDefintionTextPane() {
 412  0
                 if (mDefinitionTextPane == null) {
 413  0
                         mDefinitionTextPane = new JTextPane();
 414  
                         // for GUI test
 415  0
                         mDefinitionTextPane.setName("definition_input");
 416  0
                         mLaTeXStyledDocument = new LaTeXStyledDocument(Config.getInstance().isPrintBlankAndTabs());
 417  0
                         mDefinitionTextPane.setDocument(mLaTeXStyledDocument);
 418  0
                         mDefinitionTextPane.setEnabled(false);
 419  0
                         mDefinitionTextPane.addMouseListener(new DefinitionTextPaneMouseListener());
 420  0
                         mDefinitionTextPane.addFocusListener(new HelpFocusListener("section.input_panel.definition"));
 421  0
                         mDefinitionTextDocumentListener = new AUpdateDocumentListener() {
 422  
                                 
 423  
                                 @Override
 424  
                                 public void updateData() {
 425  0
                                         if (mSelectedItem != null) {
 426  0
                                                 mDefinitionTextPane.getDocument().removeDocumentListener(mDefinitionTextDocumentListener);
 427  0
                                                 mGlossItemsChangePublisher.setDefinition(mSelectedItem, mLaTeXStyledDocument.getText());
 428  0
                                                 mDefinitionTextPane.getDocument().addDocumentListener(mDefinitionTextDocumentListener);
 429  
                                         }
 430  0
                                 }
 431  
                         };
 432  0
                         mDefinitionTextPane.getDocument().addDocumentListener(mDefinitionTextDocumentListener);
 433  
                 }
 434  
                 
 435  0
                 return mDefinitionTextPane;
 436  
         }
 437  
         
 438  
         private void addPopupItems(JPopupMenu popupMenu) {
 439  0
                 JMenuItem item = new JMenuItem(mTranslation.getValue("definition.popup.menu.copy.text"));
 440  0
                 item.setActionCommand(EDefinitionAction.COPY.toString());
 441  0
                 item.addActionListener(this);
 442  0
                 item.setAccelerator(KeyStroke.getKeyStroke('C', InputEvent.CTRL_MASK));
 443  0
                 item.setName("popup_definition_copy");
 444  0
                 item.addChangeListener(new HelpItemChangeListener("section.input_panel.definition"));
 445  0
                 popupMenu.add(item);
 446  
                 
 447  0
                 item = new JMenuItem(mTranslation.getValue("definition.popup.menu.paste.text"));
 448  0
                 item.setActionCommand(EDefinitionAction.PASTE.toString());
 449  0
                 item.addActionListener(this);
 450  0
                 item.setAccelerator(KeyStroke.getKeyStroke('V', InputEvent.CTRL_MASK));
 451  0
                 item.setName("popup_definition_paste");
 452  0
                 item.addChangeListener(new HelpItemChangeListener("section.input_panel.definition"));
 453  0
                 popupMenu.add(item);
 454  
                 
 455  0
                 item = new JMenuItem(mTranslation.getValue("definition.popup.menu.cut.text"));
 456  0
                 item.setActionCommand(EDefinitionAction.CUT.toString());
 457  0
                 item.addActionListener(this);
 458  0
                 item.setAccelerator(KeyStroke.getKeyStroke('X', InputEvent.CTRL_MASK));
 459  0
                 item.setName("popup_definition_cut");
 460  0
                 item.addChangeListener(new HelpItemChangeListener("section.input_panel.definition"));
 461  0
                 popupMenu.add(item);
 462  
                 
 463  0
                 item = new JMenuItem(mTranslation.getValue("definition.popup.menu.select_all.text"));
 464  0
                 item.setActionCommand(EDefinitionAction.SELECT_ALL.toString());
 465  0
                 item.addActionListener(this);
 466  0
                 item.setAccelerator(KeyStroke.getKeyStroke('A', InputEvent.CTRL_MASK));
 467  0
                 item.setName("popup_definition_select_all");
 468  0
                 item.addChangeListener(new HelpItemChangeListener("section.input_panel.definition"));
 469  0
                 popupMenu.add(item);
 470  
                 
 471  0
                 popupMenu.add(new JSeparator());
 472  0
         }
 473  
 
 474  
         private JPopupMenu getPopUpMenu() {
 475  0
                 if (mGlossItems !=  null) {
 476  0
                         mPopupMenu =  new JPopupMenu(); 
 477  0
                         addPopupItems(mPopupMenu);
 478  0
                         JMenu menu = new JMenu(mTranslation.getValue("definition.popup.menu.gloss.text"));
 479  0
                         menu.addChangeListener(new HelpItemChangeListener("section.input_panel.definition.gloss_reference"));
 480  0
                         ArrayList<String> headings = new ArrayList<String>();
 481  0
                         for(int i = 0; i < mGlossItems.size(); i++) {
 482  0
                                 GlossItem item = mGlossItems.get(i);
 483  0
                                 if (headings.contains(item.getHeading()) == false) {
 484  0
                                         headings.add(item.getHeading());
 485  
                                 }
 486  
                         }
 487  0
                         for(int i = 0; i < headings.size(); i++) {
 488  0
                                 JMenu headingMenu = new JMenu(headings.get(i));
 489  0
                                 headingMenu.addChangeListener(new HelpItemChangeListener("section.input_panel.definition.gloss_reference"));
 490  0
                                 headingMenu.setName("popup_definition_heading_" + headings.get(i));
 491  0
                                 for(int j = 0; j < mGlossItems.size(); j++) {
 492  0
                                         GlossItem item = mGlossItems.get(j);
 493  0
                                         if (item.getHeading().equals(headings.get(i))) {
 494  0
                                                 JMenuItem menuItem = new JMenuItem(item.getKey());
 495  0
                                                 menuItem.setActionCommand(EDefinitionAction.ADD_GLOSSREF.toString() + "_" + item.getKey());
 496  0
                                                 menuItem.addActionListener(this);
 497  0
                                                 menuItem.setName("popup_definition_key_" + item.getKey());
 498  0
                                                 menuItem.addChangeListener(new HelpItemChangeListener("section.input_panel.definition.gloss_reference"));
 499  0
                                                 headingMenu.add(menuItem);
 500  
                                         }
 501  
                                 }
 502  0
                                 menu.add(headingMenu);
 503  
                         }
 504  0
                         mPopupMenu.add(menu);
 505  
                         
 506  0
                         if (Config.getInstance().getBibTeXFile() != null) {
 507  0
                                 BibItems bibItems = new BibItems(Config.getInstance().getBibTeXFile());
 508  0
                                 menu = new JMenu(mTranslation.getValue("definition.popup.menu.bibtex.text"));
 509  0
                                 menu.addChangeListener(new HelpItemChangeListener("section.input_panel.definition.bib_reference"));
 510  0
                                 for(EBibTeXReference reference : EBibTeXReference.values()) {
 511  0
                                         int count = bibItems.count(reference); 
 512  0
                                         if (count > 0) {
 513  0
                                                 JMenu category = new JMenu(reference.toString().toLowerCase());
 514  0
                                                 category.addChangeListener(new HelpItemChangeListener("section.input_panel.definition.bib_reference"));
 515  0
                                                 ArrayList<IItem> items = bibItems.getItems(reference);
 516  0
                                                 for(int i = 0; i < items.size(); i++) {
 517  0
                                                         IItem key = items.get(i);
 518  0
                                                         JMenuItem menuItem = new JMenuItem(key.getKey());
 519  0
                                                         menuItem.setActionCommand(EDefinitionAction.ADD_BIBREF.toString() + "_" + key.getKey());
 520  0
                                                         menuItem.setToolTipText(((ABibItem)key).toHTML());
 521  0
                                                         menuItem.addActionListener(this);
 522  0
                                                         menuItem.addChangeListener(new HelpItemChangeListener("section.input_panel.definition.bib_reference"));
 523  0
                                                         category.add(menuItem);
 524  
                                                 }
 525  0
                                                 menu.add(category);
 526  
                                         }
 527  
                                 }
 528  0
                                 JMenuItem showEditor = new JMenuItem(mTranslation.getValue("definition.popup.menu.bibtex.show_editor.text"));
 529  0
                                 showEditor.setActionCommand(EDefinitionAction.SHOW_BIB_EDITOR.toString());
 530  0
                                 showEditor.addActionListener(this);
 531  0
                                 showEditor.addChangeListener(new HelpItemChangeListener("section.bibeditor"));
 532  0
                                 menu.add(showEditor);
 533  0
                                 mPopupMenu.add(menu);
 534  
                         }
 535  
                         
 536  
                 
 537  0
                 mPopupMenu.setOpaque(true);
 538  0
                 mPopupMenu.setLightWeightPopupEnabled(true); 
 539  0
                 } else {
 540  0
                         addPopupItems(mPopupMenu);
 541  
                 }
 542  
                 
 543  0
                 return mPopupMenu;
 544  
         }
 545  
         
 546  
         private void updateDefinition(String definition) {
 547  0
                 mDefinitionTextPane.getDocument().removeDocumentListener(mDefinitionTextDocumentListener);
 548  0
                 mDefinitionTextPane.setText(definition);
 549  0
                 mDefinitionTextPane.getDocument().addDocumentListener(mDefinitionTextDocumentListener);
 550  0
         }
 551  
         
 552  
         @Override
 553  
         public void propertyChange(PropertyChangeEvent event) {
 554  0
                 if (event.getPropertyName().equals(EActionCommands.TREE_SELECTION_CHANGED.toString())) {
 555  0
                         mDefinitionTextPane.getDocument().removeDocumentListener(mDefinitionTextDocumentListener);
 556  0
                         mSelectedItem = (GlossItem) event.getNewValue();
 557  0
                         if (mSelectedItem != null) {
 558  0
                                 mDefinitionTextPane.setText(mSelectedItem.getDefinition());
 559  
                         } else {
 560  0
                                 mDefinitionTextPane.setText("");
 561  
                         }
 562  0
                         mDefinitionTextPane.getDocument().addDocumentListener(mDefinitionTextDocumentListener);
 563  0
                         setDefintionEnabled(true);
 564  0
                 } else if (event.getPropertyName().equals(EActionCommands.CREATE_NEW_FILE.toString()) ||
 565  
                                 event.getPropertyName().equals(EActionCommands.OPEN_FILE.toString())) {
 566  0
                         updateDefinition("");
 567  0
                         setDefintionEnabled(false);
 568  0
                 } else if (event.getPropertyName().equals(EActionCommands.FIRE_UNDO.toString())) {
 569  0
                         if ( ((String)event.getNewValue()).equals(EActionCommands.GLOSS_ITEM_DEFINITION_CHANGED.toString())) {
 570  0
                                 updateDefinition(mSelectedItem.getDefinition());
 571  
                         }
 572  0
                 } else if (event.getPropertyName().equals(EActionCommands.LANGUAGE_CHANGED.toString())) {
 573  0
                         changeLanguage();
 574  0
                 }  else if (event.getPropertyName().equals(EActionCommands.UPDATE_TOPPANEL.toString())) {
 575  0
                         GlossItem item = (GlossItem) event.getNewValue();
 576  0
                         if (item != null) {
 577  0
                                 updateDefinition(item.getDefinition());
 578  
                         }
 579  0
                 } else if (event.getPropertyName().equals(EActionCommands.SPECIAL_CHARS.toString())) {
 580  0
                         mLaTeXStyledDocument.setShowSpecialCharacters((Boolean) event.getNewValue());
 581  0
                         updateDefinition(mLaTeXStyledDocument.getText());
 582  
                 }
 583  0
         }
 584  
 
 585  
 
 586  
         private void insertText(String beforeSelection, String afterSelection) {
 587  0
                 int startSelection = mDefinitionTextPane.getSelectionStart();
 588  0
                 int endSelection = mDefinitionTextPane.getSelectionEnd();
 589  
                 try {
 590  0
                         mDefinitionTextPane.getDocument().removeDocumentListener(mDefinitionTextDocumentListener);
 591  0
                         if (startSelection != endSelection) {
 592  0
                                 mDefinitionTextPane.getDocument().insertString(startSelection, beforeSelection, null);
 593  0
                                 mDefinitionTextPane.getDocument().insertString(endSelection + beforeSelection.length(), afterSelection, null);
 594  
                         } else {
 595  0
                                 mDefinitionTextPane.getDocument().insertString(startSelection, beforeSelection + afterSelection, null);                                
 596  
                         }
 597  0
                         mDefinitionTextPane.setCaretPosition(endSelection + beforeSelection.length());
 598  0
                         mDefinitionTextPane.getDocument().addDocumentListener(mDefinitionTextDocumentListener);
 599  0
                         mGlossItemsChangePublisher.setDefinition(mSelectedItem, mDefinitionTextPane.getText());
 600  0
                 } catch (BadLocationException e) {
 601  0
                         mLogger.error(e);
 602  0
                 }
 603  0
         }
 604  
         
 605  
         @Override
 606  
         public void actionPerformed(ActionEvent event) {
 607  0
                 if (event.getActionCommand().startsWith(EDefinitionAction.ADD_GLOSSREF.toString())) {
 608  0
                         String gloss = event.getActionCommand();
 609  0
                         gloss = "\\gloss{" + gloss.substring(EDefinitionAction.ADD_GLOSSREF.toString().length() + 1, gloss.length()) + "}" ;
 610  0
                         insertText(gloss, "");
 611  0
                 } else if (event.getActionCommand().startsWith(EDefinitionAction.ADD_BIBREF.toString())) {
 612  0
                         String bib = event.getActionCommand();
 613  0
                         bib = "\\cite{" + bib.substring(EDefinitionAction.ADD_BIBREF.toString().length() + 1, bib.length()) + "}" ;
 614  0
                         insertText(bib, "");
 615  0
                 } else if (event.getActionCommand().equals(EDefinitionAction.COPY.toString())) {
 616  0
                         mDefinitionTextPane.copy();
 617  0
                 } else if (event.getActionCommand().equals(EDefinitionAction.PASTE.toString())) {
 618  0
                         mDefinitionTextPane.paste();
 619  0
                 } else if (event.getActionCommand().equals(EDefinitionAction.CUT.toString())) {
 620  0
                         mDefinitionTextPane.cut();
 621  0
                 } else if (event.getActionCommand().equals(EDefinitionAction.SELECT_ALL.toString())) {
 622  0
                         mDefinitionTextPane.selectAll();
 623  0
                 } else if (event.getActionCommand().equals(EDefinitionAction.ITEMIZATION.toString())) {
 624  0
                         insertText("\\begin{itemize}\n\\item ", "\n\\end{itemize}");
 625  0
                 } else if (event.getActionCommand().equals(EDefinitionAction.ENUMERATION.toString())) {
 626  0
                         insertText("\\begin{enumerate}\n\\item ", "\n\\end{enumerate}");
 627  0
                 } else if (event.getActionCommand().equals(EDefinitionAction.DESCRIPTION.toString())) {
 628  0
                         insertText("\\begin{description}\n\\item[", "]\n\\end{description}");
 629  0
                 } else if (event.getActionCommand().equals(EDefinitionAction.CODE.toString())) {
 630  0
                         insertText("\\begin{verbatim}\n", "\n\\end{verbatim}");
 631  0
                 } else if (event.getActionCommand().equals(EDefinitionAction.CODE_WHITE_SPACE.toString())) {
 632  0
                         insertText("\\begin{verbatim*}\n", "\n\\end{verbatim*}");
 633  0
                 } else if (event.getActionCommand().equals(EDefinitionAction.EMBEDDED_CODE.toString())) {
 634  0
                         insertText("\\verb|", "|");
 635  0
                 } else if (event.getActionCommand().equals(EDefinitionAction.EMBEDDED_CODE_WHITE_SPACE.toString())) {
 636  0
                         insertText("\\verb*|", "|");
 637  0
                 } else if (event.getActionCommand().equals(EDefinitionAction.EMBEDDED_FORMULA.toString())) {
 638  0
                         insertText("$", "$");
 639  0
                 } else if (event.getActionCommand().equals(EDefinitionAction.FORMULA.toString())) {
 640  0
                         insertText("\\[\n", "\n\\]");
 641  0
                 } else if (event.getActionCommand().equals(EDefinitionAction.ENUMERATED_FORMULA.toString())) {
 642  0
                         insertText("\\begin{equation}\n", "\n\\end{equation}");
 643  0
                 } else if (event.getActionCommand().equals(EDefinitionAction.EQUATION_ARRAY.toString())) {
 644  0
                         insertText("\\begin{align}\n", "\n\\end{align}");
 645  0
                 } else if (event.getActionCommand().equals(EDefinitionAction.SHORT_QUOTATATION.toString())) {
 646  0
                         insertText("\\begin{quote}\n", "\n\\end{quote}");
 647  0
                 } else if (event.getActionCommand().equals(EDefinitionAction.QUOTATION.toString())) {
 648  0
                         insertText("\\begin{quotation}\n", "\n\\end{quotation}");
 649  0
                 } else if (event.getActionCommand().equals(EDefinitionAction.VERSE.toString())) {
 650  0
                         insertText("\\begin{verse}\n", "\n\\end{verse}");
 651  0
                 } else if (event.getActionCommand().equals(EDefinitionAction.ROMAN.toString())) {
 652  0
                         insertText("\\rmfamily", "");
 653  0
                 } else if (event.getActionCommand().equals(EDefinitionAction.SANS_SERIF.toString())) {
 654  0
                         insertText("\\sffamily", "");
 655  0
                 } else if (event.getActionCommand().equals(EDefinitionAction.TYPEWRITER.toString())) {
 656  0
                         insertText("\\ttfamily", "");
 657  0
                 } else if (event.getActionCommand().equals(EDefinitionAction.VERTICAL.toString())) {
 658  0
                         insertText("\\upshape", "");
 659  0
                 } else if (event.getActionCommand().equals(EDefinitionAction.ITALIC.toString())) {
 660  0
                         insertText("\\itshape", "");
 661  0
                 } else if (event.getActionCommand().equals(EDefinitionAction.SLANTED.toString())) {
 662  0
                         insertText("\\slshape", "");
 663  0
                 } else if (event.getActionCommand().equals(EDefinitionAction.SMALL_CAPS.toString())) {
 664  0
                         insertText("\\scshape", "");
 665  0
                 } else if (event.getActionCommand().equals(EDefinitionAction.MEDIUM.toString())) {
 666  0
                         insertText("\\mdseries", "");
 667  0
                 } else if (event.getActionCommand().equals(EDefinitionAction.BOLD.toString())) {
 668  0
                         insertText("\\bfseries", "");
 669  0
                 } else if (event.getActionCommand().equals(EDefinitionAction.SHOW_BIB_EDITOR.toString())) {
 670  0
                         new BibTeXItemsFrame(Config.getInstance().getBibTeXFile());
 671  
                 }
 672  0
         }
 673  
         
 674  
 
 675  
         private void setDefintionEnabled(boolean enabled) {
 676  0
                 mDefinitionTextPane.setEnabled(enabled);
 677  0
                 mMenuBar.setVisible(enabled);
 678  0
         }
 679  
 
 680  0
         private class DefinitionTextPaneMouseListener extends MouseAdapter {
 681  
                 @Override
 682  
                 public void mousePressed(MouseEvent event) {
 683  0
                         maybeShowPopup(event);
 684  0
                 }
 685  
 
 686  
                 @Override
 687  
                 public void mouseReleased(MouseEvent event) {
 688  0
                         maybeShowPopup(event);
 689  0
                 }
 690  
                 
 691  
                 private void maybeShowPopup(MouseEvent event) {
 692  0
                 if (event.isPopupTrigger() && mDefinitionTextPane.isEnabled()) {
 693  0
                         getPopUpMenu().show(event.getComponent(), event.getX(), event.getY());
 694  
                 }
 695  0
             }
 696  
         }
 697  
 }