/pluggablejs/trunk/samples/ui.js |
---|
0,0 → 1,8 |
var file = ui.promptForFile("Choose an appropriate executable"); |
err.println("Chosen file: "+file); |
if (!file.canExecute()) { |
err.println("Not a valid executable"); |
} |
/pluggablejs/trunk/samples/sandbox.js |
---|
0,0 → 1,30 |
var api = { |
createPE: function() { |
var pe = net.outlyer.plugins.PluginEnvironment.create(); |
pe.exportGlobalObject("input", input); |
pe.exportGlobalObject("out", out); |
pe.exportGlobalObject("err", err); |
return pe; |
}, |
createSandbox: function(uri) { |
return api.createPE().createSandbox(uri); |
}, |
}; |
var sb = api.createSandbox(new java.io.File("sandboxed-sandbox.js").toURI()); |
sb.execute(); |
/* |
do { |
var line = ui.prompt("%> "); |
if (null == line || line.isEmpty()) { |
break; |
} |
} |
while (true); |
*/ |
// vim:set ts=4 et ai: // |
/pluggablejs/trunk/samples/prefs.js |
---|
0,0 → 1,17 |
var prefs = java.utils.prefs; |
var p = java.util.prefs.Preferences.userRoot(); |
var shell = new net.outlyer.plugins.Shell(); |
var k = java.util.prefs.Preferences.userNodeForPackage(shell.getClass()); |
err.println("user root: " + p); |
err.println("pkg root: " + k); |
k.put("SampleKey", "sampleValue"); |
k.sync(); |
err.println("Read: " + k.get("SampleKey", "none set")); |
k.remove("SampleKey"); |
k.sync(); |
/pluggablejs/trunk/samples/sandboxed-sandbox.js |
---|
0,0 → 1,3 |
err.println("I'm a sandbox inside a sandbox"); |