//# 0 errors, 62 messages
//#
/*
    //#SearchAction.java:1:1: class: com.dmdirc.addons.ui_swing.actions.SearchAction
    //#SearchAction.java:1:1: method: com.dmdirc.addons.ui_swing.actions.SearchAction.com.dmdirc.addons.ui_swing.actions.SearchAction__static_init
 * Copyright (c) 2006-2009 Chris Smith, Shane Mc Cormack, Gregory Holmes
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

package com.dmdirc.addons.ui_swing.actions;

import com.dmdirc.addons.ui_swing.components.SwingSearchBar;

import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;

/**
 * Opens and focuses the search bar.
 */
public final class SearchAction extends AbstractAction {
    
    /**
     * A version number for this class. It should be changed whenever the class
     * structure is changed (or anything else that would prevent serialized
     * objects being unserialized with the new class).
     */
    private static final long serialVersionUID = 2;
    
    /** Parent searchbar. */
    private final SwingSearchBar searchBar;
    
    /** 
     * Creates a new instance of SearchAction. 
     *
     * @param searchBar Parent searchbar.
     */
    public SearchAction(final SwingSearchBar searchBar) {
        super("Search");
    //#SearchAction.java:52: method: void com.dmdirc.addons.ui_swing.actions.SearchAction.com.dmdirc.addons.ui_swing.actions.SearchAction(SwingSearchBar)
    //#input(void com.dmdirc.addons.ui_swing.actions.SearchAction(SwingSearchBar)): searchBar
    //#input(void com.dmdirc.addons.ui_swing.actions.SearchAction(SwingSearchBar)): this
    //#output(void com.dmdirc.addons.ui_swing.actions.SearchAction(SwingSearchBar)): this.searchBar
    //#post(void com.dmdirc.addons.ui_swing.actions.SearchAction(SwingSearchBar)): this.searchBar == searchBar
    //#post(void com.dmdirc.addons.ui_swing.actions.SearchAction(SwingSearchBar)): init'ed(this.searchBar)
        
        this.searchBar = searchBar;
    }
    //#SearchAction.java:55: end of method: void com.dmdirc.addons.ui_swing.actions.SearchAction.com.dmdirc.addons.ui_swing.actions.SearchAction(SwingSearchBar)
    
