* Prepare a button for the popup panel for plugin general actions.
* @param m PluginGeneralActionsManipulator for the button
* @return JCommandButton for the manipulator
*/
private JCommandButton preparePluginGeneralActionsButton(final PluginGeneralActionsManipulator m) {
JCommandButton button = new JCommandButton(m.getName(), m.getIcon() != null ? ImageWrapperResizableIcon.getIcon(ImageUtilities.icon2Image(m.getIcon()), new Dimension(16, 16)) : null);//Convert icon to Image if it is not null
button.setDisplayState(CommandButtonDisplayState.BIG);
button.setCommandButtonKind(JCommandButton.CommandButtonKind.ACTION_ONLY);
if (m.getDescription() != null && !m.getDescription().isEmpty()) {
button.setToolTipText(m.getDescription());
}
if (m.canExecute()) {
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
DataLaboratoryHelper.getDefault().executeManipulator(m);
}
});
} else {
button.setEnabled(false);
}
return button;
}