|
Lines 168-173
Link Here
|
| 168 |
private static Control findControl(Composite composite, String key) { |
168 |
private static Control findControl(Composite composite, String key) { |
| 169 |
if (!composite.isDisposed()) { |
169 |
if (!composite.isDisposed()) { |
| 170 |
for (Control child : composite.getChildren()) { |
170 |
for (Control child : composite.getChildren()) { |
|
|
171 |
// expend subsections first |
| 172 |
if (child instanceof Section) { |
| 173 |
Section ex = (Section) child; |
| 174 |
if (!ex.isExpanded()) { |
| 175 |
toggleExpandableComposite(true, ex); |
| 176 |
} |
| 177 |
} |
| 178 |
|
| 171 |
if (key.equals(getMarker(child))) { |
179 |
if (key.equals(getMarker(child))) { |
| 172 |
return child; |
180 |
return child; |
| 173 |
} |
181 |
} |
|
Lines 281-320
Link Here
|
| 281 |
* Whether or not the object should be highlighted. |
289 |
* Whether or not the object should be highlighted. |
| 282 |
*/ |
290 |
*/ |
| 283 |
public static boolean reveal(ScrolledForm form, String key) { |
291 |
public static boolean reveal(ScrolledForm form, String key) { |
| 284 |
Control control = findControl(form.getBody(), key); |
292 |
try { |
| 285 |
if (control != null) { |
293 |
form.setRedraw(false); |
| 286 |
// expand all children |
|
|
| 287 |
if (control instanceof ExpandableComposite) { |
| 288 |
ExpandableComposite ex = (ExpandableComposite) control; |
| 289 |
if (!ex.isExpanded()) { |
| 290 |
toggleExpandableComposite(true, ex); |
| 291 |
} |
| 292 |
} |
| 293 |
|
294 |
|
| 294 |
// expand all parents of control |
295 |
Control control = findControl(form.getBody(), key); |
| 295 |
Composite comp = control.getParent(); |
296 |
if (control != null) { |
| 296 |
while (comp != null) { |
297 |
// expand all children |
| 297 |
if (comp instanceof Section) { |
298 |
if (control instanceof ExpandableComposite) { |
| 298 |
if (!((Section) comp).isExpanded()) { |
299 |
ExpandableComposite ex = (ExpandableComposite) control; |
| 299 |
((Section) comp).setExpanded(true); |
|
|
| 300 |
} |
| 301 |
} else if (comp instanceof ExpandableComposite) { |
| 302 |
ExpandableComposite ex = (ExpandableComposite) comp; |
| 303 |
if (!ex.isExpanded()) { |
300 |
if (!ex.isExpanded()) { |
| 304 |
toggleExpandableComposite(true, ex); |
301 |
toggleExpandableComposite(true, ex); |
| 305 |
} |
302 |
} |
|
|
303 |
} |
| 306 |
|
304 |
|
| 307 |
// HACK: This is necessary |
305 |
// expand all parents of control |
| 308 |
// due to a bug in SWT's ExpandableComposite. |
306 |
Composite comp = control.getParent(); |
| 309 |
// 165803: Expandable bars should expand when clicking anywhere |
307 |
while (comp != null) { |
| 310 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?taskId=165803 |
308 |
if (comp instanceof Section) { |
| 311 |
if (ex.getData() != null && ex.getData() instanceof Composite) { |
309 |
if (!((Section) comp).isExpanded()) { |
| 312 |
((Composite) ex.getData()).setVisible(true); |
310 |
((Section) comp).setExpanded(true); |
|
|
311 |
} |
| 312 |
} else if (comp instanceof ExpandableComposite) { |
| 313 |
ExpandableComposite ex = (ExpandableComposite) comp; |
| 314 |
if (!ex.isExpanded()) { |
| 315 |
toggleExpandableComposite(true, ex); |
| 316 |
} |
| 317 |
|
| 318 |
// HACK: This is necessary |
| 319 |
// due to a bug in SWT's ExpandableComposite. |
| 320 |
// 165803: Expandable bars should expand when clicking anywhere |
| 321 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?taskId=165803 |
| 322 |
if (ex.getData() != null && ex.getData() instanceof Composite) { |
| 323 |
((Composite) ex.getData()).setVisible(true); |
| 324 |
} |
| 313 |
} |
325 |
} |
|
|
326 |
comp = comp.getParent(); |
| 314 |
} |
327 |
} |
| 315 |
comp = comp.getParent(); |
328 |
focusOn(form, control); |
| 316 |
} |
329 |
} |
| 317 |
focusOn(form, control); |
330 |
} finally { |
|
|
331 |
form.setRedraw(true); |
| 318 |
} |
332 |
} |
| 319 |
return true; |
333 |
return true; |
| 320 |
} |
334 |
} |