Last change
on this file since 1326 was
1326,
checked in by khartmann, 10 years ago
|
Moved alexanders code into a new plugin project.
First commit of my experimental code (needs a lot of cleanup).
|
File size:
1.1 KB
|
Line | |
---|
1 | package de.ugoe.cs.autoquest.plugin.usability2.rules.operator.filter; |
---|
2 | |
---|
3 | import de.ugoe.cs.autoquest.eventcore.IEventType; |
---|
4 | import de.ugoe.cs.autoquest.eventcore.gui.KeyInteraction; |
---|
5 | import de.ugoe.cs.autoquest.eventcore.gui.KeyPressed; |
---|
6 | import de.ugoe.cs.autoquest.keyboardmaps.VirtualKey; |
---|
7 | import de.ugoe.cs.autoquest.plugin.usability2.rules.results.IResult; |
---|
8 | import de.ugoe.cs.autoquest.plugin.usability2.rules.results.UnmatchableResult; |
---|
9 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; |
---|
10 | |
---|
11 | public class KeyPressFilter extends EventTypeFilter { |
---|
12 | VirtualKey key; |
---|
13 | |
---|
14 | public KeyPressFilter(VirtualKey key) { |
---|
15 | super(KeyPressed.class); |
---|
16 | this.key = key; |
---|
17 | } |
---|
18 | |
---|
19 | @Override |
---|
20 | public IResult match(ITask task) { |
---|
21 | IResult match = super.match(task); |
---|
22 | if(match.isPresent()) { |
---|
23 | IEventType type = getType(task); |
---|
24 | if (type instanceof KeyInteraction) { |
---|
25 | VirtualKey key = ((KeyInteraction) type).getKey(); |
---|
26 | if(key.equals(this.key)) |
---|
27 | return match; |
---|
28 | } |
---|
29 | } |
---|
30 | return UnmatchableResult.NO_MATCH_FOUND; |
---|
31 | } |
---|
32 | |
---|
33 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.