001/**
002 * 
003 */
004package icy.gui.plugin;
005
006import icy.plugin.PluginDescriptor;
007import icy.plugin.PluginLauncher;
008import icy.resource.icon.IcyIcon;
009
010import java.awt.event.ActionEvent;
011import java.awt.event.ActionListener;
012
013import org.pushingpixels.flamingo.api.common.JCommandButton.CommandButtonKind;
014import org.pushingpixels.flamingo.api.ribbon.RibbonApplicationMenuEntrySecondary;
015
016/**
017 * @author Stephane
018 */
019public class PluginApplicationMenuEntrySecondary extends RibbonApplicationMenuEntrySecondary
020{
021    public PluginApplicationMenuEntrySecondary(PluginDescriptor plugin, String description, ActionListener action,
022            boolean alpha)
023    {
024        super(new IcyIcon(plugin.getIconAsImage(), alpha), description, action, CommandButtonKind.ACTION_ONLY);
025    }
026
027    public PluginApplicationMenuEntrySecondary(PluginDescriptor plugin, ActionListener action, boolean alpha)
028    {
029        super(new IcyIcon(plugin.getIconAsImage(), alpha), plugin.getName(), action, CommandButtonKind.ACTION_ONLY);
030    }
031
032    public PluginApplicationMenuEntrySecondary(PluginDescriptor plugin, String description, ActionListener action)
033    {
034        this(plugin, description, action, false);
035    }
036
037    public PluginApplicationMenuEntrySecondary(PluginDescriptor plugin, ActionListener action)
038    {
039        this(plugin, action, false);
040    }
041
042    public PluginApplicationMenuEntrySecondary(final PluginDescriptor plugin, String description)
043    {
044        this(plugin, description, new ActionListener()
045        {
046            @Override
047            public void actionPerformed(ActionEvent e)
048            {
049                PluginLauncher.start(plugin);
050            }
051        });
052    }
053
054    public PluginApplicationMenuEntrySecondary(final PluginDescriptor plugin)
055    {
056        this(plugin, plugin.getName());
057    }
058}