    /**
     * {@inheritDoc}
     *
     * @param e Action event
     */
    @Override
    public void actionPerformed(final ActionEvent e) { 
        if (searchBar.isVisible()) {
    //#SearchAction.java:64: method: void com.dmdirc.addons.ui_swing.actions.SearchAction.actionPerformed(ActionEvent)
    //#SearchAction.java:64: Warning: method not available - call not analyzed
    //#    call on bool com.dmdirc.addons.ui_swing.components.SwingSearchBar:isVisible()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.actions.SearchAction
    //#    method: void actionPerformed(ActionEvent)
    //#    unanalyzed callee: bool com.dmdirc.addons.ui_swing.components.SwingSearchBar:isVisible()
    //#input(void actionPerformed(ActionEvent)): "?"._tainted
    //#input(void actionPerformed(ActionEvent)): "Do you want to continue searching from the "._tainted
    //#input(void actionPerformed(ActionEvent)): "beginning"._tainted
    //#input(void actionPerformed(ActionEvent)): "end"._tainted
    //#input(void actionPerformed(ActionEvent)): com/dmdirc/addons/ui_swing/components/SwingSearchBar.com.dmdirc.ui.interfaces.SearchBar$Direction.UP
    //#input(void actionPerformed(ActionEvent)): this
    //#input(void actionPerformed(ActionEvent)): this.searchBar
    //#input(void actionPerformed(ActionEvent)): this.searchBar.caseCheck
    //#input(void actionPerformed(ActionEvent)): this.searchBar.line
    //#input(void actionPerformed(ActionEvent)): this.searchBar.parent
    //#input(void actionPerformed(ActionEvent)): this.searchBar.parentWindow
    //#input(void actionPerformed(ActionEvent)): this.searchBar.searchBox
    //#output(void actionPerformed(ActionEvent)): this.searchBar.line
    //#pre[3] (void actionPerformed(ActionEvent)): this.searchBar != null
    //#pre[1] (void actionPerformed(ActionEvent)): (soft) init'ed(this.searchBar.line)
    //#pre[4] (void actionPerformed(ActionEvent)): (soft) this.searchBar.caseCheck != null
    //#pre[5] (void actionPerformed(ActionEvent)): (soft) this.searchBar.parent != null
    //#pre[6] (void actionPerformed(ActionEvent)): (soft) init'ed(this.searchBar.parentWindow)
    //#pre[7] (void actionPerformed(ActionEvent)): (soft) this.searchBar.searchBox != null
    //#post(void actionPerformed(ActionEvent)): init'ed(this.searchBar.line)
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:javax.swing.SwingUtilities:invokeLater
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:javax.swing.JTextField:getText
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:javax.swing.JCheckBox:isSelected
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:com.dmdirc.addons.ui_swing.components.frames.TextFrame:getTextPane
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:com.dmdirc.addons.ui_swing.textpane.TextPane:getDocument
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:com.dmdirc.addons.ui_swing.textpane.IRCDocumentSearcher
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:com.dmdirc.addons.ui_swing.textpane.TextPane:getSelectedRange
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:com.dmdirc.addons.ui_swing.textpane.IRCDocumentSearcher:setPosition
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:com.dmdirc.addons.ui_swing.textpane.IRCDocumentSearcher:searchUp
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:com.dmdirc.addons.ui_swing.textpane.IRCDocumentSearcher:searchDown
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:com.dmdirc.addons.ui_swing.textpane.LinePosition:getEndLine
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:com.dmdirc.addons.ui_swing.textpane.LinePosition:getEndPos
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:com.dmdirc.addons.ui_swing.textpane.LinePosition:getStartLine
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:java.lang.StringBuilder
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:java.lang.StringBuilder:append
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:java.lang.StringBuilder:toString
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:javax.swing.JOptionPane:showConfirmDialog
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:com.dmdirc.addons.ui_swing.textpane.TextPane:setScrollBarPosition
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:com.dmdirc.addons.ui_swing.textpane.TextPane:setSelectedTexT
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:com.dmdirc.ui.messages.ColourManager:getColour
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:javax.swing.JTextField:setBackground
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:com.dmdirc.addons.ui_swing.textpane.TextPane:getLastVisibleLine
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:java.lang.String:isEmpty
    //#test_vector(void actionPerformed(ActionEvent)): com.dmdirc.addons.ui_swing.components.SwingSearchBar:isVisible(...)@64: {0}, {1}
            searchBar.getFocus();
            searchBar.search(searchBar.getSearchPhrase(), searchBar.isCaseSensitive());
        } else {
            searchBar.open();
        }
    } 
    //#SearchAction.java:70: end of method: void com.dmdirc.addons.ui_swing.actions.SearchAction.actionPerformed(ActionEvent)
    
}
    //#output(com.dmdirc.addons.ui_swing.actions.SearchAction__static_init): __Descendant_Table[com/dmdirc/addons/ui_swing/actions/SearchAction]
    //#output(com.dmdirc.addons.ui_swing.actions.SearchAction__static_init): __Dispatch_Table.actionPerformed(Ljava/awt/event/ActionEvent;)V
    //#post(com.dmdirc.addons.ui_swing.actions.SearchAction__static_init): __Descendant_Table[com/dmdirc/addons/ui_swing/actions/SearchAction] == &__Dispatch_Table
    //#post(com.dmdirc.addons.ui_swing.actions.SearchAction__static_init): __Dispatch_Table.actionPerformed(Ljava/awt/event/ActionEvent;)V == &actionPerformed
    //#SearchAction.java:: end of method: com.dmdirc.addons.ui_swing.actions.SearchAction.com.dmdirc.addons.ui_swing.actions.SearchAction__static_init
    //#SearchAction.java:: end of class: com.dmdirc.addons.ui_swing.actions.SearchAction
