1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-04 15:45:25 +02:00

Bug 158298 - added group box around radio buttons.

Screen readers now read the text of the group box which they did not before.
This commit is contained in:
David Dykstal 2006-10-17 23:14:14 +00:00
parent 9ed1931025
commit fadb48867c
3 changed files with 68 additions and 79 deletions

View file

@ -19,9 +19,10 @@ Michael Berger (IBM Canada) - 148434 Better user assistance for logging preferen
<contexts>
<!-- RSE logging -->
<context id="rsel0000">
<description>This is the RSE Logging preference page.
You can specify what severity of messages you wish to log - from informational messages, to warnings, to errors.
The debug setting provides the most detail.
<description>This page allows you to specify the Remote System Explorer logging preferences.
You can specify what severity of messages you wish to log - from informational messages, to warnings, to errors. If it is available, the debug setting provides the most detail.
Messages are logged to the .log file in the .metadata folder of the workspace.
</description>
</context>

View file

@ -21,8 +21,8 @@
# Preference Page
# ----------------
LOGGING_PREFERENCE_PAGE_TOPLABEL1 = Specify the logging options for {0}
LOGGING_PREFERENCE_PAGE_TOPLABEL2 = Logging Level:
LOGGING_PREFERENCE_PAGE_TOPLABEL1 = Specify the logging preferences for {0}
LOGGING_PREFERENCE_PAGE_TOPLABEL2 = Logging Level
LOGGING_PREFERENCE_PAGE_ERRORS_ONLY = Errors only
LOGGING_PREFERENCE_PAGE_WARNINGS_ERRORS = Warnings and errors
LOGGING_PREFERENCE_PAGE_INFO_DEBUG = Warnings, errors and information messages

View file

