text = pluginId;
}
final String pluginUrl = FindBugsCustomPluginUtil.getAsString(plugin);
final boolean enabled = isEnabled(currentProject, plugin);
final AbstractButton checkbox = new JCheckBox();
checkbox.setEnabled(enabled);
checkbox.setBackground(PLUGIN_DESCRIPTION_BG_COLOR);
_component.add(checkbox,"1, 1, 1, 1, L, T");
final String longText = plugin.getDetailedDescription();
if (longText != null) {
checkbox.setToolTipText("<html>" + longText + "</html>");
}
checkbox.setSelected(isSelected(currentProject, plugin, userPlugin));
checkbox.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
if (checkbox.isSelected()) {
if (userPlugin) {
_preferences.addUserPlugin(pluginUrl, pluginId, true);
} else {
_preferences.addBundledPlugin(pluginId, true);
}
} else {
if (userPlugin) {
final String[] options = {
"Disable",
"Remove",
"Cancel"
};
final int answer = Messages.showDialog(checkbox, "Would you like to disable or remove the plugin?", "Disable or Remove", options, 0, Messages.getQuestionIcon());
if (0 == answer) {
_preferences.addUserPlugin(pluginUrl, pluginId, false);
} else if (1 == answer) {
_preferences.removeUserPlugin(pluginUrl);
} else {
// cancel ; restore
checkbox.setSelected(true);
}
} else {
_preferences.addBundledPlugin(pluginId, false);
}
}