Coverage Report - org.xmlhammer.gui.actions.FindAction
 
Classes in this File Line Coverage Branch Coverage Complexity
FindAction
69% 
0% 
1.5
 
 1  
 /*
 2  
  * $Id: FindAction.java,v 1.8 2007/07/04 19:42:49 edankert Exp $
 3  
  *
 4  
  * The contents of this file are subject to the Mozilla Public License 
 5  
  * Version 1.1 (the "License"); you may not use this file except in 
 6  
  * compliance with the License. You may obtain a copy of the License at 
 7  
  * http://www.mozilla.org/MPL/ 
 8  
  *
 9  
  * Software distributed under the License is distributed on an "AS IS" basis, 
 10  
  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 
 11  
  * for the specific language governing rights and limitations under the License.
 12  
  *
 13  
  * The Original Code is XML Hammer code. (org.xmlhammer.*)
 14  
  *
 15  
  * The Initial Developer of the Original Code is Edwin Dankert. Portions created 
 16  
  * by the Initial Developer are Copyright (C) 2005 - 2006 the Initial Developer. 
 17  
  * All Rights Reserved.
 18  
  *
 19  
  * Contributor(s): Edwin Dankert <edankert@gmail.com>
 20  
  */
 21  
 package org.xmlhammer.gui.actions;
 22  
 
 23  
 import java.awt.Toolkit;
 24  
 import java.awt.event.KeyEvent;
 25  
 
 26  
 import javax.swing.ImageIcon;
 27  
 import javax.swing.KeyStroke;
 28  
 
 29  
 import org.bounce.RunnableAction;
 30  
 import org.xmlhammer.gui.FindDialog;
 31  
 import org.xmlhammer.gui.XMLHammer;
 32  
 
 33  
 /**
 34  
  * An action that can be used to search contents.
 35  
  *
 36  
  * @version        $Revision: 1.8 $, $Date: 2007/07/04 19:42:49 $
 37  
  * @author Edwin Dankert <edankert@gmail.com>
 38  
  */
 39  
  public class FindAction extends RunnableAction {
 40  
          private static final long serialVersionUID = 5071286482617302382L;
 41  220
     private XMLHammer parent = null;
 42  220
     private FindDialog dialog = null;
 43  
         
 44  
          /**
 45  
          * The constructor for the action which allows for searching content.
 46  
          */
 47  
          public FindAction(XMLHammer parent) {
 48  220
                 super( "Find...");
 49  
                 
 50  220
                 putValue( MNEMONIC_KEY, new Integer( 'F'));
 51  220
                 putValue( ACCELERATOR_KEY, KeyStroke.getKeyStroke( KeyEvent.VK_F, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));
 52  220
                 putValue( SMALL_ICON, new ImageIcon( getClass().getResource( "/org/xmlhammer/gui/icons/etool16/search_src.gif")));
 53  220
                 putValue( SHORT_DESCRIPTION, "Find...");
 54  
                 
 55  220
         this.parent = parent;
 56  220
          }
 57  
          
 58  
         /**
 59  
          * The implementation of the search action, called 
 60  
          * after a user action.
 61  
          */
 62  
          public void run() {
 63  0
         if (dialog == null) {
 64  0
             dialog = new FindDialog(parent);
 65  
         }
 66  
         
 67  0
         dialog.setVisible(true);
 68  0
          }
 69  
 }