All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.alee.managers.plugin.data.PluginStatus Maven / Gradle / Ivy

The newest version!
/*
 * This file is part of WebLookAndFeel library.
 *
 * WebLookAndFeel library is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * WebLookAndFeel library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with WebLookAndFeel library.  If not, see .
 */

package com.alee.managers.plugin.data;

import com.alee.api.annotations.NotNull;
import com.alee.api.annotations.Nullable;
import com.alee.utils.swing.EnumLazyIconProvider;

import javax.swing.*;

/**
 * Available {@link com.alee.managers.plugin.Plugin} statuses.
 *
 * @author Mikle Garin
 * @see How to use PluginManager
 * @see com.alee.managers.plugin.PluginManager
 * @see com.alee.managers.plugin.Plugin
 */
public enum PluginStatus
{
    /**
     * Plugin was detected and waiting for further actions.
     */
    detected,

    /**
     * Plugin is being loaded.
     */
    loading,

    /**
     * Plugin successfully loaded.
     */
    loaded,

    /**
     * Plugin failed to load due to plugin class initialization exception.
     */
    failed;

    /**
     * Returns {@link PluginStatus} icon.
     *
     * @return {@link PluginStatus} icon
     */
    @NotNull
    public ImageIcon getIcon ()
    {
        return EnumLazyIconProvider.getIcon ( this, "icons/status/" );
    }

    /**
     * Returns {@link PluginStatus} text.
     *
     * @return {@link PluginStatus} text
     */
    @Nullable
    public String getText ()
    {
        final String text;
        switch ( this )
        {
            case loading:
                text = "Loading...";
                break;

            case loaded:
                text = "Loaded successfully";
                break;

            case failed:
                text = "Failed to load";
                break;

            default:
                text = null;
                break;
        }
        return text;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy