//# 0 errors, 70 messages
//#
/*
    //#PopupCommand.java:1:1: class: com.dmdirc.addons.systray.PopupCommand
    //#PopupCommand.java:1:1: method: com.dmdirc.addons.systray.PopupCommand.com.dmdirc.addons.systray.PopupCommand__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.systray;

import com.dmdirc.Server;
import com.dmdirc.commandparser.CommandArguments;
import com.dmdirc.commandparser.CommandManager;
import com.dmdirc.commandparser.commands.ServerCommand;
import com.dmdirc.ui.interfaces.InputWindow;

/**
 * The /popup command allows the user to show a popup message from the system
 * tray icon.
 * @author chris
 */
public final class PopupCommand extends ServerCommand {
    
    /** The SystrayPlugin that we belong to. */
    private final SystrayPlugin parent;
    
    /**
     * Creates a new instance of PopupCommand.
     * @param newParent The plugin that this command belongs to
     */
    public PopupCommand(final SystrayPlugin newParent) {
        super();
    //#PopupCommand.java:46: method: void com.dmdirc.addons.systray.PopupCommand.com.dmdirc.addons.systray.PopupCommand(SystrayPlugin)
    //#PopupCommand.java:46: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.commandparser.commands.ServerCommand()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.systray.PopupCommand
    //#    method: void com.dmdirc.addons.systray.PopupCommand(SystrayPlugin)
    //#    unanalyzed callee: void com.dmdirc.commandparser.commands.ServerCommand()
    //#input(void com.dmdirc.addons.systray.PopupCommand(SystrayPlugin)): newParent
    //#input(void com.dmdirc.addons.systray.PopupCommand(SystrayPlugin)): this
    //#output(void com.dmdirc.addons.systray.PopupCommand(SystrayPlugin)): this.parent
    //#post(void com.dmdirc.addons.systray.PopupCommand(SystrayPlugin)): this.parent == newParent
    //#post(void com.dmdirc.addons.systray.PopupCommand(SystrayPlugin)): init'ed(this.parent)
        
        this.parent = newParent;
        
        CommandManager.registerCommand(this);
    //#PopupCommand.java:50: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.commandparser.CommandManager:registerCommand(Command)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.systray.PopupCommand
    //#    method: void com.dmdirc.addons.systray.PopupCommand(SystrayPlugin)
    //#    unanalyzed callee: void com.dmdirc.commandparser.CommandManager:registerCommand(Command)
    }
    //#PopupCommand.java:51: end of method: void com.dmdirc.addons.systray.PopupCommand.com.dmdirc.addons.systray.PopupCommand(SystrayPlugin)

    /**
     * Used to show a notification using this plugin.
     *
     * @param title Title of dialog if applicable
     * @param message Message to show
     * @return True if the notification was shown.
     */
    public boolean showPopup(final String title, final String message) {
        parent.notify(title, message);
    //#PopupCommand.java:61: method: bool com.dmdirc.addons.systray.PopupCommand.showPopup(String, String)
    //#input(bool showPopup(String, String)): com/dmdirc/addons/systray/SystrayPlugin.java.awt.TrayIcon$MessageType.NONE
    //#input(bool showPopup(String, String)): message
    //#input(bool showPopup(String, String)): this
    //#input(bool showPopup(String, String)): this.parent
    //#input(bool showPopup(String, String)): this.parent.icon
    //#input(bool showPopup(String, String)): title
    //#output(bool showPopup(String, String)): return_value
    //#pre[3] (bool showPopup(String, String)): this.parent != null
    //#pre[4] (bool showPopup(String, String)): this.parent.icon != null
    //#post(bool showPopup(String, String)): return_value == 1
    //#unanalyzed(bool showPopup(String, String)): Effects-of-calling:com.dmdirc.ui.messages.Styliser:stipControlCodes
    //#unanalyzed(bool showPopup(String, String)): Effects-of-calling:java.awt.TrayIcon:displayMessage
        return true;
    //#PopupCommand.java:62: end of method: bool com.dmdirc.addons.systray.PopupCommand.showPopup(String, String)
    }

    /** {@inheritDoc} */
    @Override
    public void execute(final InputWindow origin, final Server server,
            final boolean isSilent, final CommandArguments args) {
        showPopup("DMDirc", args.getArgumentsAsString());
    //#PopupCommand.java:69: method: void com.dmdirc.addons.systray.PopupCommand.execute(InputWindow, Server, bool, CommandArguments)
    //#PopupCommand.java:69: Warning: method not available - call not analyzed
    //#    call on String com.dmdirc.commandparser.CommandArguments:getArgumentsAsString()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.systray.PopupCommand
    //#    method: void execute(InputWindow, Server, bool, CommandArguments)
    //#    unanalyzed callee: String com.dmdirc.commandparser.CommandArguments:getArgumentsAsString()
    //#input(void execute(InputWindow, Server, bool, CommandArguments)): args
    //#input(void execute(InputWindow, Server, bool, CommandArguments)): com/dmdirc/addons/systray/SystrayPlugin.java.awt.TrayIcon$MessageType.NONE
    //#input(void execute(InputWindow, Server, bool, CommandArguments)): this
    //#input(void execute(InputWindow, Server, bool, CommandArguments)): this.parent
    //#input(void execute(InputWindow, Server, bool, CommandArguments)): this.parent.icon
    //#pre[1] (void execute(InputWindow, Server, bool, CommandArguments)): args != null
    //#pre[3] (void execute(InputWindow, Server, bool, CommandArguments)): this.parent != null
    //#pre[4] (void execute(InputWindow, Server, bool, CommandArguments)): this.parent.icon != null
    //#unanalyzed(void execute(InputWindow, Server, bool, CommandArguments)): Effects-of-calling:com.dmdirc.ui.messages.Styliser:stipControlCodes
    //#unanalyzed(void execute(InputWindow, Server, bool, CommandArguments)): Effects-of-calling:java.awt.TrayIcon:displayMessage
    }
    //#PopupCommand.java:70: end of method: void com.dmdirc.addons.systray.PopupCommand.execute(InputWindow, Server, bool, CommandArguments)

