From fadb48867c777396af86c08d29c58dbeb9fe1f89 Mon Sep 17 00:00:00 2001 From: David Dykstal Date: Tue, 17 Oct 2006 23:14:14 +0000 Subject: [PATCH] Bug 158298 - added group box around radio buttons. Screen readers now read the text of the group box which they did not before. --- .../org.eclipse.rse.logging/HelpContexts.xml | 7 +- .../ui/LoggingPreferenceLabels.properties | 4 +- .../rse/logging/ui/LoggingPreferencePage.java | 136 ++++++++---------- 3 files changed, 68 insertions(+), 79 deletions(-) diff --git a/rse/plugins/org.eclipse.rse.logging/HelpContexts.xml b/rse/plugins/org.eclipse.rse.logging/HelpContexts.xml index b3c46def8db..0651535736c 100644 --- a/rse/plugins/org.eclipse.rse.logging/HelpContexts.xml +++ b/rse/plugins/org.eclipse.rse.logging/HelpContexts.xml @@ -19,9 +19,10 @@ Michael Berger (IBM Canada) - 148434 Better user assistance for logging preferen -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. +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. diff --git a/rse/plugins/org.eclipse.rse.logging/src/org/eclipse/rse/logging/ui/LoggingPreferenceLabels.properties b/rse/plugins/org.eclipse.rse.logging/src/org/eclipse/rse/logging/ui/LoggingPreferenceLabels.properties index 8719d721088..dff3a19818a 100644 --- a/rse/plugins/org.eclipse.rse.logging/src/org/eclipse/rse/logging/ui/LoggingPreferenceLabels.properties +++ b/rse/plugins/org.eclipse.rse.logging/src/org/eclipse/rse/logging/ui/LoggingPreferenceLabels.properties @@ -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 diff --git a/rse/plugins/org.eclipse.rse.logging/src/org/eclipse/rse/logging/ui/LoggingPreferencePage.java b/rse/plugins/org.eclipse.rse.logging/src/org/eclipse/rse/logging/ui/LoggingPreferencePage.java index 1b76e14d02b..082bc3d0bd0 100644 --- a/rse/plugins/org.eclipse.rse.logging/src/org/eclipse/rse/logging/ui/LoggingPreferencePage.java +++ b/rse/plugins/org.eclipse.rse.logging/src/org/eclipse/rse/logging/ui/LoggingPreferencePage.java @@ -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); - } } \ No newline at end of file