|
Lines 1-5
Link Here
|
| 1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2000, 2007 IBM Corporation and others. |
2 |
* Copyright (c) 2000, 2008 IBM Corporation and others. |
| 3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
|
Lines 156-162
Link Here
|
| 156 |
*/ |
156 |
*/ |
| 157 |
public void setExpanded(boolean expanded) { |
157 |
public void setExpanded(boolean expanded) { |
| 158 |
this.expanded = expanded; |
158 |
this.expanded = expanded; |
| 159 |
getAccessible().selectionChanged(); |
|
|
| 160 |
redraw(); |
159 |
redraw(); |
| 161 |
} |
160 |
} |
| 162 |
private void initAccessible() { |
161 |
private void initAccessible() { |
|
Lines 165-179
Link Here
|
| 165 |
e.result = getToolTipText(); |
164 |
e.result = getToolTipText(); |
| 166 |
} |
165 |
} |
| 167 |
public void getName(AccessibleEvent e) { |
166 |
public void getName(AccessibleEvent e) { |
| 168 |
String name=Messages.ToggleHyperlink_accessibleName; |
167 |
e.result = Messages.ToggleHyperlink_accessibleName; |
| 169 |
if (getParent() instanceof ExpandableComposite) { |
|
|
| 170 |
name += Messages.ToggleHyperlink_accessibleColumn+((ExpandableComposite)getParent()).getText(); |
| 171 |
int index = name.indexOf('&'); |
| 172 |
if (index != -1) { |
| 173 |
name = name.substring(0, index) + name.substring(index + 1); |
| 174 |
} |
| 175 |
} |
| 176 |
e.result = name; |
| 177 |
} |
168 |
} |
| 178 |
public void getDescription(AccessibleEvent e) { |
169 |
public void getDescription(AccessibleEvent e) { |
| 179 |
getName(e); |
170 |
getName(e); |
|
Lines 211-226
Link Here
|
| 211 |
e.detail = ACC.ROLE_TREE; |
202 |
e.detail = ACC.ROLE_TREE; |
| 212 |
} |
203 |
} |
| 213 |
public void getState(AccessibleControlEvent e) { |
204 |
public void getState(AccessibleControlEvent e) { |
| 214 |
int state = ACC.STATE_FOCUSABLE; |
205 |
e.detail = ToggleHyperlink.this.isExpanded() |
| 215 |
if (ToggleHyperlink.this.getSelection()) |
|
|
| 216 |
state |= ACC.STATE_FOCUSED; |
| 217 |
state |= ToggleHyperlink.this.isExpanded() |
| 218 |
? ACC.STATE_EXPANDED |
206 |
? ACC.STATE_EXPANDED |
| 219 |
: ACC.STATE_COLLAPSED; |
207 |
: ACC.STATE_COLLAPSED; |
| 220 |
e.detail = state; |
208 |
} |
|
|
209 |
public void getValue(AccessibleControlEvent e) { |
| 210 |
if (e.childID == ACC.CHILDID_SELF) { |
| 211 |
String name = Messages.ToggleHyperlink_accessibleName; |
| 212 |
if (getParent() instanceof ExpandableComposite) { |
| 213 |
name = Messages.ToggleHyperlink_accessibleColumn+((ExpandableComposite)getParent()).getText(); |
| 214 |
int index = name.indexOf('&'); |
| 215 |
if (index != -1) { |
| 216 |
name = name.substring(0, index) + name.substring(index + 1); |
| 217 |
} |
| 218 |
} |
| 219 |
e.result = name; |
| 220 |
} |
| 221 |
} |
221 |
} |
| 222 |
}); |
222 |
}); |
| 223 |
} |
223 |
} |
|
|
224 |
// set bogus childIDs on link activation to ensure state is read on expand/collapse |
| 225 |
void triggerAccessible() { |
| 226 |
getAccessible().setFocus(getAccessibleChildID()); |
| 227 |
} |
| 228 |
private int getAccessibleChildID() { |
| 229 |
return ToggleHyperlink.this.isExpanded() ? 1 : 2; |
| 230 |
} |
| 231 |
|
| 224 |
private void onKeyDown(Event e) { |
232 |
private void onKeyDown(Event e) { |
| 225 |
if (e.keyCode==SWT.ARROW_RIGHT) { |
233 |
if (e.keyCode==SWT.ARROW_RIGHT) { |
| 226 |
// expand if collapsed |
234 |
// expand if collapsed |