use of org.bndtools.api.NamedPlugin in project bndtools by bndtools.
the class GeneratedResourcesPreferencePage method init.
@Override
public void init(IWorkbench workbench) {
BndPreferences prefs = new BndPreferences();
enableSubs = prefs.getEnableSubBundles();
noAskPackageInfo = prefs.getNoAskPackageInfo();
useAliasRequirements = prefs.getUseAliasRequirements();
headlessBuildCreate = prefs.getHeadlessBuildCreate();
Collection<NamedPlugin> pluginsInformation = headlessBuildManager.getAllPluginsInformation();
if (pluginsInformation.size() > 0) {
headlessBuildPlugins.clear();
headlessBuildPlugins.putAll(prefs.getHeadlessBuildPlugins(pluginsInformation, false));
}
versionControlIgnoresCreate = prefs.getVersionControlIgnoresCreate();
pluginsInformation = versionControlIgnoresManager.getAllPluginsInformation();
if (pluginsInformation.size() > 0) {
versionControlIgnoresPlugins.clear();
versionControlIgnoresPlugins.putAll(prefs.getVersionControlIgnoresPlugins(versionControlIgnoresManager.getAllPluginsInformation(), false));
}
}
use of org.bndtools.api.NamedPlugin in project bndtools by bndtools.
the class VersionControlIgnoresManagerImpl method addPlugin.
@Reference(cardinality = ReferenceCardinality.AT_LEAST_ONE, policy = ReferencePolicy.DYNAMIC)
void addPlugin(VersionControlIgnoresPlugin plugin) {
if (plugin == null) {
return;
}
NamedPlugin pluginInformation = plugin.getInformation();
String name = pluginInformation.getName();
synchronized (plugins) {
plugins.put(name, plugin);
pluginsInformation.put(name, pluginInformation);
}
}
use of org.bndtools.api.NamedPlugin in project bndtools by bndtools.
the class HeadlessBuildManagerImpl method addPlugin.
@Reference(cardinality = ReferenceCardinality.AT_LEAST_ONE, policy = ReferencePolicy.DYNAMIC)
void addPlugin(HeadlessBuildPlugin plugin) {
if (plugin == null) {
return;
}
NamedPlugin pluginInformation = plugin.getInformation();
String name = pluginInformation.getName();
synchronized (plugins) {
plugins.put(name, plugin);
pluginsInformation.put(name, pluginInformation);
}
}
use of org.bndtools.api.NamedPlugin in project bndtools by bndtools.
the class BndPreferences method preferenceToMap.
private Map<String, Boolean> preferenceToMap(String preference, Collection<? extends NamedPlugin> allPluginsInformation, boolean onlyEnabled) {
List<String> names = null;
if (preference != null && !preference.isEmpty()) {
names = Arrays.asList(preference.split("\\|"));
}
boolean atLeastOneEnabled = false;
Map<String, Boolean> map = new TreeMap<String, Boolean>();
for (NamedPlugin info : allPluginsInformation) {
boolean enabled = (names == null) ? (info.isEnabledByDefault() && !info.isDeprecated()) : names.contains(info.getName());
map.put(info.getName(), enabled);
atLeastOneEnabled = atLeastOneEnabled || enabled;
}
if (!atLeastOneEnabled && (map.size() > 0)) {
for (String name : map.keySet()) {
map.put(name, Boolean.TRUE);
}
}
if (onlyEnabled) {
Set<String> pluginsToRemove = new HashSet<String>();
for (Map.Entry<String, Boolean> entry : map.entrySet()) {
if (!entry.getValue().booleanValue()) {
pluginsToRemove.add(entry.getKey());
}
}
for (String plugin : pluginsToRemove) {
map.remove(plugin);
}
}
return map;
}
use of org.bndtools.api.NamedPlugin in project bndtools by bndtools.
the class GeneratedResourcesPreferencePage method createHeadlessBuildSystemsGroup.
private Control createHeadlessBuildSystemsGroup(Composite parent) {
Collection<NamedPlugin> allPluginsInformation = headlessBuildManager.getAllPluginsInformation();
if (allPluginsInformation == null || allPluginsInformation.isEmpty()) {
Label lbl = new Label(parent, SWT.None);
lbl.setText("No headless build system support detected");
return lbl;
}
Group headlessMainGroup = new Group(parent, SWT.NONE);
headlessMainGroup.setText(Messages.BndPreferencePage_headlessGroup);
final Button btnHeadlessCreate = new Button(headlessMainGroup, SWT.CHECK);
btnHeadlessCreate.setText(Messages.BndPreferencePage_headlessCreate_text);
btnHeadlessCreate.setSelection(headlessBuildCreate);
final Group headlessGroup = new Group(headlessMainGroup, SWT.NONE);
final Set<Button> headlessGroupButtons = new HashSet<Button>();
for (NamedPlugin info : allPluginsInformation) {
final String pluginName = info.getName();
final Button btnHeadlessPlugin = new Button(headlessGroup, SWT.CHECK);
headlessGroupButtons.add(btnHeadlessPlugin);
if (info.isDeprecated()) {
btnHeadlessPlugin.setText(pluginName + Messages.BndPreferencePage_namedPluginDeprecated_text);
} else {
btnHeadlessPlugin.setText(pluginName);
}
Boolean checked = headlessBuildPlugins.get(pluginName);
if (checked == null) {
checked = Boolean.FALSE;
headlessBuildPlugins.put(pluginName, checked);
}
btnHeadlessPlugin.setSelection(checked.booleanValue());
btnHeadlessPlugin.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
headlessBuildPlugins.put(pluginName, Boolean.valueOf(btnHeadlessPlugin.getSelection()));
checkValid();
}
});
}
headlessGroup.setLayout(new GridLayout(Math.max(4, allPluginsInformation.size()), true));
headlessMainGroup.setLayout(new GridLayout(1, true));
btnHeadlessCreate.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
headlessBuildCreate = btnHeadlessCreate.getSelection();
for (Button button : headlessGroupButtons) {
button.setEnabled(headlessBuildCreate);
}
checkValid();
}
});
return headlessMainGroup;
}
Aggregations