Skip to content

Commit a80ae07

Browse files
committed
Restore some more advanced actions of IOProvider
1 parent 9cb22a7 commit a80ae07

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

tmc-plugin/src/fi/helsinki/cs/tmc/spyware/eventsources/OutputActionCaptor.java

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@
2323
import java.util.List;
2424
import java.util.logging.Level;
2525
import java.util.logging.Logger;
26+
import javax.swing.Action;
2627
import javax.swing.text.Document;
2728
import javax.swing.text.JTextComponent;
29+
import org.openide.windows.IOContainer;
2830

2931
/**
3032
* Provides tmc-spyware access to Output of netbeans and allows us to sniff all
@@ -69,6 +71,48 @@ public InputOutput getIO(String string, boolean bln) {
6971
throw new RuntimeException("Failed to get IO. Please contact TestMyCode authors/teacher");
7072
}
7173

74+
@Override
75+
public InputOutput getIO(String string, Action[] actions) {
76+
for (IOProvider provider : Lookup.getDefault().lookupAll(IOProvider.class)) {
77+
if (provider.getName().equals(NAME)) {
78+
continue;
79+
}
80+
81+
InputOutput inputOutput = provider.getIO(string, actions);
82+
return new TmcInputOutputProxy(inputOutput);
83+
}
84+
log.log(Level.WARNING, "Failed to get IO. Please contact TestMyCode authors/teacher");
85+
throw new RuntimeException("Failed to get IO. Please contact TestMyCode authors/teacher");
86+
}
87+
88+
@Override
89+
public InputOutput getIO(String string, boolean bln, Action[] actions, IOContainer ioc) {
90+
for (IOProvider provider : Lookup.getDefault().lookupAll(IOProvider.class)) {
91+
if (provider.getName().equals(NAME)) {
92+
continue;
93+
}
94+
95+
InputOutput inputOutput = provider.getIO(string, actions, ioc);
96+
return new TmcInputOutputProxy(inputOutput);
97+
}
98+
log.log(Level.WARNING, "Failed to get IO. Please contact TestMyCode authors/teacher");
99+
throw new RuntimeException("Failed to get IO. Please contact TestMyCode authors/teacher");
100+
}
101+
102+
@Override
103+
public InputOutput getIO(String name, Action[] actions, IOContainer ioContainer) {
104+
for (IOProvider provider : Lookup.getDefault().lookupAll(IOProvider.class)) {
105+
if (provider.getName().equals(NAME)) {
106+
continue;
107+
}
108+
109+
InputOutput inputOutput = provider.getIO(name, actions, ioContainer);
110+
return new TmcInputOutputProxy(inputOutput);
111+
}
112+
log.log(Level.WARNING, "Failed to get IO. Please contact TestMyCode authors/teacher");
113+
throw new RuntimeException("Failed to get IO. Please contact TestMyCode authors/teacher");
114+
}
115+
72116
/**
73117
* Proxies access to InputOutput from the default provider. Used as one
74118
* event source for spyware module.

0 commit comments

Comments
 (0)