package CH.ifa.draw.application;

import CH.ifa.draw.DrawPlugin;
import de.renew.draw.ui.ontology.AbstractCommand;
import de.renew.plugin.IPlugin;
import de.renew.plugin.PluginProperties;


/**
 * This command displays a status line message with the version of its
 * associated plugin.
 *
 * @deprecated This class is only for internal usage and will later be made private. Please use {@link de.renew.draw.ui.api.CommandApi#createVersionInfoCommand(IPlugin)} instead.
 * @author Lawrence Cabac
 */
@Deprecated
public class VersionInfoCommand extends AbstractCommand {
    IPlugin _plugin;

    /**
     * Creates an <code>VersionInfoCommand</code> for the given plugin.
     * @param plugin the plugin instance whose version is of interest.
     * @deprecated This constructor is only for internal usage and will later be made private. Please use {@link de.renew.draw.ui.api.CommandApi#createVersionInfoCommand(IPlugin)} instead.
     */
    @Deprecated
    public VersionInfoCommand(IPlugin plugin) {
        super("About  v " + plugin.getVersion());

        _plugin = plugin;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void execute() {
        DrawPlugin current = DrawPlugin.getCurrent();
        assert current != null;
        current.showStatus(_plugin.getLongVersion());
        System.out.println("\n");
        System.out.println(_plugin.getLongVersion());
        PluginProperties props = _plugin.getProperties();
        System.out.println("Compilation date is: " + props.getFilteredProperty("compile.date"));
        System.out.println("\n");
    }
}