Search in sources :

Example 6 with NamedPlugin

use of org.bndtools.api.NamedPlugin in project bndtools by bndtools.

the class GeneratedResourcesPreferencePage method createVersionControlGroup.

private Control createVersionControlGroup(Composite composite) {
    Collection<NamedPlugin> allPluginsInformation = versionControlIgnoresManager.getAllPluginsInformation();
    if (allPluginsInformation == null || allPluginsInformation.isEmpty()) {
        Label lbl = new Label(composite, SWT.None);
        lbl.setText("No version control system support detected");
        return lbl;
    }
    Group versionControlIgnoresMainGroup = new Group(composite, SWT.NONE);
    versionControlIgnoresMainGroup.setText(Messages.BndPreferencePage_versionControlIgnoresGroup_text);
    final Button btnVersionControlIgnoresCreate = new Button(versionControlIgnoresMainGroup, SWT.CHECK);
    btnVersionControlIgnoresCreate.setText(Messages.BndPreferencePage_versionControlIgnoresCreate_text);
    btnVersionControlIgnoresCreate.setSelection(versionControlIgnoresCreate);
    Group versionControlIgnoresGroup = new Group(versionControlIgnoresMainGroup, SWT.NONE);
    final Set<Button> versionControlIgnoresGroupButtons = new HashSet<Button>();
    for (NamedPlugin info : allPluginsInformation) {
        final String pluginName = info.getName();
        final Button btnVersionControlIgnoresPlugin = new Button(versionControlIgnoresGroup, SWT.CHECK);
        versionControlIgnoresGroupButtons.add(btnVersionControlIgnoresPlugin);
        if (info.isDeprecated()) {
            btnVersionControlIgnoresPlugin.setText(pluginName + Messages.BndPreferencePage_namedPluginDeprecated_text);
        } else {
            btnVersionControlIgnoresPlugin.setText(pluginName);
        }
        Boolean checked = versionControlIgnoresPlugins.get(pluginName);
        if (checked == null) {
            checked = Boolean.FALSE;
            versionControlIgnoresPlugins.put(pluginName, checked);
        }
        btnVersionControlIgnoresPlugin.setSelection(checked.booleanValue());
        btnVersionControlIgnoresPlugin.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                versionControlIgnoresPlugins.put(pluginName, btnVersionControlIgnoresPlugin.getSelection());
                checkValid();
            }
        });
    }
    versionControlIgnoresGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    versionControlIgnoresGroup.setLayout(new GridLayout(Math.max(4, allPluginsInformation.size()), true));
    versionControlIgnoresMainGroup.setLayout(new GridLayout(1, true));
    btnVersionControlIgnoresCreate.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            versionControlIgnoresCreate = btnVersionControlIgnoresCreate.getSelection();
            for (Button button : versionControlIgnoresGroupButtons) {
                button.setEnabled(versionControlIgnoresCreate);
            }
            checkValid();
        }
    });
    return versionControlIgnoresMainGroup;
}
Also used : Group(org.eclipse.swt.widgets.Group) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) GridData(org.eclipse.swt.layout.GridData) NamedPlugin(org.bndtools.api.NamedPlugin) HashSet(java.util.HashSet)

Example 7 with NamedPlugin

use of org.bndtools.api.NamedPlugin in project bndtools by bndtools.

the class GeneratedResourcesPreferencePage method performOk.

@Override
public boolean performOk() {
    BndPreferences prefs = new BndPreferences();
    prefs.setEnableSubBundles(enableSubs);
    prefs.setNoAskPackageInfo(noAskPackageInfo);
    prefs.setUseAliasRequirements(useAliasRequirements);
    prefs.setHeadlessBuildCreate(headlessBuildCreate);
    Collection<NamedPlugin> pluginsInformation = headlessBuildManager.getAllPluginsInformation();
    if (pluginsInformation.size() > 0) {
        prefs.setHeadlessBuildPlugins(headlessBuildPlugins);
    }
    prefs.setVersionControlIgnoresCreate(versionControlIgnoresCreate);
    pluginsInformation = versionControlIgnoresManager.getAllPluginsInformation();
    if (pluginsInformation.size() > 0) {
        prefs.setVersionControlIgnoresPlugins(versionControlIgnoresPlugins);
    }
    return true;
}
Also used : BndPreferences(bndtools.preferences.BndPreferences) NamedPlugin(org.bndtools.api.NamedPlugin)

Aggregations

NamedPlugin (org.bndtools.api.NamedPlugin)7 HashSet (java.util.HashSet)3 BndPreferences (bndtools.preferences.BndPreferences)2 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)2 SelectionEvent (org.eclipse.swt.events.SelectionEvent)2 GridLayout (org.eclipse.swt.layout.GridLayout)2 Button (org.eclipse.swt.widgets.Button)2 Group (org.eclipse.swt.widgets.Group)2 Label (org.eclipse.swt.widgets.Label)2 Reference (org.osgi.service.component.annotations.Reference)2 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 GridData (org.eclipse.swt.layout.GridData)1