1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Bug 576639 - [Accessibility][A11y] reduce JAWS table read while in table

correct previous fixes Bug 575946, Bug 575949, Bug 576090
to use only parent for accessibility add of table description.

Change-Id: Idbc39f13c06f27ed106839d922c328f3bce76d16
Signed-off-by: GeraldMit <Gerald.Mitchell@ibm.com>
This commit is contained in:
GeraldMit 2021-10-15 02:07:25 -04:00 committed by Jonah Graham
parent 8d173637f7
commit e8b257c645
4 changed files with 56 additions and 45 deletions

View file

@ -37,8 +37,8 @@ import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.accessibility.AccessibleAdapter; import org.eclipse.swt.accessibility.ACC;
import org.eclipse.swt.accessibility.AccessibleEvent; import org.eclipse.swt.accessibility.AccessibleListener;
import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.events.SelectionListener;
@ -133,18 +133,17 @@ public class CustomFiltersDialog extends SelectionDialog {
fUserDefinedPatterns.setLayoutData(data); fUserDefinedPatterns.setLayoutData(data);
String patterns = convertToString(fPatterns, SEPARATOR); String patterns = convertToString(fPatterns, SEPARATOR);
fUserDefinedPatterns.setText(patterns); fUserDefinedPatterns.setText(patterns);
fUserDefinedPatterns.setToolTipText(FilterMessages.CustomFiltersDialog_patternInfo);
// Info text // Info text
final Label info = new Label(group, SWT.LEFT); final Label info = new Label(group, SWT.LEFT);
info.setText(FilterMessages.CustomFiltersDialog_patternInfo); info.setText(FilterMessages.CustomFiltersDialog_patternInfo);
// add the info text as a description to the pattern field // add the info text as a description to the pattern field
fUserDefinedPatterns.getAccessible().addAccessibleListener(new AccessibleAdapter() { fUserDefinedPatterns.getAccessible().addAccessibleListener(AccessibleListener.getNameAdapter(e -> {
@Override if (e.childID == ACC.CHILDID_SELF && (e.result == null || e.result.trim().isEmpty())) {
public void getDescription(AccessibleEvent e) {
e.result = FilterMessages.CustomFiltersDialog_patternInfo; e.result = FilterMessages.CustomFiltersDialog_patternInfo;
} }
}); }));
// Enabling / disabling of pattern group // Enabling / disabling of pattern group
fEnableUserDefinedPatterns.setSelection(fEnablePatterns); fEnableUserDefinedPatterns.setSelection(fEnablePatterns);
@ -191,12 +190,11 @@ public class CustomFiltersDialog extends SelectionDialog {
if (initialSelection != null && !initialSelection.isEmpty()) if (initialSelection != null && !initialSelection.isEmpty())
checkInitialSelections(); checkInitialSelections();
fCheckBoxList.getTable().getAccessible().addAccessibleListener(new AccessibleAdapter() { fCheckBoxList.getTable().getAccessible().addAccessibleListener(AccessibleListener.getNameAdapter(e -> {
@Override if (e.childID == ACC.CHILDID_SELF && (e.result == null || e.result.trim().isEmpty())) {
public void getName(AccessibleEvent e) {
e.result = FilterMessages.CustomFiltersDialog_filterList_label; e.result = FilterMessages.CustomFiltersDialog_filterList_label;
} }
}); }));
fCheckBoxList.getTable().setToolTipText(FilterMessages.CustomFiltersDialog_filterList_label); fCheckBoxList.getTable().setToolTipText(FilterMessages.CustomFiltersDialog_filterList_label);
// Description // Description

View file

@ -56,8 +56,8 @@ import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer; import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerComparator; import org.eclipse.jface.viewers.ViewerComparator;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.accessibility.AccessibleAdapter; import org.eclipse.swt.accessibility.ACC;
import org.eclipse.swt.accessibility.AccessibleEvent; import org.eclipse.swt.accessibility.AccessibleListener;
import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.events.SelectionListener;
@ -650,12 +650,11 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
fListViewer.getControl().setLayoutData(gd); fListViewer.getControl().setLayoutData(gd);
// add the coloring element label text as the name for the list viewer // add the coloring element label text as the name for the list viewer
fListViewer.getControl().getAccessible().addAccessibleListener(new AccessibleAdapter() { fListViewer.getControl().getAccessible().addAccessibleListener(AccessibleListener.getNameAdapter(e -> {
@Override if (e.childID == ACC.CHILDID_SELF && (e.result == null || e.result.trim().isEmpty())) {
public void getName(AccessibleEvent e) {
e.result = PreferencesMessages.CEditorColoringConfigurationBlock_coloring_element; e.result = PreferencesMessages.CEditorColoringConfigurationBlock_coloring_element;
} }
}); }));
Composite stylesComposite = new Composite(editorComposite, SWT.NONE); Composite stylesComposite = new Composite(editorComposite, SWT.NONE);
layout = new GridLayout(); layout = new GridLayout();
@ -721,12 +720,11 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
gd.heightHint = convertHeightInCharsToPixels(5); gd.heightHint = convertHeightInCharsToPixels(5);
previewer.setLayoutData(gd); previewer.setLayoutData(gd);
// add the preview label text as the name to the previewer // add the preview label text as the name to the previewer
previewer.getAccessible().addAccessibleListener(new AccessibleAdapter() { previewer.getAccessible().addAccessibleListener(AccessibleListener.getNameAdapter(e -> {
@Override if (e.childID == ACC.CHILDID_SELF && (e.result == null || e.result.trim().isEmpty())) {
public void getName(AccessibleEvent e) {
e.result = PreferencesMessages.CEditorColoringConfigurationBlock_preview; e.result = PreferencesMessages.CEditorColoringConfigurationBlock_preview;
} }
}); }));
fListViewer.addSelectionChangedListener(new ISelectionChangedListener() { fListViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override @Override

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2002, 2010 QNX Software Systems and others. * Copyright (c) 2002, 2021 QNX Software Systems and others.
* *
* This program and the accompanying materials * This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0 * are made available under the terms of the Eclipse Public License 2.0
@ -11,6 +11,7 @@
* Contributors: * Contributors:
* QNX Software Systems - Initial API and implementation * QNX Software Systems - Initial API and implementation
* Wind River Systems, Inc. - Bug fixes * Wind River Systems, Inc. - Bug fixes
* IBM Corporation - Bug fixes
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.ui.preferences; package org.eclipse.cdt.internal.ui.preferences;
@ -33,8 +34,8 @@ import org.eclipse.jface.text.templates.ContextTypeRegistry;
import org.eclipse.jface.text.templates.Template; import org.eclipse.jface.text.templates.Template;
import org.eclipse.jface.window.Window; import org.eclipse.jface.window.Window;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.accessibility.AccessibleAdapter; import org.eclipse.swt.accessibility.ACC;
import org.eclipse.swt.accessibility.AccessibleEvent; import org.eclipse.swt.accessibility.AccessibleListener;
import org.eclipse.swt.graphics.Font; import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
@ -111,6 +112,25 @@ public class CTemplatePreferencePage extends TemplatePreferencePage {
PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), ICHelpContextIds.TEMPLATE_PREFERENCE_PAGE); PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), ICHelpContextIds.TEMPLATE_PREFERENCE_PAGE);
} }
/*
* @see PreferencePage#createContents(Composite)
*/
@Override
protected Control createContents(Composite ancestor) {
Control control = super.createContents(ancestor);
//must occur after contents created
if (getTableViewer() == null) {
String description = getDescription();
//same description as used in PreferencePage.createDescriptionLabel(Composite parent)
getTableViewer().getControl().getAccessible().addAccessibleListener(AccessibleListener.getNameAdapter(e -> {
if (e.childID == ACC.CHILDID_SELF && (e.result == null || e.result.trim().isEmpty())) {
e.result = description;
}
}));
}
return control;
}
/* /*
* @see org.eclipse.ui.texteditor.templates.TemplatePreferencePage#getFormatterPreferenceKey() * @see org.eclipse.ui.texteditor.templates.TemplatePreferencePage#getFormatterPreferenceKey()
*/ */
@ -157,12 +177,9 @@ public class CTemplatePreferencePage extends TemplatePreferencePage {
data.heightHint = convertHeightInCharsToPixels(5); data.heightHint = convertHeightInCharsToPixels(5);
control.setLayoutData(data); control.setLayoutData(data);
control.getAccessible().addAccessibleListener(new AccessibleAdapter() { control.getAccessible().addAccessibleListener(AccessibleListener.getNameAdapter(e -> {
@Override e.result = PreferencesMessages.TemplatePreferencePage_Viewer_preview;
public void getName(AccessibleEvent e) { }));
e.result = PreferencesMessages.TemplatePreferencePage_Viewer_preview;
}
});
CSourcePreviewerUpdater.registerPreviewer(viewer, configuration, CSourcePreviewerUpdater.registerPreviewer(viewer, configuration,
CUIPlugin.getDefault().getCombinedPreferenceStore()); CUIPlugin.getDefault().getCombinedPreferenceStore());

View file

@ -56,8 +56,8 @@ import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.ViewerComparator; import org.eclipse.jface.viewers.ViewerComparator;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.accessibility.AccessibleAdapter; import org.eclipse.swt.accessibility.ACC;
import org.eclipse.swt.accessibility.AccessibleEvent; import org.eclipse.swt.accessibility.AccessibleListener;
import org.eclipse.swt.custom.StyledText; import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionEvent;
@ -158,7 +158,7 @@ final class CodeAssistAdvancedConfigurationBlock extends OptionsConfigurationBlo
} }
} }
private final Comparator<ModelElement> fCategoryComparator = new Comparator<>() { private final Comparator<ModelElement> fCategoryComparator = new Comparator<ModelElement>() {
@Override @Override
public int compare(ModelElement o1, ModelElement o2) { public int compare(ModelElement o1, ModelElement o2) {
return o1.getRank() - o2.getRank(); return o1.getRank() - o2.getRank();
@ -428,12 +428,12 @@ final class CodeAssistAdvancedConfigurationBlock extends OptionsConfigurationBlo
styledTextWidget.setEditable(false); styledTextWidget.setEditable(false);
styledTextWidget.setCaret(null); styledTextWidget.setCaret(null);
styledTextWidget.setBackground(composite.getBackground()); styledTextWidget.setBackground(composite.getBackground());
styledTextWidget.getAccessible().addAccessibleListener(new AccessibleAdapter() { styledTextWidget.setToolTipText(value);
@Override styledTextWidget.getAccessible().addAccessibleListener(AccessibleListener.getNameAdapter(e -> {
public void getDescription(AccessibleEvent e) { if (e.childID == ACC.CHILDID_SELF && (e.result == null || e.result.trim().isEmpty())) {
e.result = value; e.result = value;
} }
}); }));
return styledTextWidget; return styledTextWidget;
} }
@ -489,12 +489,11 @@ final class CodeAssistAdvancedConfigurationBlock extends OptionsConfigurationBlo
} }
}); });
fDefaultViewer.getControl().getAccessible().addAccessibleListener(new AccessibleAdapter() { fDefaultViewer.getControl().getAccessible().addAccessibleListener(AccessibleListener.getNameAdapter(e -> {
@Override if (e.childID == ACC.CHILDID_SELF && (e.result == null || e.result.trim().isEmpty())) {
public void getName(AccessibleEvent e) {
e.result = PreferencesMessages.CodeAssistAdvancedConfigurationBlock_default_table_description; e.result = PreferencesMessages.CodeAssistAdvancedConfigurationBlock_default_table_description;
} }
}); }));
fDefaultViewer.setContentProvider(ArrayContentProvider.getInstance()); fDefaultViewer.setContentProvider(ArrayContentProvider.getInstance());
@ -598,12 +597,11 @@ final class CodeAssistAdvancedConfigurationBlock extends OptionsConfigurationBlo
} }
}); });
fSeparateViewer.getControl().getAccessible().addAccessibleListener(new AccessibleAdapter() { fSeparateViewer.getControl().getAccessible().addAccessibleListener(AccessibleListener.getNameAdapter(e -> {
@Override if (e.childID == ACC.CHILDID_SELF && (e.result == null || e.result.trim().isEmpty())) {
public void getName(AccessibleEvent e) {
e.result = PreferencesMessages.CodeAssistAdvancedConfigurationBlock_separate_table_description; e.result = PreferencesMessages.CodeAssistAdvancedConfigurationBlock_separate_table_description;
} }
}); }));
table.addSelectionListener(new SelectionAdapter() { table.addSelectionListener(new SelectionAdapter() {
@Override @Override