protected Button[] createSubGroup(Composite parent, Button controlButton, final int style, final int[] flags, final String[] labels, final int[] uiFlags, boolean isVertical) {
protected Button[] createSubGroup(Composite parent, final Button controlButton, final int style, final int[] flags, final String[] labels, final int[] uiFlags, boolean isVertical) {
	protected Button[] createSubGroup(Composite parent, Button controlButton, final int style, final int[] flags, final String[] labels, final int[] uiFlags, boolean isVertical) {		Composite sub= new Composite(parent, SWT.NONE);		sub.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));		GridLayout layout= new GridLayout(isVertical?1:flags.length, false);		layout.marginHeight= MARGIN_SIZE;		layout.marginWidth= MARGIN_SIZE;		sub.setLayout(layout);		final Button[] buttons= new Button[flags.length];		for (int i= 0; i < buttons.length; i++) {			if (style == SWT.CHECK) {				buttons[i]= addCheckBox(sub, flags[i], labels[i]);			} else {				buttons[i]= addRadioButton(sub, flags[i], labels[i]);			}			if (i == 0 || isVertical) {				indent(buttons[i]);			}			final int index= i;			buttons[i].addSelectionListener(new SelectionAdapter() {				public void widgetSelected(SelectionEvent e) {					boolean isSelected= ((Button)e.getSource()).getSelection();					setFlag(uiFlags[index], isSelected);				}							});		}				if (hasFlag(flags)) {			controlButton.setSelection(true);			for (int i= 0; i < flags.length; i++) {				if (isFlag(flags[i])) {					setFlag(uiFlags[i], true);				} else {					setFlag(uiFlags[i], false);				}			}		} else {			controlButton.setSelection(false);			boolean hasCheck= false;			for (int i= 0; i < buttons.length; i++) {				Button b= buttons[i];				b.setEnabled(false);				boolean flag= isFlag(uiFlags[i]);				if (flag) {					if (style == SWT.CHECK) {						b.setSelection(true);					} else if (!hasCheck) {						b.setSelection(true);					}					hasCheck= true;				} else {					b.setSelection(false);				}			}			if (style == SWT.RADIO && !hasCheck) {				buttons[0].setSelection(true);				setFlag(uiFlags[0], true);			}		}		controlButton.addSelectionListener(new SelectionAdapter() {			public void widgetSelected(SelectionEvent e) {				boolean isSelected= ((Button)e.getSource()).getSelection();				for (int i= 0; i < buttons.length; i++) {					buttons[i].setEnabled(isSelected);				}				if (!isSelected) {					for (int i= 0; i < flags.length; i++) {						setFlag(flags[i], false);					}				} else {					for (int i= 0; i < flags.length; i++) {						setFlag(flags[i], buttons[i].getSelection());					}				}			}					});		return buttons;	}