| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
package org.fest.swing.driver; |
| 17 |
|
|
| 18 |
|
import static org.fest.swing.exception.ActionFailedException.actionFailure; |
| 19 |
|
import static org.fest.swing.format.Formatting.format; |
| 20 |
|
import static org.fest.util.Strings.concat; |
| 21 |
|
|
| 22 |
|
import java.awt.Component; |
| 23 |
|
|
| 24 |
|
import javax.accessibility.AccessibleAction; |
| 25 |
|
import javax.swing.Action; |
| 26 |
|
|
| 27 |
|
import org.fest.swing.annotation.RunsInCurrentThread; |
| 28 |
|
|
| 29 |
|
|
| 30 |
|
@link@link |
| 31 |
|
@link |
| 32 |
|
|
| 33 |
|
@author |
| 34 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 3 |
Complexity Density: 0.75 |
|
| 35 |
|
class ComponentPerformDefaultAccessibleActionTask { |
| 36 |
|
|
| 37 |
|
private static final int DEFAULT_ACTION_INDEX = 0; |
| 38 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 3 |
Complexity Density: 0.75 |
|
| 39 |
3
|
@RunsInCurrentThread... |
| 40 |
|
static void performDefaultAccessibleAction(final Component c) { |
| 41 |
3
|
AccessibleAction action = c.getAccessibleContext().getAccessibleAction(); |
| 42 |
3
|
if (action == null || action.getAccessibleActionCount() == 0) |
| 43 |
2
|
throw actionFailure(concat("Unable to perform accessible action for ", format(c))); |
| 44 |
1
|
action.doAccessibleAction(DEFAULT_ACTION_INDEX); |
| 45 |
|
} |
| 46 |
|
} |