//# 0 errors, 99 messages
//#
/*
    //#InputTextFramePasteAction.java:1:1: class: com.dmdirc.addons.ui_swing.actions.InputTextFramePasteAction
    //#InputTextFramePasteAction.java:1:1: method: com.dmdirc.addons.ui_swing.actions.InputTextFramePasteAction.com.dmdirc.addons.ui_swing.actions.InputTextFramePasteAction__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.frames.InputTextFrame;

import java.awt.Toolkit;
import java.awt.datatransfer.DataFlavor;
import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;

/**
 * Paste action for input frames.
 */
public final class InputTextFramePasteAction 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 = 1;
    /** Text component to be acted upon. */
    private final InputTextFrame inputFrame;

    /**
     * Instantiates a new paste action.
     *
     * @param inputFrame Component to be acted upon
     */
    public InputTextFramePasteAction(final InputTextFrame inputFrame) {
        super("Paste");
    //#InputTextFramePasteAction.java:53: method: void com.dmdirc.addons.ui_swing.actions.InputTextFramePasteAction.com.dmdirc.addons.ui_swing.actions.InputTextFramePasteAction(InputTextFrame)
    //#input(void com.dmdirc.addons.ui_swing.actions.InputTextFramePasteAction(InputTextFrame)): inputFrame
    //#input(void com.dmdirc.addons.ui_swing.actions.InputTextFramePasteAction(InputTextFrame)): this
    //#output(void com.dmdirc.addons.ui_swing.actions.InputTextFramePasteAction(InputTextFrame)): this.inputFrame
    //#post(void com.dmdirc.addons.ui_swing.actions.InputTextFramePasteAction(InputTextFrame)): this.inputFrame == inputFrame
    //#post(void com.dmdirc.addons.ui_swing.actions.InputTextFramePasteAction(InputTextFrame)): init'ed(this.inputFrame)

        this.inputFrame = inputFrame;
    }
    //#InputTextFramePasteAction.java:56: end of method: void com.dmdirc.addons.ui_swing.actions.InputTextFramePasteAction.com.dmdirc.addons.ui_swing.actions.InputTextFramePasteAction(InputTextFrame)

    /** 
     * {@inheritDoc}
     * 
     * @param e Action event
     */
    @Override
    public void actionPerformed(final ActionEvent e) {
        inputFrame.doPaste();
    //#InputTextFramePasteAction.java:65: method: void com.dmdirc.addons.ui_swing.actions.InputTextFramePasteAction.actionPerformed(ActionEvent)
    //#InputTextFramePasteAction.java:65: Warning: suspicious precondition
    //#    The precondition for this.inputFrame.__Tag is not a contiguous range of values
    //#    severity: SUPPRESSED
    //#    class: com.dmdirc.addons.ui_swing.actions.InputTextFramePasteAction
    //#    method: void actionPerformed(ActionEvent)
    //#    suspicious precondition index: [3]
    //#input(void actionPerformed(ActionEvent)): "Unable to get clipboard contents: "._tainted
    //#input(void actionPerformed(ActionEvent)): com/dmdirc/addons/ui_swing/UIUtilities.com.dmdirc.logger.ErrorLevel.HIGH
    //#input(void actionPerformed(ActionEvent)): com/dmdirc/addons/ui_swing/components/SwingInputField.__Descendant_Table[com/dmdirc/addons/ui_swing/components/SwingInputField]
    //#input(void actionPerformed(ActionEvent)): com/dmdirc/addons/ui_swing/components/SwingInputField.__Descendant_Table[others]
    //#input(void actionPerformed(ActionEvent)): com/dmdirc/addons/ui_swing/components/SwingInputField.__Dispatch_Table.getCaretPosition()I
    //#input(void actionPerformed(ActionEvent)): com/dmdirc/addons/ui_swing/components/SwingInputField.__Dispatch_Table.getText()Ljava/lang/String;
    //#input(void actionPerformed(ActionEvent)): com/dmdirc/addons/ui_swing/components/SwingInputField.__Dispatch_Table.replaceSelection(Ljava/lang/String;)V
    //#input(void actionPerformed(ActionEvent)): com/dmdirc/addons/ui_swing/components/SwingInputField.__Dispatch_Table.setText(Ljava/lang/String;)V
    //#input(void actionPerformed(ActionEvent)): com/dmdirc/addons/ui_swing/components/frames/ChannelFrame.__Dispatch_Table.doPaste()V
    //#input(void actionPerformed(ActionEvent)): com/dmdirc/addons/ui_swing/components/frames/ChannelFrame.__Dispatch_Table.doPaste(Ljava/lang/String;)V
    //#input(void actionPerformed(ActionEvent)): com/dmdirc/addons/ui_swing/components/frames/ChannelFrame.__Dispatch_Table.getContainer()Lcom/dmdirc/WritableFrameContainer;
    //#input(void actionPerformed(ActionEvent)): com/dmdirc/addons/ui_swing/components/frames/CustomInputFrame.__Dispatch_Table.doPaste()V
    //#input(void actionPerformed(ActionEvent)): com/dmdirc/addons/ui_swing/components/frames/CustomInputFrame.__Dispatch_Table.doPaste(Ljava/lang/String;)V
    //#input(void actionPerformed(ActionEvent)): com/dmdirc/addons/ui_swing/components/frames/CustomInputFrame.__Dispatch_Table.getContainer()Lcom/dmdirc/WritableFrameContainer;
    //#input(void actionPerformed(ActionEvent)): com/dmdirc/addons/ui_swing/components/frames/InputTextFrame.__Descendant_Table[com/dmdirc/addons/ui_swing/components/frames/ChannelFrame]
    //#input(void actionPerformed(ActionEvent)): com/dmdirc/addons/ui_swing/components/frames/InputTextFrame.__Descendant_Table[com/dmdirc/addons/ui_swing/components/frames/CustomInputFrame]
    //#input(void actionPerformed(ActionEvent)): com/dmdirc/addons/ui_swing/components/frames/InputTextFrame.__Descendant_Table[com/dmdirc/addons/ui_swing/components/frames/InputTextFrame]
    //#input(void actionPerformed(ActionEvent)): com/dmdirc/addons/ui_swing/components/frames/InputTextFrame.__Descendant_Table[com/dmdirc/addons/ui_swing/components/frames/QueryFrame]
    //#input(void actionPerformed(ActionEvent)): com/dmdirc/addons/ui_swing/components/frames/InputTextFrame.__Descendant_Table[com/dmdirc/addons/ui_swing/components/frames/ServerFrame]
    //#input(void actionPerformed(ActionEvent)): com/dmdirc/addons/ui_swing/components/frames/InputTextFrame.__Descendant_Table[others]
    //#input(void actionPerformed(ActionEvent)): com/dmdirc/addons/ui_swing/components/frames/InputTextFrame.__Dispatch_Table.doPaste()V
    //#input(void actionPerformed(ActionEvent)): com/dmdirc/addons/ui_swing/components/frames/InputTextFrame.__Dispatch_Table.doPaste(Ljava/lang/String;)V
    //#input(void actionPerformed(ActionEvent)): com/dmdirc/addons/ui_swing/components/frames/InputTextFrame.__Dispatch_Table.getContainer()Lcom/dmdirc/WritableFrameContainer;
    //#input(void actionPerformed(ActionEvent)): com/dmdirc/addons/ui_swing/components/frames/InputTextFrame.com.dmdirc.logger.ErrorLevel.LOW
    //#input(void actionPerformed(ActionEvent)): com/dmdirc/addons/ui_swing/components/frames/InputTextFrame.java.awt.datatransfer.DataFlavor.stringFlavor
    //#input(void actionPerformed(ActionEvent)): com/dmdirc/addons/ui_swing/components/frames/QueryFrame.__Dispatch_Table.doPaste()V
    //#input(void actionPerformed(ActionEvent)): com/dmdirc/addons/ui_swing/components/frames/QueryFrame.__Dispatch_Table.doPaste(Ljava/lang/String;)V
    //#input(void actionPerformed(ActionEvent)): com/dmdirc/addons/ui_swing/components/frames/QueryFrame.__Dispatch_Table.getContainer()Lcom/dmdirc/WritableFrameContainer;
    //#input(void actionPerformed(ActionEvent)): com/dmdirc/addons/ui_swing/components/frames/ServerFrame.__Dispatch_Table.doPaste()V
    //#input(void actionPerformed(ActionEvent)): com/dmdirc/addons/ui_swing/components/frames/ServerFrame.__Dispatch_Table.doPaste(Ljava/lang/String;)V
    //#input(void actionPerformed(ActionEvent)): com/dmdirc/addons/ui_swing/components/frames/ServerFrame.__Dispatch_Table.getContainer()Lcom/dmdirc/WritableFrameContainer;
    //#input(void actionPerformed(ActionEvent)): this
    //#input(void actionPerformed(ActionEvent)): this.inputFrame
    //#input(void actionPerformed(ActionEvent)): this.inputFrame.__Tag
    //#input(void actionPerformed(ActionEvent)): this.inputFrame.inputField
    //#input(void actionPerformed(ActionEvent)): this.inputFrame.inputField.__Tag
    //#pre[2] (void actionPerformed(ActionEvent)): this.inputFrame != null
    //#pre[3] (void actionPerformed(ActionEvent)): this.inputFrame.__Tag in {com/dmdirc/addons/ui_swing/components/frames/ChannelFrame, com/dmdirc/addons/ui_swing/components/frames/CustomInputFrame, com/dmdirc/addons/ui_swing/components/frames/InputTextFrame, com/dmdirc/addons/ui_swing/components/frames/QueryFrame, com/dmdirc/addons/ui_swing/components/frames/ServerFrame}
    //#pre[4] (void actionPerformed(ActionEvent)): (soft) this.inputFrame.inputField != null
    //#pre[5] (void actionPerformed(ActionEvent)): (soft) this.inputFrame.inputField.__Tag == com/dmdirc/addons/ui_swing/components/SwingInputField
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:com.dmdirc.addons.ui_swing.components.frames.TextFrame:getContainer
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:java.lang.String:replace
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:java.lang.String:split
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:com.dmdirc.addons.ui_swing.components.frames.InputTextFrame:getConfigManager
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:java.awt.Toolkit:getDefaultToolkit
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:java.awt.Toolkit:getSystemClipboard
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:java.awt.datatransfer.Clipboard:isDataFlavorAvailable
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:java.awt.datatransfer.Clipboard:getData
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:doPaste
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:java.lang.Throwable:__curr_excep_obj
    //#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.io.IOException:getMessage
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:java.lang.StringBuilder:toString
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:com.dmdirc.logger.Logger:userError
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:com.dmdirc.logger.Logger:appError
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:javax.swing.SwingUtilities:isEventDispatchThread
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:javax.swing.SwingUtilities:invokeAndWait
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:com.dmdirc.util.ReturnableThread:run
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:com.dmdirc.util.ReturnableThread:getObject
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:java.lang.Integer:intValue
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:com.dmdirc.util.ReturnableThread
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:java.lang.String:substring
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:com.dmdirc.config.ConfigManager:getOptionInt
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:com.dmdirc.WritableFrameContainer:getNumLines
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:com.dmdirc.addons.ui_swing.components.frames.InputTextFrame:getController
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:com.dmdirc.addons.ui_swing.dialogs.paste.PasteDialog
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:com.dmdirc.addons.ui_swing.dialogs.paste.PasteDialog:setVisible
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:java.lang.Runnable:run
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:javax.swing.SwingUtilities:invokeLater
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:com.dmdirc.WritableFrameContainer:sendLine
    }
    //#InputTextFramePasteAction.java:66: end of method: void com.dmdirc.addons.ui_swing.actions.InputTextFramePasteAction.actionPerformed(ActionEvent)

    /** {@inheritDoc} */
    @Override
    public boolean isEnabled() {
        try {
            return Toolkit.getDefaultToolkit().getSystemClipboard().
    //#InputTextFramePasteAction.java:72: method: bool com.dmdirc.addons.ui_swing.actions.InputTextFramePasteAction.isEnabled()
    //#input(bool isEnabled()): java.awt.datatransfer.DataFlavor.stringFlavor
    //#output(bool isEnabled()): return_value
    //#presumption(bool isEnabled()): java.awt.Toolkit:getDefaultToolkit(...)@72 != null
    //#presumption(bool isEnabled()): java.awt.Toolkit:getSystemClipboard(...)@72 != null
    //#presumption(bool isEnabled()): init'ed(java.awt.datatransfer.DataFlavor.stringFlavor)
    //#post(bool isEnabled()): init'ed(return_value)
                    isDataFlavorAvailable(DataFlavor.stringFlavor);
        } catch (IllegalStateException ex) {
            return false;
    //#InputTextFramePasteAction.java:75: end of method: bool com.dmdirc.addons.ui_swing.actions.InputTextFramePasteAction.isEnabled()
        }
    }
}
    //#output(com.dmdirc.addons.ui_swing.actions.InputTextFramePasteAction__static_init): __Descendant_Table[com/dmdirc/addons/ui_swing/actions/InputTextFramePasteAction]
    //#output(com.dmdirc.addons.ui_swing.actions.InputTextFramePasteAction__static_init): __Dispatch_Table.actionPerformed(Ljava/awt/event/ActionEvent;)V
    //#output(com.dmdirc.addons.ui_swing.actions.InputTextFramePasteAction__static_init): __Dispatch_Table.isEnabled()Z
    //#post(com.dmdirc.addons.ui_swing.actions.InputTextFramePasteAction__static_init): __Descendant_Table[com/dmdirc/addons/ui_swing/actions/InputTextFramePasteAction] == &__Dispatch_Table
    //#post(com.dmdirc.addons.ui_swing.actions.InputTextFramePasteAction__static_init): __Dispatch_Table.actionPerformed(Ljava/awt/event/ActionEvent;)V == &actionPerformed
    //#post(com.dmdirc.addons.ui_swing.actions.InputTextFramePasteAction__static_init): __Dispatch_Table.isEnabled()Z == &isEnabled
    //#InputTextFramePasteAction.java:: end of method: com.dmdirc.addons.ui_swing.actions.InputTextFramePasteAction.com.dmdirc.addons.ui_swing.actions.InputTextFramePasteAction__static_init
    //#InputTextFramePasteAction.java:: end of class: com.dmdirc.addons.ui_swing.actions.InputTextFramePasteAction
