Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 177340 Details for
Bug 320062
Use preceding Label as accessible name for Table and Tree
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch for default name for table and tree
patch.txt (text/plain), 4.77 KB, created by
Carolyn MacLeod
on 2010-08-24 12:21:36 EDT
(
hide
)
Description:
Patch for default name for table and tree
Filename:
MIME Type:
Creator:
Carolyn MacLeod
Created:
2010-08-24 12:21:36 EDT
Size:
4.77 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.swt >Index: Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/Accessible.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/Accessible.java,v >retrieving revision 1.102.2.4 >diff -u -r1.102.2.4 Accessible.java >--- Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/Accessible.java 23 Aug 2010 20:56:21 -0000 1.102.2.4 >+++ Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/Accessible.java 24 Aug 2010 16:14:00 -0000 >@@ -2226,7 +2226,7 @@ > /* Get the default keyboard shortcut from the OS. */ > code = iaccessible.get_accKeyboardShortcut(varChild, pszKeyboardShortcut); > if (code == COM.E_INVALIDARG) code = COM.S_FALSE; // proxy doesn't know about app childID >- if (accessibleListeners.size() == 0) return code; >+ if (accessibleListeners.size() == 0 && !(control instanceof Tree || control instanceof Table)) return code; > if (code == COM.S_OK) { > int /*long*/[] pKeyboardShortcut = new int /*long*/[1]; > COM.MoveMemory(pKeyboardShortcut, pszKeyboardShortcut, OS.PTR_SIZEOF); >@@ -2241,6 +2241,18 @@ > > AccessibleEvent event = new AccessibleEvent(this); > event.childID = osToChildID(v.lVal); >+ if (osKeyboardShortcut == null && (control instanceof Tree || control instanceof Table)) { >+ /* >+ * Get the default shortcut for a Table or Tree from the preceding Label, if any. >+ */ >+ String text = getAssociatedLabel (); >+ if (text != null) { >+ char mnemonic = _findMnemonic (text); >+ if (mnemonic != '\0') { >+ osKeyboardShortcut = "Alt+"+mnemonic; //$NON-NLS-1$ >+ } >+ } >+ } > event.result = osKeyboardShortcut; > for (int i = 0; i < accessibleListeners.size(); i++) { > AccessibleListener listener = (AccessibleListener) accessibleListeners.elementAt(i); >@@ -2272,7 +2284,7 @@ > } > } > if (code == COM.E_INVALIDARG) code = COM.S_FALSE; // proxy doesn't know about app childID >- if (accessibleListeners.size() == 0) { >+ if (accessibleListeners.size() == 0 && !(control instanceof Tree || control instanceof Table)) { > if (DEBUG) print(this + ".IAccessible::get_accName(" + v.lVal + ") returning name=" + osName + " from super" + hresult(code)); > return code; > } >@@ -2280,6 +2292,15 @@ > > AccessibleEvent event = new AccessibleEvent(this); > event.childID = osToChildID(v.lVal); >+ if (osName == null && (control instanceof Tree || control instanceof Table)) { >+ /* >+ * Get the default name for a Table or Tree from the preceding Label, if any. >+ */ >+ String text = getAssociatedLabel (); >+ if (text != null) { >+ osName = stripMnemonic (text); >+ } >+ } > event.result = osName; > for (int i = 0; i < accessibleListeners.size(); i++) { > AccessibleListener listener = (AccessibleListener) accessibleListeners.elementAt(i); >@@ -2292,6 +2313,57 @@ > return COM.S_OK; > } > >+ /* >+ * Return the Label immediately preceding the receiver in the z-order, >+ * or null if none. >+ */ >+ String getAssociatedLabel () { >+ Control[] siblings = control.getParent ().getChildren (); >+ for (int i = 0; i < siblings.length; i++) { >+ if (siblings [i] == control) { >+ if (i > 0) { >+ Control sibling = siblings [i-1]; >+ if (sibling instanceof Label) return ((Label) sibling).getText(); >+// if (sibling instanceof CLabel) return ((CLabel) sibling).getText(); >+ } >+ break; >+ } >+ } >+ return null; >+ } >+ >+ String stripMnemonic (String string) { >+ int index = 0; >+ int length = string.length (); >+ do { >+ while ((index < length) && (string.charAt (index) != '&')) index++; >+ if (++index >= length) return string; >+ if (string.charAt (index) != '&') { >+ return string.substring(0, index-1) + string.substring(index, length); >+ } >+ index++; >+ } while (index < length); >+ return string; >+ } >+ >+ /* >+ * Return the lowercase of the first non-'&' character following >+ * an '&' character in the given string. If there are no '&' >+ * characters in the given string, return '\0'. >+ */ >+ char _findMnemonic (String string) { >+ if (string == null) return '\0'; >+ int index = 0; >+ int length = string.length (); >+ do { >+ while (index < length && string.charAt (index) != '&') index++; >+ if (++index >= length) return '\0'; >+ if (string.charAt (index) != '&') return Character.toLowerCase (string.charAt (index)); >+ index++; >+ } while (index < length); >+ return '\0'; >+ } >+ > /* IAccessible::get_accParent([out] ppdispParent) > * Ownership of ppdispParent transfers from callee to caller so reference count on ppdispParent > * must be incremented before returning. The caller is responsible for releasing ppdispParent.
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 320062
: 177340