Search in sources :

Example 1 with ProjectLayout

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

the class ProjectLayoutGroup method createControl.

public Control createControl(Composite parent) {
    Group group = new Group(parent, SWT.NONE);
    group.setText(groupTitle);
    group.setLayout(new GridLayout(Math.max(4, ProjectLayout.values().length), true));
    SelectionListener radioListener = new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            for (Button button : layoutChoices) {
                if (button.getSelection()) {
                    assert (button.getData() instanceof ProjectLayout);
                    chosenProjectLayout = (ProjectLayout) button.getData();
                    return;
                }
            }
        }
    };
    for (ProjectLayout projectLayout : ProjectLayout.values()) {
        ProjectPaths projectPaths = ProjectPaths.DEFAULT;
        final Button radioButton = new Button(group, SWT.RADIO);
        radioButton.setText(projectPaths.getTitle());
        radioButton.setData(projectLayout);
        radioButton.setSelection(this.chosenProjectLayout == projectLayout);
        radioButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
        radioButton.setToolTipText(projectPaths.getToolTip());
        radioButton.addSelectionListener(radioListener);
        layoutChoices.add(radioButton);
    }
    return group;
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) ProjectLayout(org.bndtools.api.ProjectLayout) ProjectPaths(org.bndtools.api.ProjectPaths) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) GridData(org.eclipse.swt.layout.GridData) SelectionListener(org.eclipse.swt.events.SelectionListener)

Aggregations

ProjectLayout (org.bndtools.api.ProjectLayout)1 ProjectPaths (org.bndtools.api.ProjectPaths)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 SelectionListener (org.eclipse.swt.events.SelectionListener)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Button (org.eclipse.swt.widgets.Button)1 Group (org.eclipse.swt.widgets.Group)1