@ -32,6 +32,7 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
@ -58,68 +59,37 @@ public abstract class LoggingPreferencePage extends PreferencePage implements IW
* @param numColumns the number of columns for the new composite
* @return the newly-created coposite
*/
private Composite createComposite(Composite parent, int numColumns) {
private Composite createComposite(Composite parent, int span, int numColumns) {
Composite composite = new Composite(parent, SWT.NONE);
//GridLayout
GridLayout layout = new GridLayout();
layout.numColumns = numColumns;
composite.setLayout(layout);
//GridData
GridData data = new GridData();
data.verticalAlignment = GridData.FILL;
data.horizontalAlignment = GridData.FILL;
data.horizontalSpan = span;
composite.setLayoutData(data);
return composite;
}
/**
* Method declared on PreferencePage
*/
protected Control createContents(Composite parent) {
Bundle bundle = getBundle();
Composite composite_tab = createComposite(parent, 2);
String bundleName = (String) (bundle.getHeaders().get(org.osgi.framework.Constants.BUNDLE_NAME));
String topLabel1 = LoggingPreferenceLabels.LOGGING_PREFERENCE_PAGE_TOPLABEL1;
topLabel1 = MessageFormat.format(topLabel1, new Object[] { bundleName });
createLabel(composite_tab, topLabel1);
forceSpace(composite_tab);
String topLabel2 = LoggingPreferenceLabels.LOGGING_PREFERENCE_PAGE_TOPLABEL2;
createLabel(composite_tab, topLabel2);
tabForward(composite_tab);
Composite composite1_radioButton = createComposite(composite_tab, 1);
String text = LoggingPreferenceLabels.LOGGING_PREFERENCE_PAGE_ERRORS_ONLY;
Set used = LabelUtil.usedFromString("ad"); // the mnemonics already used on preference page (in English)
radioButton0 = createRadioButton(composite1_radioButton, LabelUtil.assignMnemonic(text, used));
text = LoggingPreferenceLabels.LOGGING_PREFERENCE_PAGE_WARNINGS_ERRORS;
radioButton1 = createRadioButton(composite1_radioButton, LabelUtil.assignMnemonic(text, used));
text = LoggingPreferenceLabels.LOGGING_PREFERENCE_PAGE_INFO_DEBUG;
radioButton2 = createRadioButton(composite1_radioButton, LabelUtil.assignMnemonic(text, used));
if (Logger.DEBUG) {
text = LoggingPreferenceLabels.LOGGING_PREFERENCE_PAGE_FULL_DEBUG;
radioButton3 = createRadioButton(composite1_radioButton, LabelUtil.assignMnemonic(text, used));
}
initializeValues();
PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, "org.eclipse.rse.logging.rsel0000");
return new Composite(parent, SWT.NULL);
}
/**
* Utility method that creates a label instance
* and sets the default layout data.
*
* @param parent the parent for the new label
* @param text the text for the new label
* @return the new label
* Creates group control and sets the default layout data.
* @param parent the parent of the new composite
* @param numColumns the number of columns for the new composite
* @return the newly-created coposite
*/
private Label createLabel(Composite parent, String text) {
Label label = new Label(parent, SWT.LEFT);
label.setText(text);
private Group createGroup(Composite parent, int span, int numColumns, String text) {
Group group = new Group(parent, SWT.NONE);
GridLayout layout = new GridLayout();
layout.numColumns = numColumns;
group.setLayout(layout);
GridData data = new GridData();
data.horizontalSpan = 2;
data.verticalAlignment = GridData.FILL;
data.horizontalAlignment = GridData.FILL;
label.setLayoutData(data);
return label;
data.horizontalSpan = span;
group.setLayoutData(data);
group.setText(text);
return group;
}
/**
@ -138,6 +108,51 @@ public abstract class LoggingPreferencePage extends PreferencePage implements IW
return button;
}
/**
* Utility method that creates a label instance
* and sets the default layout data.
*
* @param parent the parent for the new label
* @param text the text for the new label
* @return the new label
*/
private Label createLabel(Composite parent, int span, String text) {
Label label = new Label(parent, SWT.LEFT);
label.setText(text);
GridData data = new GridData();
data.horizontalSpan = span;
data.horizontalAlignment = GridData.FILL;
label.setLayoutData(data);
return label;
}
/**
* Method declared on PreferencePage
*/
protected Control createContents(Composite parent) {
Composite composite_tab = createComposite(parent, 1, 1);
String bundleName = (String)(getBundle().getHeaders().get(org.osgi.framework.Constants.BUNDLE_NAME));
String topLabel1 = LoggingPreferenceLabels.LOGGING_PREFERENCE_PAGE_TOPLABEL1;
topLabel1 = MessageFormat.format(topLabel1, new Object[] {bundleName});
createLabel(composite_tab, 1, topLabel1);
String topLabel2 = LoggingPreferenceLabels.LOGGING_PREFERENCE_PAGE_TOPLABEL2;
Group group1 = createGroup(composite_tab, 1, 1, topLabel2);
Set used = LabelUtil.usedFromString("ad"); // the mnemonics already used on preference page (in English)
String text = LoggingPreferenceLabels.LOGGING_PREFERENCE_PAGE_ERRORS_ONLY;
radioButton0 = createRadioButton(group1, LabelUtil.assignMnemonic(text, used));
text = LoggingPreferenceLabels.LOGGING_PREFERENCE_PAGE_WARNINGS_ERRORS;
radioButton1 = createRadioButton(group1, LabelUtil.assignMnemonic(text, used));
text = LoggingPreferenceLabels.LOGGING_PREFERENCE_PAGE_INFO_DEBUG;
radioButton2 = createRadioButton(group1, LabelUtil.assignMnemonic(text, used));
if (Logger.DEBUG) {
text = LoggingPreferenceLabels.LOGGING_PREFERENCE_PAGE_FULL_DEBUG;
radioButton3 = createRadioButton(group1, LabelUtil.assignMnemonic(text, used));
}
initializeValues();
PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, "org.eclipse.rse.logging.rsel0000");
return composite_tab;
}
/**
*
*/
@ -259,31 +274,4 @@ public abstract class LoggingPreferencePage extends PreferencePage implements IW
store.setValue(IRemoteSystemsLogging.DEBUG_LEVEL, choice);
}
/**
* Creates a tab of one horizontal span.
*
* @param parent the parent in which the tab should be created
*/
private void tabForward(Composite parent) {
Label vfiller = new Label(parent, SWT.LEFT);
GridData gridData = new GridData();
gridData = new GridData();
gridData.horizontalAlignment = GridData.BEGINNING;
gridData.grabExcessHorizontalSpace = false;
gridData.verticalAlignment = GridData.CENTER;
gridData.grabExcessVerticalSpace = false;
vfiller.setLayoutData(gridData);
}
/**
* Create a horizontal space line.
*/
private void forceSpace(Composite parent) {
Label label = new Label(parent, SWT.NONE);
GridData data = new GridData();
data.horizontalAlignment = GridData.FILL;
data.verticalAlignment = GridData.BEGINNING;
data.horizontalSpan = 2;
label.setLayoutData(data);
}
}