    /** {@inheritDoc} */
    @Override
    public String getName() {
        return "popup";
    //#PopupCommand.java:75: method: String com.dmdirc.addons.systray.PopupCommand.getName()
    //#output(String getName()): return_value
    //#post(String getName()): return_value == &"popup"
    //#PopupCommand.java:75: end of method: String com.dmdirc.addons.systray.PopupCommand.getName()
    }

    /** {@inheritDoc} */
    @Override
    public boolean showInHelp() {
        return true;
    //#PopupCommand.java:81: method: bool com.dmdirc.addons.systray.PopupCommand.showInHelp()
    //#output(bool showInHelp()): return_value
    //#post(bool showInHelp()): return_value == 1
    //#PopupCommand.java:81: end of method: bool com.dmdirc.addons.systray.PopupCommand.showInHelp()
    }

    /** {@inheritDoc} */
    @Override
    public String getHelp() {
        return "popup <message> - shows the message as a system tray popup";
    //#PopupCommand.java:87: method: String com.dmdirc.addons.systray.PopupCommand.getHelp()
    //#output(String getHelp()): return_value
    //#post(String getHelp()): return_value == &"popup <message> - shows the message as a system tray popup"
    //#PopupCommand.java:87: end of method: String com.dmdirc.addons.systray.PopupCommand.getHelp()
    }
    
    /** Unregisters this command from the CommandManager. */
    public void unregister() {
        CommandManager.unregisterCommand(this);
    //#PopupCommand.java:92: method: void com.dmdirc.addons.systray.PopupCommand.unregister()
    //#PopupCommand.java:92: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.commandparser.CommandManager:unregisterCommand(CommandInfo)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.systray.PopupCommand
    //#    method: void unregister()
    //#    unanalyzed callee: void com.dmdirc.commandparser.CommandManager:unregisterCommand(CommandInfo)
    //#input(void unregister()): this
    }
    //#PopupCommand.java:93: end of method: void com.dmdirc.addons.systray.PopupCommand.unregister()
    
}
    //#output(com.dmdirc.addons.systray.PopupCommand__static_init): __Descendant_Table[com/dmdirc/addons/systray/PopupCommand]
    //#output(com.dmdirc.addons.systray.PopupCommand__static_init): __Dispatch_Table.execute(Lcom/dmdirc/ui/interfaces/InputWindow;Lcom/dmdirc/Server;ZLcom/dmdirc/commandparser/CommandArguments;)V
    //#output(com.dmdirc.addons.systray.PopupCommand__static_init): __Dispatch_Table.getHelp()Ljava/lang/String;
    //#output(com.dmdirc.addons.systray.PopupCommand__static_init): __Dispatch_Table.getName()Ljava/lang/String;
    //#output(com.dmdirc.addons.systray.PopupCommand__static_init): __Dispatch_Table.showInHelp()Z
    //#output(com.dmdirc.addons.systray.PopupCommand__static_init): __Dispatch_Table.showPopup(Ljava/lang/String;Ljava/lang/String;)Z
    //#output(com.dmdirc.addons.systray.PopupCommand__static_init): __Dispatch_Table.unregister()V
    //#post(com.dmdirc.addons.systray.PopupCommand__static_init): __Descendant_Table[com/dmdirc/addons/systray/PopupCommand] == &__Dispatch_Table
    //#post(com.dmdirc.addons.systray.PopupCommand__static_init): __Dispatch_Table.execute(Lcom/dmdirc/ui/interfaces/InputWindow;Lcom/dmdirc/Server;ZLcom/dmdirc/commandparser/CommandArguments;)V == &execute
    //#post(com.dmdirc.addons.systray.PopupCommand__static_init): __Dispatch_Table.getHelp()Ljava/lang/String; == &getHelp
    //#post(com.dmdirc.addons.systray.PopupCommand__static_init): __Dispatch_Table.getName()Ljava/lang/String; == &getName
    //#post(com.dmdirc.addons.systray.PopupCommand__static_init): __Dispatch_Table.showInHelp()Z == &showInHelp
    //#post(com.dmdirc.addons.systray.PopupCommand__static_init): __Dispatch_Table.showPopup(Ljava/lang/String;Ljava/lang/String;)Z == &showPopup
    //#post(com.dmdirc.addons.systray.PopupCommand__static_init): __Dispatch_Table.unregister()V == &unregister
    //#PopupCommand.java:: end of method: com.dmdirc.addons.systray.PopupCommand.com.dmdirc.addons.systray.PopupCommand__static_init
    //#PopupCommand.java:: end of class: com.dmdirc.addons.systray.PopupCommand
