diff --git a/oxygen/js-debugger-importer/commons.js b/oxygen/js-debugger-importer/commons.js index be71a9a..fe23003 100644 --- a/oxygen/js-debugger-importer/commons.js +++ b/oxygen/js-debugger-importer/commons.js @@ -14,4 +14,13 @@ startDebugger = function () { main.setExitAction(java.lang.Runnable(runnable)); // , clean the resources at exit time... main.setVisible(true); // and make it visible/ +} + +include = function (filepath, isAbsolute) { + if (isAbsolute === undefined || isAbsolute == false) { + filepath = Packages.ro.sync.ecss.extensions.commons.operations.CommonsOperationsUtil.expandAndResolvePath(authorAccess, filepath); + } + var text = new java.lang.String(java.nio.file.Files.readAllBytes(java.nio.file.Paths.get('/home/vdv/projects/tea/dyomedea/ramblings/oxygen/js-debugger-importer/test.js'))); + text = String(text); + eval(text); } \ No newline at end of file diff --git a/oxygen/js-debugger-importer/sdf.framework b/oxygen/js-debugger-importer/sdf.framework index 993b97b..5043baf 100644 --- a/oxygen/js-debugger-importer/sdf.framework +++ b/oxygen/js-debugger-importer/sdf.framework @@ -808,6 +808,56 @@ false + + + hello + + + hello + + + Hello world + + + + + + + + + + + + ctrl shift H + + + + + + + + + + + script + +doOperation = function () { + include('test.js'); + hello(); +} + + + + + ro.sync.ecss.extensions.commons.operations.JSOperation + + + + + + false + + diff --git a/oxygen/js-debugger-importer/test.js b/oxygen/js-debugger-importer/test.js index 007a76e..e083f67 100644 --- a/oxygen/js-debugger-importer/test.js +++ b/oxygen/js-debugger-importer/test.js @@ -1,34 +1,3 @@ -/* - * Unexpected things happen here... - */ - -function a() {} - -b = function() {} - -// Notice the weird behavior : - -typeof a; // object -typeof b; // function - -aclass = function () { - this.setFoo(1); - return this; -} - -typeof aclass; - -aclass.prototype.setFoo = function (v) { - this.foo = v; -} - -anObject = new aclass() ; - -anObject.setFoo(2); - -anObject.foo; - -// Also worth mentionning, you ***must*** use new and this doesn't work : -// -// anobject = aclass(); - +hello = function (){ + Packages.java.lang.System.out.println("Hello world."); +} \ No newline at end of file