├── src ├── test │ ├── resources │ │ ├── es-modules │ │ │ ├── josm │ │ │ │ ├── bar.js │ │ │ │ └── foo.mjs │ │ │ ├── foo.mjs │ │ │ ├── sub │ │ │ │ ├── bar.mjs │ │ │ │ └── baz.js │ │ │ ├── default-export.mjs │ │ │ └── es-modules.jar │ │ ├── jar-repos │ │ │ ├── jar-repo-2 │ │ │ │ ├── bar.js │ │ │ │ ├── foo │ │ │ │ │ └── baz.js │ │ │ │ └── module-1 │ │ │ │ │ └── index.js │ │ │ ├── .gitignore │ │ │ ├── jar-repo-2.jar │ │ │ └── Makefile │ │ ├── require │ │ │ ├── modules │ │ │ │ ├── emptyDir │ │ │ │ │ └── .gitkeep │ │ │ │ ├── sub │ │ │ │ │ ├── index.js │ │ │ │ │ ├── module3.js │ │ │ │ │ ├── module4 │ │ │ │ │ └── foo │ │ │ │ │ │ ├── module6.js │ │ │ │ │ │ └── module5.js │ │ │ │ ├── module2 │ │ │ │ ├── hello-world-message.js │ │ │ │ ├── module1.js │ │ │ │ ├── moduleWithIllegalSyntax.js │ │ │ │ └── module3.js │ │ │ ├── jar-modules │ │ │ │ └── modules │ │ │ │ │ ├── module11 │ │ │ │ │ ├── josm.js │ │ │ │ │ ├── module10.js │ │ │ │ │ └── sub │ │ │ │ │ ├── module13 │ │ │ │ │ └── module12.js │ │ │ ├── README │ │ │ └── jarmodules.jar │ │ ├── sample-modules │ │ │ ├── .gitignore │ │ │ ├── module-b │ │ │ │ ├── add.mjs │ │ │ │ ├── mult │ │ │ │ │ └── lib.mjs │ │ │ │ └── module-b.mjs │ │ │ ├── sample-modules.jar │ │ │ ├── Makefile │ │ │ ├── module-c │ │ │ │ └── module-c.mjs │ │ │ ├── module-a │ │ │ │ └── module-a.mjs │ │ │ └── README.md │ │ ├── sample-data-files │ │ │ ├── README.md │ │ │ ├── test-datasetutil-load.osm.gz │ │ │ ├── test-datasetutil-load.osm.gz-unknown-suffix │ │ │ ├── test-datasetutil-load.osc │ │ │ ├── test-datasetutil-load.osc-unknown-suffix │ │ │ ├── test-josm-open.osm │ │ │ ├── test-datasetutil-load.osm │ │ │ ├── test-datasetutil-load.osm-unknown-suffix │ │ │ └── test-josm-open.gpx │ │ ├── josm-test-environments │ │ │ └── env01 │ │ │ │ ├── README.md │ │ │ │ └── preferences.xml │ │ └── logging.properties │ ├── functional │ │ ├── javascript │ │ │ └── v3 │ │ │ │ ├── command-add-test.mjs │ │ │ │ ├── command-undo-redo-test.js │ │ │ │ ├── menu-bar-test.js │ │ │ │ ├── command-delete-test.js │ │ │ │ └── open-files-test.js │ │ ├── java │ │ │ └── org │ │ │ │ └── openstreetmap │ │ │ │ └── josm │ │ │ │ └── plugins │ │ │ │ └── scripting │ │ │ │ ├── preferences │ │ │ │ └── ScriptEnginesConfigurationPanelTest.java │ │ │ │ ├── ui │ │ │ │ ├── ScriptErrorDialogTest.java │ │ │ │ └── console │ │ │ │ │ ├── ScriptingConsolePanelTest.java │ │ │ │ │ ├── ScriptingConsoleTest.java │ │ │ │ │ └── ScriptingEngineInfoPanelTest.java │ │ │ │ ├── RunScriptDialogTest.java │ │ │ │ └── ScriptEngineSelectionDialogTest.java │ │ └── groovy │ │ │ └── org │ │ │ └── openstreetmap │ │ │ └── josm │ │ │ └── plugins │ │ │ └── scripting │ │ │ └── ui │ │ │ └── release │ │ │ └── ReleaseNotesTest.groovy │ ├── unit │ │ ├── groovy │ │ │ └── org │ │ │ │ └── openstreetmap │ │ │ │ └── josm │ │ │ │ └── plugins │ │ │ │ └── scripting │ │ │ │ ├── JOSMFixtureBasedTest.groovy │ │ │ │ ├── graalvm │ │ │ │ ├── with_graalvm │ │ │ │ │ ├── GraalVMEmbeddedInJosmTest.groovy │ │ │ │ │ ├── GraalVMAndRequireTest.groovy │ │ │ │ │ └── GraalVMEvalTest.groovy │ │ │ │ ├── GraalVMNotPresentTest.groovy │ │ │ │ ├── api │ │ │ │ │ ├── JSActionTest.groovy │ │ │ │ │ └── APIV3FunctionalTest.groovy │ │ │ │ ├── CommonJSModuleRepositoryFactoryTest.groovy │ │ │ │ ├── esmodule │ │ │ │ │ └── AbstractESModuleRepositoryTest.groovy │ │ │ │ └── ModuleIDTest.groovy │ │ │ │ ├── jsr223 │ │ │ │ └── JSR223CompatibleEnginePresentTest.groovy │ │ │ │ ├── BaseTestCase.groovy │ │ │ │ └── model │ │ │ │ └── ScriptEngineTypeTest.groovy │ │ └── javascript │ │ │ └── v3 │ │ │ └── suite.js │ └── common │ │ └── java │ │ └── org │ │ └── openstreetmap │ │ └── josm │ │ └── plugins │ │ └── scripting │ │ └── fixtures │ │ └── JOSMFixture.java └── main │ ├── javascript │ └── v3 │ │ ├── .gitignore │ │ ├── jsconfig.json │ │ ├── josm │ │ └── builder.mjs │ │ └── clipboard.mjs │ ├── resources │ ├── images │ │ ├── add.png │ │ ├── jar.png │ │ ├── run.png │ │ ├── error.gif │ │ ├── error.png │ │ ├── valid.png │ │ ├── directory.png │ │ ├── script-engine.png │ │ ├── media-playback-stop.png │ │ ├── media-playback-start.png │ │ ├── scripting-preference.png │ │ └── preferences │ │ │ └── script-engine.png │ ├── resources │ │ ├── mime.types.default │ │ ├── syntax-style-rules.properties │ │ └── script-engine-jars.properties │ ├── contrib │ │ ├── README.jsyntaxpane │ │ ├── LICENSE.RSyntaxTextArea │ │ └── LICENSE.graaljs │ ├── release-notes │ │ ├── release-notes.properties │ │ ├── v0.3.3.html │ │ ├── v0.3.4.html │ │ ├── v0.3.0.html │ │ ├── v0.3.5.html │ │ ├── v0.3.1.html │ │ ├── release-notes.css │ │ ├── v0.2.6.html │ │ ├── v0.2.5.html │ │ ├── v0.2.3.html │ │ ├── v0.2.0.html │ │ ├── v0.2.2.html │ │ ├── v0.2.4.html │ │ ├── v0.2.10.html │ │ └── v0.2.9.html │ ├── scripts │ │ ├── HelloWorld.py │ │ ├── HelloWorld.groovy │ │ └── HelloWorld.GraalJS.js │ ├── css │ │ └── default-editor-pane.css │ └── graalvm │ │ └── require-wrapper.mustache │ ├── java │ └── org │ │ └── openstreetmap │ │ └── josm │ │ └── plugins │ │ └── scripting │ │ ├── graalvm │ │ ├── esmodule │ │ │ └── IllegalESModuleBaseUri.java │ │ ├── GraalVMEvalException.java │ │ ├── RequireFunctionException.java │ │ ├── commonjs │ │ │ ├── IllegalCommonJSModuleBaseURI.java │ │ │ └── ICommonJSModuleRepository.java │ │ ├── IRepositoriesSource.java │ │ ├── GraalVMFacadeFactory.java │ │ └── TypeResolveFunction.java │ │ ├── ui │ │ ├── console │ │ │ ├── IScriptLog.java │ │ │ ├── CloseAction.java │ │ │ ├── DocumentWriter.java │ │ │ ├── SaveAsAction.java │ │ │ └── SaveAction.java │ │ ├── mru │ │ │ └── MostRecentlyRunScriptsComboBox.java │ │ ├── LaunchRunScriptDialogAction.java │ │ └── SwingUtil.java │ │ ├── util │ │ ├── FileUtils.java │ │ └── Assert.java │ │ ├── preferences │ │ ├── common │ │ │ ├── IconUtil.java │ │ │ └── ImportPathCellRenderer.java │ │ └── graalvm │ │ │ └── ESModuleRepoConfigurationPanel.java │ │ └── js │ │ └── api │ │ ├── CommandForPrimitive.java │ │ └── MultiCommand.java │ └── po │ ├── ak.po │ ├── jv.po │ ├── my.po │ ├── th.po │ ├── uz.po │ ├── yo.po │ ├── am.po │ ├── dv.po │ ├── ff.po │ ├── ha.po │ ├── kk.po │ ├── la.po │ ├── ne.po │ ├── ny.po │ ├── om.po │ ├── or.po │ ├── ps.po │ ├── sd.po │ ├── so.po │ ├── tl.po │ ├── ug.po │ ├── xh.po │ ├── zu.po │ ├── as.po │ ├── ceb.po │ ├── co.po │ ├── gu.po │ ├── ml.po │ ├── rm.po │ ├── rw.po │ ├── si.po │ ├── tk.po │ ├── hne.po │ ├── fa_IR.po │ ├── fr_FR.po │ ├── ht.po │ ├── zh_HK.po │ ├── ru_RU.po │ ├── fa.po │ ├── ku.po │ ├── lb.po │ ├── mg.po │ ├── kn.po │ ├── lo.po │ ├── ur.po │ ├── az.po │ ├── ky.po │ ├── hi.po │ ├── pa.po │ ├── en_CA.po │ ├── ia.po │ ├── cy.po │ ├── hy.po │ ├── st.po │ ├── fil.po │ ├── fo.po │ ├── ms.po │ ├── ga.po │ ├── mk.po │ ├── ro.po │ ├── af.po │ ├── ka.po │ ├── nn.po │ ├── bn.po │ ├── ar.po │ ├── tr.po │ ├── te.po │ ├── he.po │ ├── sq.po │ ├── br.po │ ├── bs.po │ ├── de_DE.po │ ├── sr.po │ ├── mr.po │ ├── oc.po │ ├── ta.po │ ├── sl.po │ ├── en_AU.po │ ├── km.po │ ├── vi.po │ ├── ca@valencia.po │ └── hr.po ├── jetbrains.png ├── testing ├── windows │ ├── .gitignore │ └── README.md └── linux │ ├── .gitignore │ ├── lib.sh │ └── README.md ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitmodules ├── .tx └── config ├── .gitignore ├── settings.gradle ├── jsdoc.sh ├── gradle.properties └── jsdoc.v3.conf /src/test/resources/es-modules/josm/bar.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/test/resources/es-modules/josm/foo.mjs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/test/resources/jar-repos/jar-repo-2/bar.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/main/javascript/v3/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /src/test/resources/jar-repos/.gitignore: -------------------------------------------------------------------------------- 1 | *.jar 2 | -------------------------------------------------------------------------------- /src/test/resources/jar-repos/jar-repo-2/foo/baz.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/test/resources/require/modules/emptyDir/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/test/resources/jar-repos/jar-repo-2/module-1/index.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/test/resources/sample-modules/.gitignore: -------------------------------------------------------------------------------- 1 | !sample-modules.jar -------------------------------------------------------------------------------- /src/test/resources/require/modules/sub/index.js: -------------------------------------------------------------------------------- 1 | // empty index file -------------------------------------------------------------------------------- /src/test/resources/require/modules/sub/module3.js: -------------------------------------------------------------------------------- 1 | exports.ok = true; -------------------------------------------------------------------------------- /src/test/resources/es-modules/foo.mjs: -------------------------------------------------------------------------------- 1 | const name = "foo" 2 | export {name} -------------------------------------------------------------------------------- /src/test/resources/require/jar-modules/modules/module11: -------------------------------------------------------------------------------- 1 | exports.ok = true; -------------------------------------------------------------------------------- /src/test/resources/require/modules/module2: -------------------------------------------------------------------------------- 1 | exports.message = "module 2" -------------------------------------------------------------------------------- /src/test/resources/require/jar-modules/modules/josm.js: -------------------------------------------------------------------------------- 1 | exports.ok = true; 2 | -------------------------------------------------------------------------------- /src/test/resources/require/jar-modules/modules/module10.js: -------------------------------------------------------------------------------- 1 | exports.ok = true; -------------------------------------------------------------------------------- /src/test/resources/require/jar-modules/modules/sub/module13: -------------------------------------------------------------------------------- 1 | exports.ok = true; -------------------------------------------------------------------------------- /src/test/resources/require/modules/sub/module4: -------------------------------------------------------------------------------- 1 | exports.message = "module 4" -------------------------------------------------------------------------------- /src/test/resources/es-modules/sub/bar.mjs: -------------------------------------------------------------------------------- 1 | const name = "sub/bar" 2 | export {name} -------------------------------------------------------------------------------- /src/test/resources/es-modules/sub/baz.js: -------------------------------------------------------------------------------- 1 | const name = "sub/baz" 2 | export {name} -------------------------------------------------------------------------------- /src/test/resources/require/jar-modules/modules/sub/module12.js: -------------------------------------------------------------------------------- 1 | exports.ok = true; -------------------------------------------------------------------------------- /src/test/resources/require/modules/sub/foo/module6.js: -------------------------------------------------------------------------------- 1 | exports.message = "module 6" -------------------------------------------------------------------------------- /src/test/resources/require/modules/hello-world-message.js: -------------------------------------------------------------------------------- 1 | exports.message = "hello-world" -------------------------------------------------------------------------------- /jetbrains.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gubaer/josm-scripting-plugin/HEAD/jetbrains.png -------------------------------------------------------------------------------- /src/test/resources/sample-modules/module-b/add.mjs: -------------------------------------------------------------------------------- 1 | export function add(a,b) { 2 | return a + b 3 | } -------------------------------------------------------------------------------- /src/test/resources/require/modules/module1.js: -------------------------------------------------------------------------------- 1 | /* 2 | * simple CommonJS module 3 | */ 4 | exports.ok = true; -------------------------------------------------------------------------------- /testing/windows/.gitignore: -------------------------------------------------------------------------------- 1 | *.jar 2 | jdk* 3 | josm-home 4 | graaljs-* 5 | graalvm-* 6 | logging.properties -------------------------------------------------------------------------------- /src/test/resources/sample-modules/module-b/mult/lib.mjs: -------------------------------------------------------------------------------- 1 | export function mult(a,b) { 2 | return a * b 3 | } -------------------------------------------------------------------------------- /src/test/resources/es-modules/default-export.mjs: -------------------------------------------------------------------------------- 1 | const value = { 2 | name: "default-export" 3 | } 4 | export default value -------------------------------------------------------------------------------- /src/test/resources/sample-modules/module-b/module-b.mjs: -------------------------------------------------------------------------------- 1 | export {mult} from './mult/lib.mjs' 2 | export {add} from './add.mjs' -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gubaer/josm-scripting-plugin/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /src/main/resources/images/add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gubaer/josm-scripting-plugin/HEAD/src/main/resources/images/add.png -------------------------------------------------------------------------------- /src/main/resources/images/jar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gubaer/josm-scripting-plugin/HEAD/src/main/resources/images/jar.png -------------------------------------------------------------------------------- /src/main/resources/images/run.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gubaer/josm-scripting-plugin/HEAD/src/main/resources/images/run.png -------------------------------------------------------------------------------- /src/main/resources/images/error.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gubaer/josm-scripting-plugin/HEAD/src/main/resources/images/error.gif -------------------------------------------------------------------------------- /src/main/resources/images/error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gubaer/josm-scripting-plugin/HEAD/src/main/resources/images/error.png -------------------------------------------------------------------------------- /src/main/resources/images/valid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gubaer/josm-scripting-plugin/HEAD/src/main/resources/images/valid.png -------------------------------------------------------------------------------- /src/test/resources/sample-data-files/README.md: -------------------------------------------------------------------------------- 1 | A collection of test files which are used in the unit and functional tests. 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/main/resources/images/directory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gubaer/josm-scripting-plugin/HEAD/src/main/resources/images/directory.png -------------------------------------------------------------------------------- /src/test/resources/require/README: -------------------------------------------------------------------------------- 1 | A couple of sample CommonJS modules, use to test the module 2 | lookup function in JOSMModuleScriptProvider -------------------------------------------------------------------------------- /src/test/resources/require/modules/moduleWithIllegalSyntax.js: -------------------------------------------------------------------------------- 1 | invalid Javascript source 2 | 3 | exports.message = "moduleWithIllegalSyntax" -------------------------------------------------------------------------------- /testing/linux/.gitignore: -------------------------------------------------------------------------------- 1 | *.jar 2 | graalvm-* 3 | graaljs-* 4 | *-openjdk-* 5 | jdk17 6 | jdk20 7 | jdk21 8 | josm-home 9 | logging.properties -------------------------------------------------------------------------------- /src/main/javascript/v3/jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6" 4 | }, 5 | "exclude": ["node_modules"] 6 | } -------------------------------------------------------------------------------- /src/test/resources/require/jarmodules.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gubaer/josm-scripting-plugin/HEAD/src/test/resources/require/jarmodules.jar -------------------------------------------------------------------------------- /src/main/resources/images/script-engine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gubaer/josm-scripting-plugin/HEAD/src/main/resources/images/script-engine.png -------------------------------------------------------------------------------- /src/test/resources/es-modules/es-modules.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gubaer/josm-scripting-plugin/HEAD/src/test/resources/es-modules/es-modules.jar -------------------------------------------------------------------------------- /src/test/resources/jar-repos/jar-repo-2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gubaer/josm-scripting-plugin/HEAD/src/test/resources/jar-repos/jar-repo-2.jar -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "docstrap"] 2 | path = docstrap 3 | url = https://github.com/Gubaer/docstrap.git 4 | branch = docstrap-for-jsom-scripting-plugin 5 | -------------------------------------------------------------------------------- /src/main/resources/images/media-playback-stop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gubaer/josm-scripting-plugin/HEAD/src/main/resources/images/media-playback-stop.png -------------------------------------------------------------------------------- /src/main/resources/images/media-playback-start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gubaer/josm-scripting-plugin/HEAD/src/main/resources/images/media-playback-start.png -------------------------------------------------------------------------------- /src/main/resources/images/scripting-preference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gubaer/josm-scripting-plugin/HEAD/src/main/resources/images/scripting-preference.png -------------------------------------------------------------------------------- /src/test/resources/sample-modules/sample-modules.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gubaer/josm-scripting-plugin/HEAD/src/test/resources/sample-modules/sample-modules.jar -------------------------------------------------------------------------------- /src/main/resources/images/preferences/script-engine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gubaer/josm-scripting-plugin/HEAD/src/main/resources/images/preferences/script-engine.png -------------------------------------------------------------------------------- /src/test/resources/require/modules/module3.js: -------------------------------------------------------------------------------- 1 | const { messages } = require("./sub/foo/module5") 2 | 3 | exports.messages = { 4 | ...messages, 5 | 'module3': 'module 3' 6 | } -------------------------------------------------------------------------------- /src/test/resources/jar-repos/Makefile: -------------------------------------------------------------------------------- 1 | clean: 2 | -rm *.jar 3 | 4 | rebuild: clean 5 | -cd jar-repo-1 && jar cvf ../jar-repo-1.jar * 6 | -cd jar-repo-2 && jar cvf ../jar-repo-2.jar * 7 | -------------------------------------------------------------------------------- /src/main/resources/resources/mime.types.default: -------------------------------------------------------------------------------- 1 | # 2 | # mime types for script files 3 | # 4 | application/x-groovy groovy 5 | application/javascript js jscript 6 | application/python py 7 | -------------------------------------------------------------------------------- /src/test/resources/require/modules/sub/foo/module5.js: -------------------------------------------------------------------------------- 1 | const { message } = require("./module6") 2 | 3 | exports.messages = { 4 | 'module5' : 'module 5', 5 | 'module6' : message 6 | } 7 | -------------------------------------------------------------------------------- /src/test/resources/sample-data-files/test-datasetutil-load.osm.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gubaer/josm-scripting-plugin/HEAD/src/test/resources/sample-data-files/test-datasetutil-load.osm.gz -------------------------------------------------------------------------------- /src/test/resources/sample-modules/Makefile: -------------------------------------------------------------------------------- 1 | clean: 2 | -rm sample-modules.jar 3 | 4 | sample-modules.jar: clean 5 | jar cf sample-modules.jar \ 6 | README.md \ 7 | module-a \ 8 | module-b \ 9 | module-c -------------------------------------------------------------------------------- /.tx/config: -------------------------------------------------------------------------------- 1 | [main] 2 | host = https://www.transifex.com 3 | 4 | [josm.josm-plugin_scripting] 5 | file_filter = src/main/po/.po 6 | source_file = build/i18n/josm-plugin_scripting.pot 7 | source_lang = en 8 | type = PO 9 | -------------------------------------------------------------------------------- /src/test/resources/sample-data-files/test-datasetutil-load.osm.gz-unknown-suffix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gubaer/josm-scripting-plugin/HEAD/src/test/resources/sample-data-files/test-datasetutil-load.osm.gz-unknown-suffix -------------------------------------------------------------------------------- /src/test/resources/josm-test-environments/env01/README.md: -------------------------------------------------------------------------------- 1 | Environment used in task `testGraalVMSupportPresent`. 2 | 3 | `preferences.xml` is copied to `$PROJECT_HOME_DIR/test/josm.home/preferences.xml` 4 | before the tests are executed. 5 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /src/test/resources/logging.properties: -------------------------------------------------------------------------------- 1 | handlers=java.util.logging.ConsoleHandler 2 | .level=INFO 3 | java.util.logging.ConsoleHandler.level=FINE 4 | java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter 5 | #org.openstreetmap.josm.plugins.scripting.level=FINE 6 | -------------------------------------------------------------------------------- /src/main/resources/contrib/README.jsyntaxpane: -------------------------------------------------------------------------------- 1 | jsyntaxpane by Ayman Al-Sairafi et. al. is available under Apache 2 | Licese 2.0 from . See included 3 | LICENSE.jsyntaxpane for applicable license information. 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/test/resources/sample-modules/module-c/module-c.mjs: -------------------------------------------------------------------------------- 1 | import {add} from 'module-a/module-a.mjs' 2 | import {mult} from 'module-b/module-b.mjs' 3 | 4 | export function computeResult() { 5 | const r1 = add(1,1) 6 | const r2 = mult(2,2) 7 | const result = [r1, r2] 8 | return result 9 | } 10 | -------------------------------------------------------------------------------- /src/main/resources/resources/syntax-style-rules.properties: -------------------------------------------------------------------------------- 1 | # suppress inspection "UnusedProperty" for whole file 2 | 3 | rule.1.syntax-style=text/javascript 4 | rule.1.regexp=(?i).*javascript.* 5 | 6 | rule.2.syntax-style=text/groovy 7 | rule.2.regexp=(?i).*groovy.* 8 | 9 | rule.3.syntax-style=text/python 10 | rule.3.regexp=(?i).*python.* 11 | -------------------------------------------------------------------------------- /src/test/resources/sample-data-files/test-datasetutil-load.osc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/test/resources/sample-data-files/test-datasetutil-load.osc-unknown-suffix: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | bin 2 | build.properties 3 | jsdoc.log 4 | version-information.MF 5 | /build 6 | .classpath 7 | .buildpath 8 | .gradle 9 | .project 10 | .settings 11 | jsdoc.local.sh 12 | libs 13 | out 14 | .idea 15 | *.iml 16 | *.env 17 | releases 18 | dist 19 | node_modules 20 | package-lock.json 21 | doc 22 | out-ng 23 | software 24 | package.json 25 | releases.generated.yml 26 | set-env.ps1 27 | .jython_cache 28 | -------------------------------------------------------------------------------- /src/main/resources/release-notes/release-notes.properties: -------------------------------------------------------------------------------- 1 | # suppress inspection "UnusedProperty" for whole file 2 | # 3 | # comma-separated list of available release notes 4 | release-notes=\ 5 | v0.3.5, \ 6 | v0.3.4, \ 7 | v0.3.3, \ 8 | v0.3.1, \ 9 | v0.3.0, \ 10 | v0.2.10, \ 11 | v0.2.9, \ 12 | v0.2.6, \ 13 | v0.2.5, \ 14 | v0.2.4, \ 15 | v0.2.3, \ 16 | v0.2.2, \ 17 | v0.2.0 18 | 19 | -------------------------------------------------------------------------------- /src/main/resources/release-notes/v0.3.3.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Release notes 4 | 5 |

Release v0.3.3

6 | 7 | See GitHub release v0.3.3 8 | 9 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/test/resources/sample-modules/module-a/module-a.mjs: -------------------------------------------------------------------------------- 1 | /* 2 | * Module 'module-a' exports a single function 'add'. 3 | * 4 | * Here's a sample script using the module 5 | *
 6 |  * import {add} from 'module-a'
 7 |  * import * as console from 'josm/scriptingconsole'
 8 |  * const b = add(1,1)
 9 |  * console.println(`result: ${b}`)
10 |  * 
11 | */ 12 | export function add(a, b) { 13 | return a + b 14 | } -------------------------------------------------------------------------------- /src/main/resources/scripts/HelloWorld.py: -------------------------------------------------------------------------------- 1 | # 2 | # HelloWorld.py - displays the number of open layers 3 | # 4 | from javax.swing import JOptionPane 5 | from org.openstreetmap.josm.gui import MainApplication 6 | 7 | num_layers = MainApplication.getLayerManager().getLayers().size() 8 | JOptionPane.showMessageDialog( 9 | MainApplication.getMainFrame(), 10 | "[Python] Hello World! You have %s layer(s)." % num_layers) 11 | -------------------------------------------------------------------------------- /src/main/resources/scripts/HelloWorld.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * HelloWorld.groovy - displays the number of open layers 3 | */ 4 | 5 | import javax.swing.JOptionPane 6 | import org.openstreetmap.josm.gui.MainApplication 7 | 8 | def numLayers = MainApplication.getLayerManager().getLayers().size() 9 | JOptionPane.showMessageDialog( 10 | MainApplication.getMainFrame(), 11 | "[Groovy] Hello World! You have $numLayers layer(s)." 12 | ) 13 | -------------------------------------------------------------------------------- /src/main/java/org/openstreetmap/josm/plugins/scripting/graalvm/esmodule/IllegalESModuleBaseUri.java: -------------------------------------------------------------------------------- 1 | package org.openstreetmap.josm.plugins.scripting.graalvm.esmodule; 2 | 3 | public class IllegalESModuleBaseUri extends Exception { 4 | public IllegalESModuleBaseUri(String message) { 5 | super(message); 6 | } 7 | public IllegalESModuleBaseUri(String message, Throwable cause) { 8 | super(message, cause); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /testing/linux/lib.sh: -------------------------------------------------------------------------------- 1 | function check_software() { 2 | local wget 3 | local jq 4 | 5 | wget=`which wget` 6 | if [ "$wget" = "" ] ; then 7 | echo "fatal: this script requires 'wget'. Install it with 'sudo apt install -y wget'." 8 | return 1 9 | fi 10 | 11 | jq=`which jq` 12 | if [ "$jq" = "" ] ; then 13 | echo "fatal: this script requires 'jq'. Install it with 'sudo apt install -y jq'." 14 | return 1 15 | fi 16 | return 0 17 | } -------------------------------------------------------------------------------- /src/main/resources/release-notes/v0.3.4.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Release notes 4 | 5 |

Release v0.3.4

6 | 7 | See GitHub release v0.3.4 8 | 9 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/main/resources/scripts/HelloWorld.GraalJS.js: -------------------------------------------------------------------------------- 1 | /* 2 | * HelloWorld.js - displays the number of open layers 3 | */ 4 | 5 | const JOptionPane = Java.type('javax.swing.JOptionPane') 6 | const MainApplication = Java.type('org.openstreetmap.josm.gui.MainApplication') 7 | 8 | const numLayers = MainApplication.getLayerManager().getLayers().size() 9 | JOptionPane.showMessageDialog( 10 | MainApplication.getMainFrame(), 11 | `[JavaScript] Hello World! You have ${numLayers} layers(s)` 12 | ) 13 | -------------------------------------------------------------------------------- /src/test/resources/sample-data-files/test-josm-open.osm: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 16 | 17 | -------------------------------------------------------------------------------- /src/test/resources/sample-data-files/test-datasetutil-load.osm: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 16 | 17 | -------------------------------------------------------------------------------- /src/test/resources/sample-data-files/test-datasetutil-load.osm-unknown-suffix: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 16 | 17 | -------------------------------------------------------------------------------- /src/main/resources/css/default-editor-pane.css: -------------------------------------------------------------------------------- 1 | /* 2 | * the default style sheet in instances JEditorPane 3 | */ 4 | a { 5 | text-decoration: underline; 6 | color: blue; 7 | } 8 | 9 | code { 10 | font-family: monospace; 11 | } 12 | 13 | p { 14 | padding-bottom: 10pt; 15 | } 16 | 17 | p.warning { 18 | background: #ffcccb; 19 | padding: 10pt; 20 | border-style: solid; 21 | border-color: red; 22 | border-width: 2pt; 23 | } 24 | 25 | span.warning { 26 | font-weight: bold; 27 | color: red; 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/openstreetmap/josm/plugins/scripting/graalvm/GraalVMEvalException.java: -------------------------------------------------------------------------------- 1 | package org.openstreetmap.josm.plugins.scripting.graalvm; 2 | 3 | @SuppressWarnings({"unused", "WeakerAccess"}) 4 | public class GraalVMEvalException extends Exception { 5 | public GraalVMEvalException() { 6 | super(); 7 | } 8 | 9 | public GraalVMEvalException(String message) { 10 | super(message); 11 | } 12 | 13 | public GraalVMEvalException(String message, Throwable cause) { 14 | super(message, cause); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/resources/resources/script-engine-jars.properties: -------------------------------------------------------------------------------- 1 | # suppress inspection "UnusedProperty" for whole file 2 | # 3 | # display name and download URLs for a set of scripting engines the JOSM 4 | # Scripting Plugin can download automatically 5 | # 6 | engines=jython,jruby 7 | 8 | jython.name=Jython 9 | jython.download-url=https://repo1.maven.org/maven2/org/python/jython-standalone/2.7.4/jython-standalone-2.7.4.jar 10 | 11 | jruby.name=JRuby 12 | jruby.download-url=https://repo1.maven.org/maven2/org/jruby/jruby-complete/9.4.11.0/jruby-complete-9.4.11.0.jar 13 | -------------------------------------------------------------------------------- /src/main/java/org/openstreetmap/josm/plugins/scripting/graalvm/RequireFunctionException.java: -------------------------------------------------------------------------------- 1 | package org.openstreetmap.josm.plugins.scripting.graalvm; 2 | 3 | @SuppressWarnings({"unused", "WeakerAccess"}) 4 | public class RequireFunctionException extends RuntimeException { 5 | public RequireFunctionException() { 6 | super(); 7 | } 8 | 9 | public RequireFunctionException(String message) { 10 | super(message); 11 | } 12 | 13 | public RequireFunctionException(String message, Throwable cause) { 14 | super(message, cause); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/test/resources/josm-test-environments/env01/preferences.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/main/java/org/openstreetmap/josm/plugins/scripting/graalvm/commonjs/IllegalCommonJSModuleBaseURI.java: -------------------------------------------------------------------------------- 1 | package org.openstreetmap.josm.plugins.scripting.graalvm.commonjs; 2 | 3 | @SuppressWarnings("unused") 4 | public class IllegalCommonJSModuleBaseURI extends Exception { 5 | public IllegalCommonJSModuleBaseURI(String s) { 6 | super(s); 7 | } 8 | 9 | public IllegalCommonJSModuleBaseURI(Throwable throwable) { 10 | super(throwable); 11 | } 12 | 13 | public IllegalCommonJSModuleBaseURI(String s, Throwable throwable) { 14 | super(s, throwable); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/test/functional/javascript/v3/command-add-test.mjs: -------------------------------------------------------------------------------- 1 | 2 | import josm from 'josm' 3 | import {buildAddCommand} from 'josm/command' 4 | import {NodeBuilder} from 'josm/builder' 5 | import * as util from 'josm/util' 6 | 7 | 8 | function addASingleNode() { 9 | const layer = josm.layers.addDataLayer() 10 | const node = NodeBuilder.create() 11 | 12 | // add a node to a layer 13 | buildAddCommand(node).applyTo(layer) 14 | const ds = layer.getDataSet() 15 | util.assert(ds.containsNode(node), `ds doesn't include node ${node}`) 16 | } 17 | 18 | export function run() { 19 | addASingleNode() 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/org/openstreetmap/josm/plugins/scripting/ui/console/IScriptLog.java: -------------------------------------------------------------------------------- 1 | package org.openstreetmap.josm.plugins.scripting.ui.console; 2 | 3 | import java.io.PrintWriter; 4 | 5 | import javax.swing.Action; 6 | 7 | public interface IScriptLog { 8 | 9 | /** 10 | * Replies the action for clearing the log content. 11 | * 12 | * @return the action 13 | */ 14 | Action getClearAction(); 15 | 16 | /** 17 | * Replies a writer for appending text to the log. 18 | * 19 | * @return the writer 20 | */ 21 | @SuppressWarnings("unused") 22 | PrintWriter getLogWriter(); 23 | } 24 | -------------------------------------------------------------------------------- /src/main/resources/release-notes/v0.3.0.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

Release v0.3.0

6 | 7 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/test/unit/groovy/org/openstreetmap/josm/plugins/scripting/JOSMFixtureBasedTest.groovy: -------------------------------------------------------------------------------- 1 | package org.openstreetmap.josm.plugins.scripting 2 | 3 | import org.junit.jupiter.api.AfterEach 4 | import org.junit.jupiter.api.BeforeEach 5 | import org.openstreetmap.josm.plugins.scripting.fixtures.JOSMFixture 6 | 7 | class JOSMFixtureBasedTest extends BaseTestCase { 8 | protected JOSMFixture fixture 9 | 10 | @BeforeEach 11 | void initJOSMFixture() throws Exception { 12 | fixture = JOSMFixture.createFixture(true /* with gui */) 13 | } 14 | 15 | @AfterEach 16 | void tearDownJOSMFixture() { 17 | fixture = null 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/org/openstreetmap/josm/plugins/scripting/util/FileUtils.java: -------------------------------------------------------------------------------- 1 | package org.openstreetmap.josm.plugins.scripting.util; 2 | 3 | import java.io.*; 4 | import java.nio.charset.StandardCharsets; 5 | 6 | public class FileUtils { 7 | 8 | /** 9 | * Builds a reader which reads from a UTF-8 encoded text file 10 | * 11 | * @param file the text file 12 | * @return the reader 13 | * @throws IOException 14 | */ 15 | public static Reader buildTextFileReader(File file) throws IOException { 16 | return new InputStreamReader( 17 | new FileInputStream(file), 18 | StandardCharsets.UTF_8 19 | ); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/po/ak.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (ak) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 11 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 12 | "Language-Team: Akan (https://www.transifex.com/josm/teams/2544/ak/)\n" 13 | "MIME-Version: 1.0\n" 14 | "Content-Type: text/plain; charset=UTF-8\n" 15 | "Content-Transfer-Encoding: 8bit\n" 16 | "Language: ak\n" 17 | "Plural-Forms: nplurals=2; plural=n > 1;\n" 18 | -------------------------------------------------------------------------------- /src/main/po/jv.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (jv) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 11 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 12 | "Language-Team: Javanese (https://www.transifex.com/josm/teams/2544/jv/)\n" 13 | "MIME-Version: 1.0\n" 14 | "Content-Type: text/plain; charset=UTF-8\n" 15 | "Content-Transfer-Encoding: 8bit\n" 16 | "Language: jv\n" 17 | "Plural-Forms: nplurals=1; plural=0;\n" 18 | -------------------------------------------------------------------------------- /src/main/po/my.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (my) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 11 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 12 | "Language-Team: Burmese (https://www.transifex.com/josm/teams/2544/my/)\n" 13 | "MIME-Version: 1.0\n" 14 | "Content-Type: text/plain; charset=UTF-8\n" 15 | "Content-Transfer-Encoding: 8bit\n" 16 | "Language: my\n" 17 | "Plural-Forms: nplurals=1; plural=0;\n" 18 | -------------------------------------------------------------------------------- /src/main/po/th.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (th) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 11 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 12 | "Language-Team: Thai (https://www.transifex.com/josm/teams/2544/th/)\n" 13 | "MIME-Version: 1.0\n" 14 | "Content-Type: text/plain; charset=UTF-8\n" 15 | "Content-Transfer-Encoding: 8bit\n" 16 | "Language: th\n" 17 | "Plural-Forms: nplurals=1; plural=0;\n" 18 | -------------------------------------------------------------------------------- /src/main/po/uz.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (uz) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 11 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 12 | "Language-Team: Uzbek (https://www.transifex.com/josm/teams/2544/uz/)\n" 13 | "MIME-Version: 1.0\n" 14 | "Content-Type: text/plain; charset=UTF-8\n" 15 | "Content-Transfer-Encoding: 8bit\n" 16 | "Language: uz\n" 17 | "Plural-Forms: nplurals=1; plural=0;\n" 18 | -------------------------------------------------------------------------------- /src/main/po/yo.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (yo) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 11 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 12 | "Language-Team: Yoruba (https://www.transifex.com/josm/teams/2544/yo/)\n" 13 | "MIME-Version: 1.0\n" 14 | "Content-Type: text/plain; charset=UTF-8\n" 15 | "Content-Transfer-Encoding: 8bit\n" 16 | "Language: yo\n" 17 | "Plural-Forms: nplurals=1; plural=0;\n" 18 | -------------------------------------------------------------------------------- /src/main/po/am.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (am) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 11 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 12 | "Language-Team: Amharic (https://www.transifex.com/josm/teams/2544/am/)\n" 13 | "MIME-Version: 1.0\n" 14 | "Content-Type: text/plain; charset=UTF-8\n" 15 | "Content-Transfer-Encoding: 8bit\n" 16 | "Language: am\n" 17 | "Plural-Forms: nplurals=2; plural=(n > 1);\n" 18 | -------------------------------------------------------------------------------- /src/main/po/dv.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (dv) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 11 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 12 | "Language-Team: Divehi (https://www.transifex.com/josm/teams/2544/dv/)\n" 13 | "MIME-Version: 1.0\n" 14 | "Content-Type: text/plain; charset=UTF-8\n" 15 | "Content-Transfer-Encoding: 8bit\n" 16 | "Language: dv\n" 17 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 18 | -------------------------------------------------------------------------------- /src/main/po/ff.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (ff) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 11 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 12 | "Language-Team: Fulah (https://www.transifex.com/josm/teams/2544/ff/)\n" 13 | "MIME-Version: 1.0\n" 14 | "Content-Type: text/plain; charset=UTF-8\n" 15 | "Content-Transfer-Encoding: 8bit\n" 16 | "Language: ff\n" 17 | "Plural-Forms: nplurals=2; plural=(n >= 2);\n" 18 | -------------------------------------------------------------------------------- /src/main/po/ha.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (ha) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 11 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 12 | "Language-Team: Hausa (https://www.transifex.com/josm/teams/2544/ha/)\n" 13 | "MIME-Version: 1.0\n" 14 | "Content-Type: text/plain; charset=UTF-8\n" 15 | "Content-Transfer-Encoding: 8bit\n" 16 | "Language: ha\n" 17 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 18 | -------------------------------------------------------------------------------- /src/main/po/kk.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (kk) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 11 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 12 | "Language-Team: Kazakh (https://www.transifex.com/josm/teams/2544/kk/)\n" 13 | "MIME-Version: 1.0\n" 14 | "Content-Type: text/plain; charset=UTF-8\n" 15 | "Content-Transfer-Encoding: 8bit\n" 16 | "Language: kk\n" 17 | "Plural-Forms: nplurals=2; plural=(n!=1);\n" 18 | -------------------------------------------------------------------------------- /src/main/po/la.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (la) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 11 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 12 | "Language-Team: Latin (https://www.transifex.com/josm/teams/2544/la/)\n" 13 | "MIME-Version: 1.0\n" 14 | "Content-Type: text/plain; charset=UTF-8\n" 15 | "Content-Transfer-Encoding: 8bit\n" 16 | "Language: la\n" 17 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 18 | -------------------------------------------------------------------------------- /src/main/po/ne.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (ne) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 11 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 12 | "Language-Team: Nepali (https://www.transifex.com/josm/teams/2544/ne/)\n" 13 | "MIME-Version: 1.0\n" 14 | "Content-Type: text/plain; charset=UTF-8\n" 15 | "Content-Transfer-Encoding: 8bit\n" 16 | "Language: ne\n" 17 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 18 | -------------------------------------------------------------------------------- /src/main/po/ny.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (ny) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 11 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 12 | "Language-Team: Nyanja (https://www.transifex.com/josm/teams/2544/ny/)\n" 13 | "MIME-Version: 1.0\n" 14 | "Content-Type: text/plain; charset=UTF-8\n" 15 | "Content-Transfer-Encoding: 8bit\n" 16 | "Language: ny\n" 17 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 18 | -------------------------------------------------------------------------------- /src/main/po/om.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (om) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 11 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 12 | "Language-Team: Oromo (https://www.transifex.com/josm/teams/2544/om/)\n" 13 | "MIME-Version: 1.0\n" 14 | "Content-Type: text/plain; charset=UTF-8\n" 15 | "Content-Transfer-Encoding: 8bit\n" 16 | "Language: om\n" 17 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 18 | -------------------------------------------------------------------------------- /src/main/po/or.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (or) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 11 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 12 | "Language-Team: Odia (https://www.transifex.com/josm/teams/2544/or/)\n" 13 | "MIME-Version: 1.0\n" 14 | "Content-Type: text/plain; charset=UTF-8\n" 15 | "Content-Transfer-Encoding: 8bit\n" 16 | "Language: or\n" 17 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 18 | -------------------------------------------------------------------------------- /src/main/po/ps.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (ps) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 11 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 12 | "Language-Team: Pashto (https://www.transifex.com/josm/teams/2544/ps/)\n" 13 | "MIME-Version: 1.0\n" 14 | "Content-Type: text/plain; charset=UTF-8\n" 15 | "Content-Transfer-Encoding: 8bit\n" 16 | "Language: ps\n" 17 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 18 | -------------------------------------------------------------------------------- /src/main/po/sd.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (sd) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 11 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 12 | "Language-Team: Sindhi (https://www.transifex.com/josm/teams/2544/sd/)\n" 13 | "MIME-Version: 1.0\n" 14 | "Content-Type: text/plain; charset=UTF-8\n" 15 | "Content-Transfer-Encoding: 8bit\n" 16 | "Language: sd\n" 17 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 18 | -------------------------------------------------------------------------------- /src/main/po/so.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (so) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 11 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 12 | "Language-Team: Somali (https://www.transifex.com/josm/teams/2544/so/)\n" 13 | "MIME-Version: 1.0\n" 14 | "Content-Type: text/plain; charset=UTF-8\n" 15 | "Content-Transfer-Encoding: 8bit\n" 16 | "Language: so\n" 17 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 18 | -------------------------------------------------------------------------------- /src/main/po/tl.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (tl) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 11 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 12 | "Language-Team: Tagalog (https://www.transifex.com/josm/teams/2544/tl/)\n" 13 | "MIME-Version: 1.0\n" 14 | "Content-Type: text/plain; charset=UTF-8\n" 15 | "Content-Transfer-Encoding: 8bit\n" 16 | "Language: tl\n" 17 | "Plural-Forms: nplurals=2; plural=(n > 1);\n" 18 | -------------------------------------------------------------------------------- /src/main/po/ug.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (ug) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 11 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 12 | "Language-Team: Uyghur (https://www.transifex.com/josm/teams/2544/ug/)\n" 13 | "MIME-Version: 1.0\n" 14 | "Content-Type: text/plain; charset=UTF-8\n" 15 | "Content-Transfer-Encoding: 8bit\n" 16 | "Language: ug\n" 17 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 18 | -------------------------------------------------------------------------------- /src/main/po/xh.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (xh) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 11 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 12 | "Language-Team: Xhosa (https://www.transifex.com/josm/teams/2544/xh/)\n" 13 | "MIME-Version: 1.0\n" 14 | "Content-Type: text/plain; charset=UTF-8\n" 15 | "Content-Transfer-Encoding: 8bit\n" 16 | "Language: xh\n" 17 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 18 | -------------------------------------------------------------------------------- /src/main/po/zu.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (zu) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 11 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 12 | "Language-Team: Zulu (https://www.transifex.com/josm/teams/2544/zu/)\n" 13 | "MIME-Version: 1.0\n" 14 | "Content-Type: text/plain; charset=UTF-8\n" 15 | "Content-Transfer-Encoding: 8bit\n" 16 | "Language: zu\n" 17 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 18 | -------------------------------------------------------------------------------- /src/main/po/as.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (as) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 11 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 12 | "Language-Team: Assamese (https://www.transifex.com/josm/teams/2544/as/)\n" 13 | "MIME-Version: 1.0\n" 14 | "Content-Type: text/plain; charset=UTF-8\n" 15 | "Content-Transfer-Encoding: 8bit\n" 16 | "Language: as\n" 17 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 18 | -------------------------------------------------------------------------------- /src/main/po/ceb.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (ceb) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 11 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 12 | "Language-Team: Cebuano (https://www.transifex.com/josm/teams/2544/ceb/)\n" 13 | "MIME-Version: 1.0\n" 14 | "Content-Type: text/plain; charset=UTF-8\n" 15 | "Content-Transfer-Encoding: 8bit\n" 16 | "Language: ceb\n" 17 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 18 | -------------------------------------------------------------------------------- /src/main/po/co.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (co) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 11 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 12 | "Language-Team: Corsican (https://www.transifex.com/josm/teams/2544/co/)\n" 13 | "MIME-Version: 1.0\n" 14 | "Content-Type: text/plain; charset=UTF-8\n" 15 | "Content-Transfer-Encoding: 8bit\n" 16 | "Language: co\n" 17 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 18 | -------------------------------------------------------------------------------- /src/main/po/gu.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (gu) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 11 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 12 | "Language-Team: Gujarati (https://www.transifex.com/josm/teams/2544/gu/)\n" 13 | "MIME-Version: 1.0\n" 14 | "Content-Type: text/plain; charset=UTF-8\n" 15 | "Content-Transfer-Encoding: 8bit\n" 16 | "Language: gu\n" 17 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 18 | -------------------------------------------------------------------------------- /src/main/po/ml.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (ml) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 11 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 12 | "Language-Team: Malayalam (https://www.transifex.com/josm/teams/2544/ml/)\n" 13 | "MIME-Version: 1.0\n" 14 | "Content-Type: text/plain; charset=UTF-8\n" 15 | "Content-Transfer-Encoding: 8bit\n" 16 | "Language: ml\n" 17 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 18 | -------------------------------------------------------------------------------- /src/main/po/rm.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (rm) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 11 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 12 | "Language-Team: Romansh (https://www.transifex.com/josm/teams/2544/rm/)\n" 13 | "MIME-Version: 1.0\n" 14 | "Content-Type: text/plain; charset=UTF-8\n" 15 | "Content-Transfer-Encoding: 8bit\n" 16 | "Language: rm\n" 17 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 18 | -------------------------------------------------------------------------------- /src/main/po/rw.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (rw) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 11 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 12 | "Language-Team: Kinyarwanda (https://www.transifex.com/josm/teams/2544/rw/)\n" 13 | "MIME-Version: 1.0\n" 14 | "Content-Type: text/plain; charset=UTF-8\n" 15 | "Content-Transfer-Encoding: 8bit\n" 16 | "Language: rw\n" 17 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 18 | -------------------------------------------------------------------------------- /src/main/po/si.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (si) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 11 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 12 | "Language-Team: Sinhala (https://www.transifex.com/josm/teams/2544/si/)\n" 13 | "MIME-Version: 1.0\n" 14 | "Content-Type: text/plain; charset=UTF-8\n" 15 | "Content-Transfer-Encoding: 8bit\n" 16 | "Language: si\n" 17 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 18 | -------------------------------------------------------------------------------- /src/main/po/tk.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (tk) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 11 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 12 | "Language-Team: Turkmen (https://www.transifex.com/josm/teams/2544/tk/)\n" 13 | "MIME-Version: 1.0\n" 14 | "Content-Type: text/plain; charset=UTF-8\n" 15 | "Content-Transfer-Encoding: 8bit\n" 16 | "Language: tk\n" 17 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 18 | -------------------------------------------------------------------------------- /src/main/po/hne.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (hne) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 11 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 12 | "Language-Team: Chhattisgarhi (https://www.transifex.com/josm/teams/2544/hne/)\n" 13 | "MIME-Version: 1.0\n" 14 | "Content-Type: text/plain; charset=UTF-8\n" 15 | "Content-Transfer-Encoding: 8bit\n" 16 | "Language: hne\n" 17 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 18 | -------------------------------------------------------------------------------- /src/main/po/fa_IR.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (fa_IR) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 11 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 12 | "Language-Team: Persian (Iran) (https://www.transifex.com/josm/teams/2544/fa_IR/)\n" 13 | "MIME-Version: 1.0\n" 14 | "Content-Type: text/plain; charset=UTF-8\n" 15 | "Content-Transfer-Encoding: 8bit\n" 16 | "Language: fa_IR\n" 17 | "Plural-Forms: nplurals=2; plural=(n > 1);\n" 18 | -------------------------------------------------------------------------------- /src/main/po/fr_FR.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (fr_FR) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 11 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 12 | "Language-Team: French (France) (https://www.transifex.com/josm/teams/2544/fr_FR/)\n" 13 | "MIME-Version: 1.0\n" 14 | "Content-Type: text/plain; charset=UTF-8\n" 15 | "Content-Transfer-Encoding: 8bit\n" 16 | "Language: fr_FR\n" 17 | "Plural-Forms: nplurals=2; plural=(n > 1);\n" 18 | -------------------------------------------------------------------------------- /src/main/po/ht.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (ht) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 11 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 12 | "Language-Team: Haitian (Haitian Creole) (https://www.transifex.com/josm/teams/2544/ht/)\n" 13 | "MIME-Version: 1.0\n" 14 | "Content-Type: text/plain; charset=UTF-8\n" 15 | "Content-Transfer-Encoding: 8bit\n" 16 | "Language: ht\n" 17 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 18 | -------------------------------------------------------------------------------- /src/main/po/zh_HK.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (zh_HK) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 11 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 12 | "Language-Team: Chinese (Hong Kong) (https://www.transifex.com/josm/teams/2544/zh_HK/)\n" 13 | "MIME-Version: 1.0\n" 14 | "Content-Type: text/plain; charset=UTF-8\n" 15 | "Content-Transfer-Encoding: 8bit\n" 16 | "Language: zh_HK\n" 17 | "Plural-Forms: nplurals=1; plural=0;\n" 18 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | mavenLocal() 4 | //NOTE: resolving a custom fork of the gradle-josm-plugin published to 5 | // this Amazon S3 bucket doesn't work. Gradle can't resolve sub modules 6 | // like 'common' or 'dogfood' 7 | maven { 8 | url "http://gradle-josm-plugin.s3-website-eu-west-1.amazonaws.com" 9 | allowInsecureProtocol true 10 | content { 11 | includeModule("org.openstreetmap.josm", "gradle-josm-plugin") 12 | includeModule("org.openstreetmap.josm", "org.openstreetmap.josm.gradle.plugin") 13 | } 14 | } 15 | gradlePluginPortal() 16 | mavenCentral() 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/org/openstreetmap/josm/plugins/scripting/ui/mru/MostRecentlyRunScriptsComboBox.java: -------------------------------------------------------------------------------- 1 | package org.openstreetmap.josm.plugins.scripting.ui.mru; 2 | 3 | import javax.swing.*; 4 | import javax.swing.text.JTextComponent; 5 | 6 | public class MostRecentlyRunScriptsComboBox extends JComboBox { 7 | 8 | public MostRecentlyRunScriptsComboBox(MostRecentlyRunScriptsModel model) { 9 | setModel(model.getComboBoxModel()); 10 | setEditable(true); 11 | } 12 | 13 | public String getText() { 14 | return ((JTextComponent) getEditor().getEditorComponent()).getText(); 15 | } 16 | 17 | public void setText(String value) { 18 | ((JTextComponent) getEditor().getEditorComponent()).setText(value); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/javascript/v3/josm/builder.mjs: -------------------------------------------------------------------------------- 1 | /** 2 | * Collection of builders for creating OSM nodes, ways and relations. 3 | * 4 | * @module josm/builder 5 | * @example 6 | * // josm/builder exports the NodeBuilder, WayBuilder, and RelationBuilder 7 | * // from its sub modules 8 | * import { 9 | * NodeBuilder, 10 | * WayBuilder, 11 | * RelationBuilder 12 | * } from 'josm/builder' 13 | * 14 | * @see module:josm/builder/node~NodeBuilder 15 | * @see module:josm/builder/way~WayBuilder 16 | * @see module:josm/builder/relation~RelationBuilder 17 | */ 18 | 19 | export const DataSet = Java.type('org.openstreetmap.josm.data.osm.DataSet') 20 | 21 | export * from './builder/node-builder' 22 | export * from './builder/way-builder' 23 | export * from './builder/relation-builder' -------------------------------------------------------------------------------- /src/main/resources/release-notes/v0.3.5.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Release notes 4 | 5 |

Release v0.3.5

6 | 7 | See GitHub release v0.3.5 8 | 9 |
    10 |
  • FeatureWhen running a Python script, add the script's directory to sys.path before executing the script (see also #112)
  • 11 |
  • FeatureWhen running a Python script, add the environment variable JYTHONPATH to sys.path before executing the script (see also #112)
  • 12 |
13 | 14 | 15 | -------------------------------------------------------------------------------- /src/main/java/org/openstreetmap/josm/plugins/scripting/util/Assert.java: -------------------------------------------------------------------------------- 1 | package org.openstreetmap.josm.plugins.scripting.util; 2 | 3 | import java.text.MessageFormat; 4 | 5 | public class Assert { 6 | 7 | public static void assertArg(boolean condition, String message, 8 | Object...objs) { 9 | if (!condition){ 10 | throw new IllegalArgumentException( 11 | MessageFormat.format(message, objs) 12 | ); 13 | } 14 | } 15 | public static void assertState(boolean condition, String message, 16 | Object... objs) { 17 | if (!condition) { 18 | throw new IllegalStateException( 19 | MessageFormat.format(message, objs) 20 | ); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/resources/release-notes/v0.3.1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Release notes 4 | 5 |

Release v0.3.1

6 | 7 | See GitHub release v0.3.1 8 | 9 |
    10 |
  • Feature request: menu entries for most recently run scripts remember the scripting engine, see #107
  • 11 |
  • Minor: toolbar buttons for custom script files are not supported anymore, see #107
  • 12 |
  • Bug fix: removed download URL for the Groovy scripting language engine
  • 13 |
14 | 15 | 16 | -------------------------------------------------------------------------------- /src/main/po/ru_RU.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (ru_RU) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 11 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 12 | "Language-Team: Russian (Russia) (https://www.transifex.com/josm/teams/2544/ru_RU/)\n" 13 | "MIME-Version: 1.0\n" 14 | "Content-Type: text/plain; charset=UTF-8\n" 15 | "Content-Transfer-Encoding: 8bit\n" 16 | "Language: ru_RU\n" 17 | "Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\n" 18 | -------------------------------------------------------------------------------- /src/test/unit/groovy/org/openstreetmap/josm/plugins/scripting/graalvm/with_graalvm/GraalVMEmbeddedInJosmTest.groovy: -------------------------------------------------------------------------------- 1 | package org.openstreetmap.josm.plugins.scripting.graalvm.with_graalvm 2 | 3 | 4 | import org.junit.jupiter.api.Test 5 | import org.openstreetmap.josm.plugins.scripting.graalvm.AbstractGraalVMBasedTest 6 | import org.openstreetmap.josm.plugins.scripting.graalvm.GraalVMEvalException 7 | 8 | class GraalVMEmbeddedInJosmTest extends AbstractGraalVMBasedTest { 9 | 10 | @Test 11 | void shouldAccessJosmVersionClass() throws GraalVMEvalException { 12 | final script = """ 13 | const Version = Java.type('org.openstreetmap.josm.data.Version') 14 | const version = Version.getInstance().getVersionString() 15 | console.log(`JOSM Version: \${version}`) 16 | """ 17 | facade.eval(graalJSDescriptor, script) 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/test/unit/groovy/org/openstreetmap/josm/plugins/scripting/graalvm/with_graalvm/GraalVMAndRequireTest.groovy: -------------------------------------------------------------------------------- 1 | package org.openstreetmap.josm.plugins.scripting.graalvm.with_graalvm 2 | 3 | import org.graalvm.polyglot.Value 4 | import org.junit.jupiter.api.Test 5 | import org.openstreetmap.josm.plugins.scripting.graalvm.AbstractGraalVMBasedTest 6 | 7 | import static org.junit.Assert.assertEquals 8 | 9 | class GraalVMAndRequireTest extends AbstractGraalVMBasedTest{ 10 | 11 | @Test 12 | void "should load a module with require()"() { 13 | def script = """ 14 | const {message} = require('hello-world-message') 15 | console.log(`Message: \${message}`) 16 | message 17 | """ 18 | facade.resetContext() 19 | Value value = facade.eval(graalJSDescriptor, script) as Value 20 | assertEquals("hello-world", value?.asString()) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/org/openstreetmap/josm/plugins/scripting/graalvm/commonjs/ICommonJSModuleRepository.java: -------------------------------------------------------------------------------- 1 | package org.openstreetmap.josm.plugins.scripting.graalvm.commonjs; 2 | 3 | import javax.validation.constraints.NotNull; 4 | import java.net.URI; 5 | 6 | /** 7 | * A repository of CommonJS modules. It has a base URI and it is able 8 | * to resolve CommonJS module ids against it. 9 | */ 10 | public interface ICommonJSModuleRepository extends IModuleResolver { 11 | 12 | /** 13 | * Replies the base URI of this repository 14 | * 15 | * @return the base URI 16 | */ 17 | @NotNull URI getBaseURI(); 18 | 19 | /** 20 | * Replies true if the base URI of this repo is the base of the module 21 | * URI 22 | * 23 | * @param moduleURI the module uri 24 | * @return true, if this repo is the base for the module URI 25 | */ 26 | boolean isBaseOf(@NotNull URI moduleURI); 27 | } 28 | -------------------------------------------------------------------------------- /src/main/resources/release-notes/release-notes.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: sans-serif; 3 | font-size: 14pt; 4 | margin-left: 0.5cm; 5 | margin-right: 0.5cm; 6 | } 7 | 8 | h1 { 9 | font-size: 16pt; 10 | font-weight: bold; 11 | padding-bottom: 20pt; 12 | } 13 | 14 | ul { 15 | margin-left: 0.5cm; 16 | list-style-position: outside; 17 | } 18 | 19 | ul li { 20 | padding-bottom: 12pt; 21 | } 22 | 23 | a { 24 | text-decoration: underline; 25 | color: blue; 26 | } 27 | 28 | strong { 29 | font-weight: bold; 30 | } 31 | 32 | code { 33 | font-family: monospace; 34 | } 35 | 36 | p { 37 | padding-bottom: 10pt; 38 | } 39 | 40 | p.warning { 41 | background: #ffcccb; 42 | padding: 10pt; 43 | border-style: solid; 44 | border-color: red; 45 | border-width: 2pt; 46 | } 47 | 48 | br { 49 | display: block; 50 | margin: 10pt 0; 51 | line-height: 10pt; 52 | } -------------------------------------------------------------------------------- /src/main/java/org/openstreetmap/josm/plugins/scripting/graalvm/IRepositoriesSource.java: -------------------------------------------------------------------------------- 1 | package org.openstreetmap.josm.plugins.scripting.graalvm; 2 | 3 | import javax.validation.constraints.NotNull; 4 | import javax.validation.constraints.Null; 5 | import java.net.URI; 6 | import java.util.List; 7 | 8 | /** 9 | * A source of module repositories, either CommonJS modules or ES Modules. 10 | */ 11 | public interface IRepositoriesSource { 12 | 13 | /** 14 | * Replies the list of repository base URIs for the repositories 15 | * managed by this source. 16 | * 17 | * @return the list of base URIs 18 | */ 19 | @NotNull List getRepositories(); 20 | 21 | /** 22 | * Sets a list of repository base URIs for which this source 23 | * provides repositories. 24 | * 25 | * @param repositories the base URIs 26 | */ 27 | void setRepositories(@Null List repositories); 28 | } 29 | -------------------------------------------------------------------------------- /src/test/unit/groovy/org/openstreetmap/josm/plugins/scripting/graalvm/GraalVMNotPresentTest.groovy: -------------------------------------------------------------------------------- 1 | package org.openstreetmap.josm.plugins.scripting.graalvm 2 | 3 | 4 | import org.junit.jupiter.api.Test 5 | import org.openstreetmap.josm.plugins.scripting.model.ScriptEngineMetaDataProvider 6 | 7 | import java.util.stream.Collectors 8 | 9 | import static org.junit.Assert.assertFalse 10 | import static org.junit.Assert.assertTrue 11 | 12 | class GraalVMNotPresentTest { 13 | 14 | @Test 15 | void shouldDetectGraalVMNotPresent() { 16 | final isPresent = GraalVMFacadeFactory.isGraalVMPresent() 17 | assertFalse(isPresent) 18 | } 19 | 20 | @Test 21 | void shouldProvideAnEmptyStreamOfGraalVMScriptEngines() { 22 | final engines = 23 | ScriptEngineMetaDataProvider.getAvailableGraalVMScriptEngines() 24 | .collect(Collectors.toList()) 25 | assertTrue(engines.isEmpty()) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/openstreetmap/josm/plugins/scripting/ui/console/CloseAction.java: -------------------------------------------------------------------------------- 1 | package org.openstreetmap.josm.plugins.scripting.ui.console; 2 | 3 | import static org.openstreetmap.josm.tools.I18n.tr; 4 | 5 | import java.awt.event.ActionEvent; 6 | import java.util.logging.Logger; 7 | 8 | import javax.swing.AbstractAction; 9 | 10 | import org.openstreetmap.josm.tools.ImageProvider; 11 | 12 | public class CloseAction extends AbstractAction { 13 | @SuppressWarnings("unused") 14 | static private final Logger logger = Logger.getLogger(CloseAction.class.getName()); 15 | 16 | public CloseAction() { 17 | putValue(NAME, tr("Close")); 18 | putValue(SHORT_DESCRIPTION, tr("Close the scripting console")); 19 | putValue(SMALL_ICON, ImageProvider.get("exit", ImageProvider.ImageSizes.MENU)); 20 | } 21 | 22 | @Override 23 | public void actionPerformed(ActionEvent e) { 24 | ScriptingConsole.hideScriptingConsole(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/po/fa.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (fa) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | # Translators: 7 | # Simon Legner, 2018 8 | # Claudius Henrichs, 2020 9 | # 10 | msgid "" 11 | msgstr "" 12 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 13 | "Report-Msgid-Bugs-To: \n" 14 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 15 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 16 | "Language-Team: Persian (https://www.transifex.com/josm/teams/2544/fa/)\n" 17 | "MIME-Version: 1.0\n" 18 | "Content-Type: text/plain; charset=UTF-8\n" 19 | "Content-Transfer-Encoding: 8bit\n" 20 | "Language: fa\n" 21 | "Plural-Forms: nplurals=2; plural=(n > 1);\n" 22 | 23 | msgid "Cancel" 24 | msgstr "لغو" 25 | 26 | msgid "Close" 27 | msgstr "خروج" 28 | 29 | #. create the file menu 30 | msgid "File" 31 | msgstr "پرونده‌" 32 | 33 | msgid "OK" 34 | msgstr "تأیید" 35 | -------------------------------------------------------------------------------- /src/main/po/ku.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (ku) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | # Translators: 7 | # Simon Legner, 2022 8 | # 9 | msgid "" 10 | msgstr "" 11 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 12 | "Report-Msgid-Bugs-To: \n" 13 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 14 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 15 | "Language-Team: Kurdish (https://www.transifex.com/josm/teams/2544/ku/)\n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=UTF-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | "Language: ku\n" 20 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 21 | 22 | #. Translator credits (translators who want to be credited for their 23 | #. contributions can add their names here as the translation) 24 | msgid "translator-credits" 25 | msgstr "" 26 | "Launchpad Contributions:\n" 27 | " Rokar ✌ https://launchpad.net/~rokarali" 28 | -------------------------------------------------------------------------------- /src/test/functional/javascript/v3/command-undo-redo-test.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Functional test for an apply/undo/redo loop 3 | */ 4 | import josm from 'josm' 5 | import {buildAddCommand} from 'josm/command' 6 | import { NodeBuilder } from 'josm/builder' 7 | import * as util from 'josm/util' 8 | 9 | export function run () { 10 | const layer = josm.layers.addDataLayer() 11 | 12 | const n = NodeBuilder 13 | .forDataSet(layer.getDataSet()) 14 | .create() 15 | 16 | // add a node and check node is there 17 | buildAddCommand(n).applyTo(layer) 18 | util.assert(layer.getDataSet().containsNode(n), `layer could contain node ${n}`) 19 | 20 | // undo - node still there? 21 | josm.commands.undo() 22 | util.assert(!layer.getDataSet().containsNode(n), `layer shouldn't contain node ${n}`) 23 | 24 | // redo - node again there? 25 | josm.commands.redo() 26 | util.assert(layer.getDataSet().containsNode(n), `after redo, layer should contain node ${n}`) 27 | 28 | // clear all commands 29 | josm.commands.clear() 30 | } 31 | -------------------------------------------------------------------------------- /src/main/po/lb.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (lb) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | # Translators: 7 | # Simon Legner, 2022 8 | # 9 | msgid "" 10 | msgstr "" 11 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 12 | "Report-Msgid-Bugs-To: \n" 13 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 14 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 15 | "Language-Team: Luxembourgish (https://www.transifex.com/josm/teams/2544/lb/)\n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=UTF-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | "Language: lb\n" 20 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 21 | 22 | #. Translator credits (translators who want to be credited for their 23 | #. contributions can add their names here as the translation) 24 | msgid "translator-credits" 25 | msgstr "" 26 | "Launchpad Contributions:\n" 27 | " Charel https://launchpad.net/~ceilenbecker" 28 | -------------------------------------------------------------------------------- /src/main/po/mg.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (mg) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | # Translators: 7 | # Simon Legner, 2022 8 | # 9 | msgid "" 10 | msgstr "" 11 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 12 | "Report-Msgid-Bugs-To: \n" 13 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 14 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 15 | "Language-Team: Malagasy (https://www.transifex.com/josm/teams/2544/mg/)\n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=UTF-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | "Language: mg\n" 20 | "Plural-Forms: nplurals=2; plural=(n > 1);\n" 21 | 22 | #. Translator credits (translators who want to be credited for their 23 | #. contributions can add their names here as the translation) 24 | msgid "translator-credits" 25 | msgstr "" 26 | "Launchpad Contributions:\n" 27 | " DotMG https://launchpad.net/~mahefa-randimbisoa" 28 | -------------------------------------------------------------------------------- /src/main/po/kn.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (kn) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | # Translators: 7 | # Simon Legner, 2022 8 | # 9 | msgid "" 10 | msgstr "" 11 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 12 | "Report-Msgid-Bugs-To: \n" 13 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 14 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 15 | "Language-Team: Kannada (https://www.transifex.com/josm/teams/2544/kn/)\n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=UTF-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | "Language: kn\n" 20 | "Plural-Forms: nplurals=2; plural=(n > 1);\n" 21 | 22 | #. Translator credits (translators who want to be credited for their 23 | #. contributions can add their names here as the translation) 24 | msgid "translator-credits" 25 | msgstr "" 26 | "Launchpad Contributions:\n" 27 | " Yogesh K S(ಯೋಗೇಶ್) https://launchpad.net/~yogesh-k-s" 28 | -------------------------------------------------------------------------------- /src/test/unit/groovy/org/openstreetmap/josm/plugins/scripting/graalvm/with_graalvm/GraalVMEvalTest.groovy: -------------------------------------------------------------------------------- 1 | package org.openstreetmap.josm.plugins.scripting.graalvm.with_graalvm 2 | 3 | import org.junit.jupiter.api.Test 4 | import org.openstreetmap.josm.plugins.scripting.graalvm.AbstractGraalVMBasedTest 5 | 6 | class GraalVMEvalTest extends AbstractGraalVMBasedTest { 7 | 8 | @Test 9 | void "should eval a hello world script"() { 10 | def script = """ 11 | console.log('Hello world!') 12 | """ 13 | facade.eval(graalJSDescriptor, script) 14 | } 15 | 16 | @Test 17 | void "should eval javascript script file()"() { 18 | def script = """ 19 | console.log('Hello world!') 20 | """ 21 | File.createTempFile("js-script", ".tmp").with { 22 | deleteOnExit() 23 | write script 24 | def f = new File(absolutePath) 25 | facade.eval(graalJSDescriptor, f) 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/po/lo.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (lo) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | # Translators: 7 | # Simon Legner, 2022 8 | # 9 | msgid "" 10 | msgstr "" 11 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 12 | "Report-Msgid-Bugs-To: \n" 13 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 14 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 15 | "Language-Team: Lao (https://www.transifex.com/josm/teams/2544/lo/)\n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=UTF-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | "Language: lo\n" 20 | "Plural-Forms: nplurals=1; plural=0;\n" 21 | 22 | msgid "Cancel" 23 | msgstr "ຍົກເລີກ" 24 | 25 | #. Translator credits (translators who want to be credited for their 26 | #. contributions can add their names here as the translation) 27 | msgid "translator-credits" 28 | msgstr "" 29 | "Launchpad Contributions:\n" 30 | " Anousone https://launchpad.net/~touya-ra" 31 | -------------------------------------------------------------------------------- /src/main/po/ur.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (ur) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | # Translators: 7 | # Simon Legner, 2022 8 | # 9 | msgid "" 10 | msgstr "" 11 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 12 | "Report-Msgid-Bugs-To: \n" 13 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 14 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 15 | "Language-Team: Urdu (https://www.transifex.com/josm/teams/2544/ur/)\n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=UTF-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | "Language: ur\n" 20 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 21 | 22 | msgid "Cancel" 23 | msgstr "منسوخ" 24 | 25 | #. Translator credits (translators who want to be credited for their 26 | #. contributions can add their names here as the translation) 27 | msgid "translator-credits" 28 | msgstr "" 29 | "Launchpad Contributions:\n" 30 | " Shoaib Mirza https://launchpad.net/~monymirza" 31 | -------------------------------------------------------------------------------- /src/test/resources/sample-data-files/test-josm-open.gpx: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Example gpx 8 | Example gpx1 9 | 2376 10 | 2375 11 | 2372 12 | 2373 13 | 2374 14 | 2375 15 | 2376 16 | 17 | -------------------------------------------------------------------------------- /src/main/po/az.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (az) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | # Translators: 7 | # Simon Legner, 2022 8 | # 9 | msgid "" 10 | msgstr "" 11 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 12 | "Report-Msgid-Bugs-To: \n" 13 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 14 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 15 | "Language-Team: Azerbaijani (https://www.transifex.com/josm/teams/2544/az/)\n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=UTF-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | "Language: az\n" 20 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 21 | 22 | msgid "Cancel" 23 | msgstr "İmtina" 24 | 25 | #. Translator credits (translators who want to be credited for their 26 | #. contributions can add their names here as the translation) 27 | msgid "translator-credits" 28 | msgstr "" 29 | "Launchpad Contributions:\n" 30 | " iAZISS https://launchpad.net/~iss-sash" 31 | -------------------------------------------------------------------------------- /src/main/po/ky.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (ky) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | # Translators: 7 | # Simon Legner, 2022 8 | # 9 | msgid "" 10 | msgstr "" 11 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 12 | "Report-Msgid-Bugs-To: \n" 13 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 14 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 15 | "Language-Team: Kyrgyz (https://www.transifex.com/josm/teams/2544/ky/)\n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=UTF-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | "Language: ky\n" 20 | "Plural-Forms: nplurals=1; plural=0;\n" 21 | 22 | msgid "Cancel" 23 | msgstr "Жокко чыгаруу" 24 | 25 | #. Translator credits (translators who want to be credited for their 26 | #. contributions can add their names here as the translation) 27 | msgid "translator-credits" 28 | msgstr "" 29 | "Launchpad Contributions:\n" 30 | " SimpleLeon https://launchpad.net/~simpleleon" 31 | -------------------------------------------------------------------------------- /src/main/po/hi.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (hi) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | # Translators: 7 | # Simon Legner, 2022 8 | # 9 | msgid "" 10 | msgstr "" 11 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 12 | "Report-Msgid-Bugs-To: \n" 13 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 14 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 15 | "Language-Team: Hindi (https://www.transifex.com/josm/teams/2544/hi/)\n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=UTF-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | "Language: hi\n" 20 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 21 | 22 | msgid "Cancel" 23 | msgstr "रद्द करें" 24 | 25 | #. Translator credits (translators who want to be credited for their 26 | #. contributions can add their names here as the translation) 27 | msgid "translator-credits" 28 | msgstr "" 29 | "Launchpad Contributions:\n" 30 | " nipunreddevil https://launchpad.net/~nipunreddevil" 31 | -------------------------------------------------------------------------------- /src/main/po/pa.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (pa) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | # Translators: 7 | # Simon Legner, 2022 8 | # 9 | msgid "" 10 | msgstr "" 11 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 12 | "Report-Msgid-Bugs-To: \n" 13 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 14 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 15 | "Language-Team: Panjabi (Punjabi) (https://www.transifex.com/josm/teams/2544/pa/)\n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=UTF-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | "Language: pa\n" 20 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 21 | 22 | #. Translator credits (translators who want to be credited for their 23 | #. contributions can add their names here as the translation) 24 | msgid "translator-credits" 25 | msgstr "" 26 | "Launchpad Contributions:\n" 27 | " A S Alam https://launchpad.net/~aalam-users\n" 28 | " Davinder Kumar https://launchpad.net/~me-davinder" 29 | -------------------------------------------------------------------------------- /src/main/po/en_CA.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (en_CA) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | # Translators: 7 | # Simon Legner, 2022 8 | # 9 | msgid "" 10 | msgstr "" 11 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 12 | "Report-Msgid-Bugs-To: \n" 13 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 14 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 15 | "Language-Team: English (Canada) (https://www.transifex.com/josm/teams/2544/en_CA/)\n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=UTF-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | "Language: en_CA\n" 20 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 21 | 22 | msgid "Cancel" 23 | msgstr "Cancel" 24 | 25 | #. Translator credits (translators who want to be credited for their 26 | #. contributions can add their names here as the translation) 27 | msgid "translator-credits" 28 | msgstr "" 29 | "Launchpad Contributions:\n" 30 | " Johann Beda https://launchpad.net/~st-launchpad-net" 31 | -------------------------------------------------------------------------------- /src/main/po/ia.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (ia) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | # Translators: 7 | # Simon Legner, 2022 8 | # 9 | msgid "" 10 | msgstr "" 11 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 12 | "Report-Msgid-Bugs-To: \n" 13 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 14 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 15 | "Language-Team: Interlingua (https://www.transifex.com/josm/teams/2544/ia/)\n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=UTF-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | "Language: ia\n" 20 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 21 | 22 | msgid "Cancel" 23 | msgstr "Cancellar" 24 | 25 | #. Translator credits (translators who want to be credited for their 26 | #. contributions can add their names here as the translation) 27 | msgid "translator-credits" 28 | msgstr "" 29 | "Launchpad Contributions:\n" 30 | " Emilio Sepulveda https://launchpad.net/~emisep-deactivatedaccount" 31 | -------------------------------------------------------------------------------- /src/main/java/org/openstreetmap/josm/plugins/scripting/preferences/common/IconUtil.java: -------------------------------------------------------------------------------- 1 | package org.openstreetmap.josm.plugins.scripting.preferences.common; 2 | 3 | import org.openstreetmap.josm.tools.ImageProvider; 4 | 5 | import javax.swing.*; 6 | 7 | import java.util.logging.Logger; 8 | 9 | import static org.openstreetmap.josm.tools.I18n.tr; 10 | 11 | public class IconUtil { 12 | 13 | @SuppressWarnings("unused") 14 | static private final Logger logger = Logger.getLogger(IconUtil.class.getName()); 15 | 16 | static public Icon saveImageGet(String name) { 17 | ImageIcon icon = ImageProvider.getIfAvailable(name); 18 | if (icon == null) { 19 | logger.warning(tr("Failed to load icon ''{0}''", name)); 20 | } 21 | return icon; 22 | } 23 | 24 | static public Icon saveImageGet(String dir, String name) { 25 | ImageIcon icon = ImageProvider.getIfAvailable(dir, name); 26 | if (icon == null) { 27 | logger.warning(tr("Failed to load icon ''{0}/{1}''", dir, name)); 28 | } 29 | return icon; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/po/cy.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (cy) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | # Translators: 7 | # Simon Legner, 2022 8 | # 9 | msgid "" 10 | msgstr "" 11 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 12 | "Report-Msgid-Bugs-To: \n" 13 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 14 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 15 | "Language-Team: Welsh (https://www.transifex.com/josm/teams/2544/cy/)\n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=UTF-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | "Language: cy\n" 20 | "Plural-Forms: nplurals=4; plural=(n==1) ? 0 : (n==2) ? 1 : (n != 8 && n != 11) ? 2 : 3;\n" 21 | 22 | msgid "Cancel" 23 | msgstr "Diddymu" 24 | 25 | #. Translator credits (translators who want to be credited for their 26 | #. contributions can add their names here as the translation) 27 | msgid "translator-credits" 28 | msgstr "" 29 | "Launchpad Contributions:\n" 30 | " iggy23 https://launchpad.net/~al-iguana-23" 31 | -------------------------------------------------------------------------------- /src/main/java/org/openstreetmap/josm/plugins/scripting/js/api/CommandForPrimitive.java: -------------------------------------------------------------------------------- 1 | package org.openstreetmap.josm.plugins.scripting.js.api; 2 | 3 | import java.util.Collection; 4 | import java.util.Collections; 5 | 6 | import javax.swing.Icon; 7 | 8 | import org.openstreetmap.josm.command.PseudoCommand; 9 | import org.openstreetmap.josm.data.osm.OsmPrimitive; 10 | import org.openstreetmap.josm.data.osm.DefaultNameFormatter; 11 | import org.openstreetmap.josm.tools.ImageProvider; 12 | 13 | class CommandForPrimitive implements PseudoCommand { 14 | 15 | private final OsmPrimitive p; 16 | public CommandForPrimitive(final OsmPrimitive p) { 17 | this.p = p; 18 | } 19 | @Override 20 | public Collection getParticipatingPrimitives() { 21 | return Collections.singleton(p); 22 | } 23 | 24 | @Override 25 | public String getDescriptionText() { 26 | return p.getDisplayName(DefaultNameFormatter.getInstance()); 27 | } 28 | 29 | @Override 30 | public Icon getDescriptionIcon() { 31 | return ImageProvider.get(p.getType()); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/po/hy.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (hy) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | # Translators: 7 | # Simon Legner, 2022 8 | # 9 | msgid "" 10 | msgstr "" 11 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 12 | "Report-Msgid-Bugs-To: \n" 13 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 14 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 15 | "Language-Team: Armenian (https://www.transifex.com/josm/teams/2544/hy/)\n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=UTF-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | "Language: hy\n" 20 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 21 | 22 | msgid "Cancel" 23 | msgstr "Չեղարկել" 24 | 25 | #. Translator credits (translators who want to be credited for their 26 | #. contributions can add their names here as the translation) 27 | msgid "translator-credits" 28 | msgstr "" 29 | "Launchpad Contributions:\n" 30 | " Gev777 https://launchpad.net/~gevorgpapikyan\n" 31 | " Serj Safarian https://launchpad.net/~safarian" 32 | -------------------------------------------------------------------------------- /src/main/po/st.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (st) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | # Translators: 7 | # Simon Legner, 2022 8 | # 9 | msgid "" 10 | msgstr "" 11 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 12 | "Report-Msgid-Bugs-To: \n" 13 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 14 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 15 | "Language-Team: Sotho, Southern (https://www.transifex.com/josm/teams/2544/st/)\n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=UTF-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | "Language: st\n" 20 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 21 | 22 | msgid "Cancel" 23 | msgstr "Hlakola" 24 | 25 | msgid "OK" 26 | msgstr "Ho lokile" 27 | 28 | #. Translator credits (translators who want to be credited for their 29 | #. contributions can add their names here as the translation) 30 | msgid "translator-credits" 31 | msgstr "" 32 | "Launchpad Contributions:\n" 33 | " Mzwandile Thokoane https://launchpad.net/~nuts2001" 34 | -------------------------------------------------------------------------------- /src/main/po/fil.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (fil) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | # Translators: 7 | # Simon Legner, 2022 8 | # 9 | msgid "" 10 | msgstr "" 11 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 12 | "Report-Msgid-Bugs-To: \n" 13 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 14 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 15 | "Language-Team: Filipino (https://www.transifex.com/josm/teams/2544/fil/)\n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=UTF-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | "Language: fil\n" 20 | "Plural-Forms: nplurals=2; plural=(n == 1 || n==2 || n==3) || (n % 10 != 4 || n % 10 != 6 || n % 10 != 9);\n" 21 | 22 | #. Translator credits (translators who want to be credited for their 23 | #. contributions can add their names here as the translation) 24 | msgid "translator-credits" 25 | msgstr "" 26 | "Launchpad Contributions:\n" 27 | " Anthony Balico https://launchpad.net/~anthony-balico-deactivatedaccount-deactivatedaccount" 28 | -------------------------------------------------------------------------------- /src/main/po/fo.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (fo) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | # Translators: 7 | # Florian Schäfer, 2018 8 | # Simon Legner, 2022 9 | # 10 | msgid "" 11 | msgstr "" 12 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 13 | "Report-Msgid-Bugs-To: \n" 14 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 15 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 16 | "Language-Team: Faroese (https://www.transifex.com/josm/teams/2544/fo/)\n" 17 | "MIME-Version: 1.0\n" 18 | "Content-Type: text/plain; charset=UTF-8\n" 19 | "Content-Transfer-Encoding: 8bit\n" 20 | "Language: fo\n" 21 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 22 | 23 | msgid "Cancel" 24 | msgstr "Angra" 25 | 26 | msgid "Select" 27 | msgstr "Vel" 28 | 29 | #. Translator credits (translators who want to be credited for their 30 | #. contributions can add their names here as the translation) 31 | msgid "translator-credits" 32 | msgstr "" 33 | "Launchpad Contributions:\n" 34 | " LiFo https://launchpad.net/~martin-fossdal" 35 | -------------------------------------------------------------------------------- /src/main/po/ms.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (ms) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | # Translators: 7 | # Simon Legner, 2022 8 | # 9 | msgid "" 10 | msgstr "" 11 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 12 | "Report-Msgid-Bugs-To: \n" 13 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 14 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 15 | "Language-Team: Malay (https://www.transifex.com/josm/teams/2544/ms/)\n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=UTF-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | "Language: ms\n" 20 | "Plural-Forms: nplurals=1; plural=0;\n" 21 | 22 | msgid "Cancel" 23 | msgstr "Batal" 24 | 25 | #. Translator credits (translators who want to be credited for their 26 | #. contributions can add their names here as the translation) 27 | msgid "translator-credits" 28 | msgstr "" 29 | "Launchpad Contributions:\n" 30 | " CH https://launchpad.net/~ngohch\n" 31 | " abuyop https://launchpad.net/~abuyop\n" 32 | " khensthoth https://launchpad.net/~khensthoth" 33 | -------------------------------------------------------------------------------- /src/main/resources/graalvm/require-wrapper.mustache: -------------------------------------------------------------------------------- 1 | {{! --------------------------------------------------------------------- }} 2 | {{! mustache template for the JavaScript wrapper around a required module }} 3 | {{! --------------------------------------------------------------------- }} 4 | {{! RequireFunction is populated in the scripting context }} 5 | (function() { 6 | const URI = Java.type('java.net.URI') 7 | const RequireFunction = Plugin.type('org.openstreetmap.josm.plugins.scripting.graalvm.RequireFunction') 8 | 9 | const module = { 10 | exports: {}, 11 | id: '{{& moduleID }}', 12 | uri: '{{& moduleURI }}' 13 | } 14 | 15 | const require = (module) => (moduleId) => { 16 | if (module && module.uri) { 17 | return new RequireFunction(new URI(module.uri)).apply(moduleId) 18 | } else { 19 | return new RequireFunction().apply(moduleId) 20 | } 21 | } 22 | 23 | !function(module, exports, require) { 24 | 25 | {{& moduleSource }} 26 | 27 | }(module, module.exports, require(module)) 28 | 29 | return module.exports 30 | }()) -------------------------------------------------------------------------------- /src/test/functional/javascript/v3/menu-bar-test.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Functional test for accessing the menu bar 3 | */ 4 | 5 | import josm from 'josm' 6 | import * as util from 'josm/util' 7 | import * as ut from 'josm/unittest' 8 | 9 | export function run() { 10 | util.println('Number of menues in the menu bar: {0}', josm.menu.length) 11 | 12 | const editMenu = josm.menu.get(1) 13 | util.println('Got the edit menu: {0}', editMenu) 14 | 15 | util.each(josm.menu.menuNames, function (name) { 16 | const menu = josm.menu.get(name) 17 | util.println("Menu ''{0}'' -> got menu object {1}", name, menu) 18 | }) 19 | 20 | ut.expectAssertionError(function () { 21 | // negative index -> fail 22 | josm.menu.get(-1) 23 | }) 24 | 25 | ut.expectAssertionError(function () { 26 | // index out of range -> fail 27 | josm.menu.get(josm.menu.length) 28 | }) 29 | 30 | ut.expectAssertionError(function () { 31 | // unknown menu name -> fail 32 | josm.menu.get('no such menu') 33 | }) 34 | 35 | ut.expectAssertionError(function () { 36 | // index is neither a string nor a number -> fail 37 | josm.menu.get({}) 38 | }) 39 | } 40 | -------------------------------------------------------------------------------- /src/test/unit/javascript/v3/suite.js: -------------------------------------------------------------------------------- 1 | 2 | /* global Java */ 3 | const Exception = Java.type('java.lang.Exception') 4 | const System = Java.type('java.lang.System') 5 | 6 | import * as node_builder_tests from 'josm/node-builder-test' 7 | import * as way_builder_tests from 'josm/way-builder-test' 8 | import * as relation_builder_test from 'josm/relation-builder-test' 9 | import * as util_test from 'josm/util-test' 10 | import * as command_test from 'josm/command-test' 11 | import * as ds_test from 'josm/ds-test' 12 | import * as api_test from 'josm/api-test' 13 | 14 | const tests = [ 15 | node_builder_tests, 16 | way_builder_tests, 17 | relation_builder_test, 18 | util_test, 19 | command_test, 20 | ds_test, 21 | api_test 22 | ] 23 | 24 | export function run () { 25 | return tests 26 | .map(function (tests) { return tests.run() }) 27 | .reduce(function (acc, numTests) { return acc + numTests }) 28 | } 29 | 30 | export function fragileRun() { 31 | const numfail = run() 32 | if (numfail > 0) { 33 | throw new Exception('There are ' + numfail + ' failing tests') 34 | } else { 35 | System.out.println('All tests ran successfully! ') 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/po/ga.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (ga) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | # Translators: 7 | # Florian Schäfer, 2018 8 | # Simon Legner, 2022 9 | # 10 | msgid "" 11 | msgstr "" 12 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 13 | "Report-Msgid-Bugs-To: \n" 14 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 15 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 16 | "Language-Team: Irish (https://www.transifex.com/josm/teams/2544/ga/)\n" 17 | "MIME-Version: 1.0\n" 18 | "Content-Type: text/plain; charset=UTF-8\n" 19 | "Content-Transfer-Encoding: 8bit\n" 20 | "Language: ga\n" 21 | "Plural-Forms: nplurals=5; plural=(n==1 ? 0 : n==2 ? 1 : n<7 ? 2 : n<11 ? 3 : 4);\n" 22 | 23 | msgid "Cancel" 24 | msgstr "Cealaigh" 25 | 26 | msgid "Select" 27 | msgstr "Roghnaigh" 28 | 29 | #. Translator credits (translators who want to be credited for their 30 | #. contributions can add their names here as the translation) 31 | msgid "translator-credits" 32 | msgstr "" 33 | "Launchpad Contributions:\n" 34 | " Thorsten https://launchpad.net/~thorsten-by" 35 | -------------------------------------------------------------------------------- /src/main/po/mk.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (mk) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | # Translators: 7 | # Simon Legner, 2022 8 | # 9 | msgid "" 10 | msgstr "" 11 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 12 | "Report-Msgid-Bugs-To: \n" 13 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 14 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 15 | "Language-Team: Macedonian (https://www.transifex.com/josm/teams/2544/mk/)\n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=UTF-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | "Language: mk\n" 20 | "Plural-Forms: nplurals=2; plural=(n % 10 == 1 && n % 100 != 11) ? 0 : 1;\n" 21 | 22 | msgid "Cancel" 23 | msgstr "Откажи" 24 | 25 | #. Translator credits (translators who want to be credited for their 26 | #. contributions can add their names here as the translation) 27 | msgid "translator-credits" 28 | msgstr "" 29 | "Launchpad Contributions:\n" 30 | " Bojan Jankuloski https://launchpad.net/~bojan-jankuloski\n" 31 | " goran.cvetkovski https://launchpad.net/~goran-cvetkovski" 32 | -------------------------------------------------------------------------------- /src/main/po/ro.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (ro) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | # Translators: 7 | # Simon Legner, 2022 8 | # 9 | msgid "" 10 | msgstr "" 11 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 12 | "Report-Msgid-Bugs-To: \n" 13 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 14 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 15 | "Language-Team: Romanian (https://www.transifex.com/josm/teams/2544/ro/)\n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=UTF-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | "Language: ro\n" 20 | "Plural-Forms: nplurals=3; plural=(n==1?0:(((n%100>19)||((n%100==0)&&(n!=0)))?2:1));\n" 21 | 22 | msgid "Add" 23 | msgstr "Adaugă" 24 | 25 | msgid "Cancel" 26 | msgstr "Anulează" 27 | 28 | #. create the edit menu 29 | msgid "Edit" 30 | msgstr "Editare" 31 | 32 | msgid "OK" 33 | msgstr "OK" 34 | 35 | msgid "Remove" 36 | msgstr "Elimină" 37 | 38 | msgid "Save" 39 | msgstr "Salvează" 40 | 41 | msgid "Select" 42 | msgstr "Selectaţi" 43 | 44 | msgid "unknown" 45 | msgstr "necunoscut" 46 | -------------------------------------------------------------------------------- /src/main/po/af.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (af) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | # Translators: 7 | # Gerhardus Geldenhuis, 2018 8 | # Simon Legner, 2022 9 | # 10 | msgid "" 11 | msgstr "" 12 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 13 | "Report-Msgid-Bugs-To: \n" 14 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 15 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 16 | "Language-Team: Afrikaans (https://www.transifex.com/josm/teams/2544/af/)\n" 17 | "MIME-Version: 1.0\n" 18 | "Content-Type: text/plain; charset=UTF-8\n" 19 | "Content-Transfer-Encoding: 8bit\n" 20 | "Language: af\n" 21 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 22 | 23 | msgid "Cancel" 24 | msgstr "Kanseleer" 25 | 26 | msgid "OK" 27 | msgstr "OK" 28 | 29 | #. Translator credits (translators who want to be credited for their 30 | #. contributions can add their names here as the translation) 31 | msgid "translator-credits" 32 | msgstr "" 33 | "Launchpad Contributions:\n" 34 | " Grant Slater https://launchpad.net/~firefishy\n" 35 | " Hb https://launchpad.net/~hbb" 36 | -------------------------------------------------------------------------------- /src/main/po/ka.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (ka) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | # Translators: 7 | # Simon Legner, 2022 8 | # 9 | msgid "" 10 | msgstr "" 11 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 12 | "Report-Msgid-Bugs-To: \n" 13 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 14 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 15 | "Language-Team: Georgian (https://www.transifex.com/josm/teams/2544/ka/)\n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=UTF-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | "Language: ka\n" 20 | "Plural-Forms: nplurals=2; plural=(n!=1);\n" 21 | 22 | msgid "Cancel" 23 | msgstr "უარი" 24 | 25 | #. Translator credits (translators who want to be credited for their 26 | #. contributions can add their names here as the translation) 27 | msgid "translator-credits" 28 | msgstr "" 29 | "Launchpad Contributions:\n" 30 | " androakop@gmail.com https://launchpad.net/~androakop\n" 31 | " besarion https://launchpad.net/~besarion-gviniashvili\n" 32 | " datogogishvili https://launchpad.net/~d-gogishvili" 33 | -------------------------------------------------------------------------------- /src/test/functional/java/org/openstreetmap/josm/plugins/scripting/preferences/ScriptEnginesConfigurationPanelTest.java: -------------------------------------------------------------------------------- 1 | package org.openstreetmap.josm.plugins.scripting.preferences; 2 | 3 | import org.openstreetmap.josm.plugins.scripting.fixtures.JOSMFixture; 4 | 5 | import javax.swing.*; 6 | import java.awt.*; 7 | 8 | /** 9 | * functional, interactive test for {@link ScriptEnginesConfigurationPanel} 10 | */ 11 | public class ScriptEnginesConfigurationPanelTest extends JFrame { 12 | 13 | private ScriptEnginesConfigurationPanelTest() throws Exception { 14 | @SuppressWarnings("unused") 15 | final JOSMFixture fixture = JOSMFixture.createFixture(true /* with gui */); 16 | build(); 17 | } 18 | 19 | private void build() { 20 | Container c = getContentPane(); 21 | c.setLayout(new BorderLayout()); 22 | c.add(new ScriptEnginesConfigurationPanel(), BorderLayout.CENTER); 23 | setSize(400, 600); 24 | } 25 | 26 | static public void main(String[] args) throws Exception { 27 | ScriptEnginesConfigurationPanelTest app = 28 | new ScriptEnginesConfigurationPanelTest(); 29 | app.setVisible(true); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/po/nn.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (nn) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | # Translators: 7 | # Simon Legner, 2022 8 | # 9 | msgid "" 10 | msgstr "" 11 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 12 | "Report-Msgid-Bugs-To: \n" 13 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 14 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 15 | "Language-Team: Norwegian Nynorsk (https://www.transifex.com/josm/teams/2544/nn/)\n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=UTF-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | "Language: nn\n" 20 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 21 | 22 | msgid "Cancel" 23 | msgstr "Avbryt" 24 | 25 | #. create the edit menu 26 | msgid "Edit" 27 | msgstr "Rediger" 28 | 29 | #. Translator credits (translators who want to be credited for their 30 | #. contributions can add their names here as the translation) 31 | msgid "translator-credits" 32 | msgstr "" 33 | "Launchpad Contributions:\n" 34 | " Skippern https://launchpad.net/~gay-today\n" 35 | " Stian Ellingsen https://launchpad.net/~stiell" 36 | -------------------------------------------------------------------------------- /src/test/functional/groovy/org/openstreetmap/josm/plugins/scripting/ui/release/ReleaseNotesTest.groovy: -------------------------------------------------------------------------------- 1 | package org.openstreetmap.josm.plugins.scripting.ui.release 2 | 3 | import org.openstreetmap.josm.plugins.scripting.fixtures.JOSMFixture 4 | 5 | import javax.swing.* 6 | import java.awt.* 7 | import java.awt.event.ActionEvent 8 | 9 | class ReleaseNotesTest extends JFrame { 10 | private ReleaseNotesTest() throws Exception { 11 | 12 | @SuppressWarnings("unused") 13 | final fixture = JOSMFixture.createFixture(true /* with gui */) 14 | 15 | final c = getContentPane() 16 | c.setLayout(new FlowLayout()) 17 | final btn = new JButton() 18 | btn.setAction(new AbstractAction() { 19 | @Override 20 | void actionPerformed(ActionEvent e) { 21 | final dialog = new ReleaseNotes(ReleaseNotesTest.this) 22 | dialog.setVisible(true) 23 | } 24 | }) 25 | btn.setText("Launch") 26 | c.add(btn) 27 | 28 | setSize(200,200) 29 | } 30 | 31 | static void main(String[] args) throws Exception { 32 | final app = new ReleaseNotesTest() 33 | app.setVisible(true) 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/test/unit/groovy/org/openstreetmap/josm/plugins/scripting/jsr223/JSR223CompatibleEnginePresentTest.groovy: -------------------------------------------------------------------------------- 1 | package org.openstreetmap.josm.plugins.scripting.jsr223 2 | 3 | 4 | import org.junit.jupiter.api.Test 5 | import org.openstreetmap.josm.plugins.scripting.BaseTestCase 6 | import org.openstreetmap.josm.plugins.scripting.model.ScriptEngineDescriptor 7 | import org.openstreetmap.josm.plugins.scripting.model.ScriptEngineMetaDataProvider 8 | 9 | import java.util.stream.Collectors 10 | 11 | import static org.junit.Assert.assertFalse 12 | import static org.junit.Assert.assertTrue 13 | 14 | class JSR223CompatibleEnginePresentTest extends BaseTestCase { 15 | 16 | @Test 17 | void shouldProvideANonEmptyStreamOfPluggedEngines() { 18 | final engines = ScriptEngineMetaDataProvider 19 | .getAvailablePluggedScriptEngines() 20 | .collect(Collectors.toList()) 21 | assertFalse(engines.isEmpty()) 22 | 23 | final allEnginesArePluggedEngines = 24 | engines.stream().allMatch(engine -> 25 | engine.getEngineType() == ScriptEngineDescriptor.ScriptEngineType.PLUGGED 26 | ) 27 | assertTrue(allEnginesArePluggedEngines) 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/test/functional/javascript/v3/command-delete-test.js: -------------------------------------------------------------------------------- 1 | import josm from 'josm' 2 | import {buildDeleteCommand} from 'josm/command' 3 | import * as util from 'josm/util' 4 | import { NodeBuilder, WayBuilder, RelationBuilder } from 'josm/builder' 5 | const layer = josm.layers.addDataLayer() 6 | const ds = layer.getDataSet() 7 | 8 | export function run() { 9 | const n1 = NodeBuilder 10 | .forDataSet(ds) 11 | .create(1234) 12 | const n2 = NodeBuilder 13 | .forDataSet(ds) 14 | .withPosition(3, 4) 15 | .create() 16 | 17 | const w1 = WayBuilder 18 | .forDataSet(ds) 19 | .withTags({ highway: 'residential' }) 20 | .withNodes(n1, n2) 21 | .create(777) 22 | 23 | const r1 = RelationBuilder 24 | .forDataSet(ds) 25 | .withMembers(n1, w1) 26 | .create() 27 | 28 | // delete three objects in the layer 29 | buildDeleteCommand(n1, w1, n2, r1).applyTo(layer) 30 | util.assert(ds.getPrimitiveById(n1).isDeleted(), 'node n1 should be deleted') 31 | util.assert(ds.getPrimitiveById(n2).isDeleted(), 'node n2 should be deleted') 32 | util.assert(ds.getPrimitiveById(w1).isDeleted(), 'way w1 should be deleted') 33 | util.assert(ds.getPrimitiveById(r1).isDeleted(), 'relation r1 should be deleted') 34 | } 35 | -------------------------------------------------------------------------------- /src/test/resources/sample-modules/README.md: -------------------------------------------------------------------------------- 1 | A collection of sample ECMAScript modules. 2 | 3 | These ES modules are used as test cases. Some of them are very basic and export just a simple function provided in a single source file. Others have richer internal structure, internally import and use sub modules, or even import functions from other modules in this collection. 4 | 5 | # How to use? 6 | 7 | They are useful for two purposes: 8 | 9 | 1. as test case in **automatized functional tests** 10 | 11 | Test scripts import them and use the exported functions. The main goal is to test whether `import` statements are correctly resolved. 12 | See [ESModuleUsageTest.groovy](../../../test/functional/groovy/org/openstreetmap/josm/plugins/scripting/esmodules/ESModuleTest.groovy) for an example. 13 | 14 | 2. as test case in **manual interactive tests** 15 | 16 | To test the scripting plugin interactively in a running JOSM process the modules can be used as test modules. 17 | 18 | In order to use them, you first have to configure an ES module repository in the scripting plugin preferences. 19 | 1. Select menu item *Scripting -> Settings ...* 20 | 2. Select the tab **ES Modules** 21 | 3. Add a new repository pointing this directory -------------------------------------------------------------------------------- /src/test/functional/java/org/openstreetmap/josm/plugins/scripting/ui/ScriptErrorDialogTest.java: -------------------------------------------------------------------------------- 1 | package org.openstreetmap.josm.plugins.scripting.ui; 2 | 3 | import org.openstreetmap.josm.plugins.scripting.fixtures.JOSMFixture; 4 | 5 | import javax.swing.*; 6 | import java.awt.*; 7 | 8 | public class ScriptErrorDialogTest extends JFrame { 9 | 10 | public ScriptErrorDialogTest() throws Exception { 11 | var fixture = JOSMFixture.createFixture(true /* with gui */); 12 | 13 | getContentPane().setLayout(new FlowLayout()); 14 | setSize(100,100); 15 | JButton btn = new JButton("Launch"); 16 | getContentPane().add(btn); 17 | btn.addActionListener(e -> { 18 | Throwable exception = new Exception(); 19 | try { 20 | int a = 5 / 0; 21 | } catch(Throwable t) { 22 | exception = t; 23 | } 24 | ScriptErrorDialog.showErrorDialog(exception); 25 | }); 26 | } 27 | 28 | static public void main(String[] args) throws Exception { 29 | final ScriptErrorDialogTest app = new ScriptErrorDialogTest(); 30 | app.setVisible(true); 31 | app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/po/bn.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (bn) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | # Translators: 7 | # Simon Legner, 2022 8 | # 9 | msgid "" 10 | msgstr "" 11 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 12 | "Report-Msgid-Bugs-To: \n" 13 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 14 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 15 | "Language-Team: Bengali (https://www.transifex.com/josm/teams/2544/bn/)\n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=UTF-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | "Language: bn\n" 20 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 21 | 22 | msgid "Cancel" 23 | msgstr "বাতিল করুন" 24 | 25 | msgid "OK" 26 | msgstr "ঠিক আছে" 27 | 28 | #. Translator credits (translators who want to be credited for their 29 | #. contributions can add their names here as the translation) 30 | msgid "translator-credits" 31 | msgstr "" 32 | "Launchpad Contributions:\n" 33 | " Ferdaus https://launchpad.net/~ferdausalamin\n" 34 | " Md Alamgir https://launchpad.net/~alamgircu\n" 35 | " Meejan https://launchpad.net/~realmeejan\n" 36 | " tux_440volt https://launchpad.net/~subhodipbiswas" 37 | -------------------------------------------------------------------------------- /src/main/resources/release-notes/v0.2.6.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

Release v0.2.6

6 | 7 |
    8 |
  • Bug fix: fix ClassNotFoundException when running on a stock JDK without GraalJS
  • 9 |
10 | 11 |

12 | The JavaScript API V2 13 | is deprecated. 14 |
15 | End of 2022 it will be removed from the scripting plugin. Consider to migrate your scripts to the 16 | JavaScript API V3. 17 |

18 | 19 |

20 | Support for Mozilla Rhino 21 | and the JavaScript API V1 22 | is deprecated. 23 |
24 | End of 2022 it will be removed from the scripting plugin. 25 | Consider to migrate your scripts to the 26 | GraalJS engine 27 | and the JavaScript API V3. 28 |

29 | 30 | 31 | -------------------------------------------------------------------------------- /testing/linux/README.md: -------------------------------------------------------------------------------- 1 | This directory provides an environment to interactively test JOSM and the scripting plugin with different JOSM, JDK, GraalVM, and GraalJS versions. 2 | 3 | Use [`manage.sh`](manage.sh) to prepare and manage the test environment, in particular to 4 | 5 | * download and install JOSM versions 6 | * download and install JDKs (jdk11 and jdk17) 7 | * download and install GraalVMs for jdk11 or jdk17 8 | * download and install GraalJS versions 9 | * manage a JOSM_HOME for the testing environment (create and init, delete) 10 | * deploy the current scripting plugin (the locally built `scripting.jar`) to the testing environment 11 | 12 | Run `manage.sh help` for additional information. 13 | 14 | Typical usage: 15 | ```bash 16 | # prepare the testing environment, download JOSM jars, JDKs, GraalVMs, and 17 | # a GraalJS distribution. Install them locally in this testing directory 18 | $ ./manage.sh prepare 19 | 20 | # clean up the testing environment. Remove all downloaded JOSM jars, JDKs, 21 | # GraalVMs, and GraalJS distributions. 22 | $ ./manage.sh clean 23 | ``` 24 | 25 | Use [`josm.sh`](josm.sh) to launch JOSM and the scripting plugin either with a stock JDK (with or without GraalJS) or with a GraalVM version. 26 | 27 | Run `josm.sh help` for additional information. 28 | ``` -------------------------------------------------------------------------------- /src/test/functional/java/org/openstreetmap/josm/plugins/scripting/RunScriptDialogTest.java: -------------------------------------------------------------------------------- 1 | package org.openstreetmap.josm.plugins.scripting; 2 | 3 | import org.openstreetmap.josm.plugins.scripting.fixtures.JOSMFixture; 4 | import org.openstreetmap.josm.plugins.scripting.ui.RunScriptDialog; 5 | 6 | import javax.swing.*; 7 | import java.awt.*; 8 | 9 | /** 10 | * Functional, interactive test for {@link RunScriptDialog}. 11 | */ 12 | public class RunScriptDialogTest extends JFrame { 13 | 14 | @SuppressWarnings("FieldCanBeLocal") 15 | private final JOSMFixture fixture; 16 | 17 | public RunScriptDialogTest() throws Exception { 18 | fixture = JOSMFixture.createFixture(true /* with gui */); 19 | 20 | getContentPane().setLayout(new FlowLayout()); 21 | setSize(100,100); 22 | JButton btn = new JButton("Launch"); 23 | getContentPane().add(btn); 24 | btn.addActionListener(e -> { 25 | RunScriptDialog dialog = 26 | new RunScriptDialog(RunScriptDialogTest.this); 27 | dialog.setVisible(true); 28 | }); 29 | } 30 | 31 | static public void main(String[] args) throws Exception { 32 | RunScriptDialogTest app = new RunScriptDialogTest(); 33 | app.setVisible(true); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/resources/release-notes/v0.2.5.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

Release v0.2.5

6 | 7 |
    8 |
  • Bug fix: fix #96 - scripting.graalvm.es-module-repositories entries not read by plugin
  • 9 |
10 | 11 |

12 | The JavaScript API V2 13 | is deprecated. 14 |
15 | End of 2022 it will be removed from the scripting plugin. Consider to migrate your scripts to the 16 | JavaScript API V3. 17 |

18 | 19 |

20 | Support for Mozilla Rhino 21 | and the JavaScript API V1 22 | is deprecated. 23 |
24 | End of 2022 it will be removed from the scripting plugin. 25 | Consider to migrate your scripts to the 26 | GraalJS engine 27 | and the JavaScript API V3. 28 |

29 | 30 | 31 | -------------------------------------------------------------------------------- /src/test/functional/java/org/openstreetmap/josm/plugins/scripting/ui/console/ScriptingConsolePanelTest.java: -------------------------------------------------------------------------------- 1 | package org.openstreetmap.josm.plugins.scripting.ui.console; 2 | 3 | import org.openstreetmap.josm.plugins.scripting.fixtures.JOSMFixture; 4 | 5 | import javax.swing.*; 6 | import java.awt.*; 7 | 8 | /** 9 | * functional, interactive test for {@link ScriptingConsolePanel} 10 | */ 11 | public class ScriptingConsolePanelTest extends JFrame { 12 | 13 | @SuppressWarnings({"unused", "UnusedAssignment"}) 14 | private void build() { 15 | final ScriptingConsolePanel console; 16 | Container c = getContentPane(); 17 | c.setLayout(new BorderLayout()); 18 | c.add(console = new ScriptingConsolePanel(getRootPane()), BorderLayout.CENTER); 19 | setSize(600,800); 20 | } 21 | 22 | private ScriptingConsolePanelTest() throws Exception { 23 | @SuppressWarnings("unused") 24 | // final JOSMFixture fixture = new JOSMFixture(true); 25 | final JOSMFixture fixture = JOSMFixture.createFixture(true /* with gui */); 26 | build(); 27 | } 28 | 29 | static public void main(String[] args) throws Exception { 30 | ScriptingConsolePanelTest app = new ScriptingConsolePanelTest(); 31 | app.setVisible(true); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/po/ar.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (ar) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | # Translators: 7 | # Simon Legner, 2022 8 | # 9 | msgid "" 10 | msgstr "" 11 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 12 | "Report-Msgid-Bugs-To: \n" 13 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 14 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 15 | "Language-Team: Arabic (https://www.transifex.com/josm/teams/2544/ar/)\n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=UTF-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | "Language: ar\n" 20 | "Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n" 21 | 22 | msgid "Add" 23 | msgstr "أضِف" 24 | 25 | msgid "Cancel" 26 | msgstr "إلغاء" 27 | 28 | msgid "Close" 29 | msgstr "اغلق" 30 | 31 | #. create the edit menu 32 | msgid "Edit" 33 | msgstr "حرّر" 34 | 35 | #. create the file menu 36 | msgid "File" 37 | msgstr "الملفّ" 38 | 39 | msgid "OK" 40 | msgstr "مُوافق" 41 | 42 | msgid "Remove" 43 | msgstr "أزِل" 44 | 45 | msgid "Save" 46 | msgstr "إحفَظ" 47 | 48 | msgid "Select" 49 | msgstr "إختر" 50 | 51 | msgid "unknown" 52 | msgstr "مجهول" 53 | -------------------------------------------------------------------------------- /src/main/resources/release-notes/v0.2.3.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

Release v0.2.3

6 | 7 |
    8 |
  • New: when scripts are run from the scripting console, errors are now 9 | displayed in an error console
  • 10 |
11 | 12 |

13 | The JavaScript API V2 14 | is deprecated. 15 |
16 | End of 2022 it will be removed from the scripting plugin. Consider to migrate your scripts to the 17 | JavaScript API V3. 18 |

19 | 20 |

21 | Support for Mozilla Rhino 22 | and the JavaScript API V1 23 | is deprecated. 24 |
25 | End of 2022 it will be removed from the scripting plugin. 26 | Consider to migrate your scripts to the 27 | GraalJS engine 28 | and the JavaScript API V3. 29 |

30 | 31 | 32 | -------------------------------------------------------------------------------- /src/test/functional/java/org/openstreetmap/josm/plugins/scripting/ui/console/ScriptingConsoleTest.java: -------------------------------------------------------------------------------- 1 | package org.openstreetmap.josm.plugins.scripting.ui.console; 2 | 3 | import org.openstreetmap.josm.plugins.scripting.fixtures.JOSMFixture; 4 | 5 | import javax.swing.*; 6 | import java.awt.*; 7 | import java.awt.event.ActionEvent; 8 | 9 | /** 10 | * functional, interactive test for {@link ScriptingConsole} 11 | */ 12 | public class ScriptingConsoleTest extends JFrame { 13 | 14 | private ScriptingConsoleTest() throws Exception { 15 | 16 | @SuppressWarnings("unused") 17 | final JOSMFixture fixture = JOSMFixture.createFixture(true /* with gui */); 18 | 19 | Container c = getContentPane(); 20 | c.setLayout(new FlowLayout()); 21 | JButton btn = new JButton(); 22 | btn.setAction(new AbstractAction() { 23 | @Override 24 | public void actionPerformed(ActionEvent e) { 25 | ScriptingConsole.showScriptingConsole(); 26 | } 27 | }); 28 | btn.setText("Launch"); 29 | c.add(btn); 30 | 31 | setSize(200,200); 32 | } 33 | 34 | static public void main(String[] args) throws Exception { 35 | ScriptingConsoleTest app = new ScriptingConsoleTest(); 36 | app.setVisible(true); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/org/openstreetmap/josm/plugins/scripting/ui/console/DocumentWriter.java: -------------------------------------------------------------------------------- 1 | package org.openstreetmap.josm.plugins.scripting.ui.console; 2 | 3 | import javax.swing.text.BadLocationException; 4 | import javax.swing.text.Document; 5 | import java.io.IOException; 6 | import java.io.Writer; 7 | import java.util.Arrays; 8 | 9 | /** 10 | * strong>DocumentWriter is a writer which appends text to 11 | * a {@link Document}. 12 | * 13 | */ 14 | public class DocumentWriter extends Writer { 15 | private final Document doc; 16 | public DocumentWriter(Document doc){ 17 | this.doc = doc; 18 | } 19 | 20 | @SuppressWarnings({"RedundantThrows", "NullableProblems"}) 21 | @Override 22 | public void write(char[] cbuf, int off, int len) throws IOException { 23 | String msg = new String(Arrays.copyOfRange(cbuf, off, off + len)); 24 | try { 25 | doc.insertString(doc.getLength(), msg, null); 26 | } catch(BadLocationException e){ 27 | e.printStackTrace(); 28 | } 29 | } 30 | @SuppressWarnings("RedundantThrows") 31 | @Override 32 | public void flush() throws IOException { 33 | // nothing to flush 34 | } 35 | 36 | @Override 37 | public void close() throws IOException { 38 | // nothing to close 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/po/tr.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (tr) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | # Translators: 7 | # abc Def, 2020 8 | # Simon Legner, 2022 9 | # 10 | msgid "" 11 | msgstr "" 12 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 13 | "Report-Msgid-Bugs-To: \n" 14 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 15 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 16 | "Language-Team: Turkish (https://www.transifex.com/josm/teams/2544/tr/)\n" 17 | "MIME-Version: 1.0\n" 18 | "Content-Type: text/plain; charset=UTF-8\n" 19 | "Content-Transfer-Encoding: 8bit\n" 20 | "Language: tr\n" 21 | "Plural-Forms: nplurals=2; plural=(n > 1);\n" 22 | 23 | msgid "Add" 24 | msgstr "Ekle" 25 | 26 | msgid "Cancel" 27 | msgstr "İptal" 28 | 29 | msgid "Close" 30 | msgstr "Kapat" 31 | 32 | #. create the edit menu 33 | msgid "Edit" 34 | msgstr "Düzenle" 35 | 36 | #. create the file menu 37 | msgid "File" 38 | msgstr "Dosya" 39 | 40 | msgid "OK" 41 | msgstr "OK" 42 | 43 | msgid "Remove" 44 | msgstr "Kaldır" 45 | 46 | msgid "Save" 47 | msgstr "Kaydet" 48 | 49 | msgid "Select" 50 | msgstr "Seçiniz" 51 | 52 | msgid "Version:" 53 | msgstr "Uyarlama:" 54 | 55 | msgid "cancel" 56 | msgstr "iptal et" 57 | 58 | msgid "unknown" 59 | msgstr "bilinmeyen" 60 | -------------------------------------------------------------------------------- /src/test/functional/java/org/openstreetmap/josm/plugins/scripting/ui/console/ScriptingEngineInfoPanelTest.java: -------------------------------------------------------------------------------- 1 | package org.openstreetmap.josm.plugins.scripting.ui.console; 2 | 3 | import org.openstreetmap.josm.plugins.scripting.fixtures.JOSMFixture; 4 | 5 | import javax.swing.*; 6 | import java.awt.*; 7 | 8 | /** 9 | * functional, interactive test for {@link ScriptEngineInfoPanel} 10 | */ 11 | public class ScriptingEngineInfoPanelTest extends JFrame { 12 | 13 | private ScriptingEngineInfoPanelTest() throws Exception { 14 | @SuppressWarnings("unused") 15 | // final JOSMFixture fixture = new JOSMFixture(true); 16 | final JOSMFixture fixture = JOSMFixture.createFixture(true /* with gui */); 17 | build(); 18 | } 19 | 20 | private void build() { 21 | final ScriptEngineInfoPanel infoPanel; 22 | final ScriptEditorModel model; 23 | Container c = getContentPane(); 24 | c.setLayout(new BorderLayout()); 25 | model = new ScriptEditorModel(); 26 | infoPanel = new ScriptEngineInfoPanel(model); 27 | c.add(infoPanel, BorderLayout.CENTER); 28 | setSize(600, 50); 29 | } 30 | 31 | static public void main(String[] args) throws Exception { 32 | ScriptingEngineInfoPanelTest app = new ScriptingEngineInfoPanelTest(); 33 | app.setVisible(true); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/po/te.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (te) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | # Translators: 7 | # Simon Legner, 2022 8 | # 9 | msgid "" 10 | msgstr "" 11 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 12 | "Report-Msgid-Bugs-To: \n" 13 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 14 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 15 | "Language-Team: Telugu (https://www.transifex.com/josm/teams/2544/te/)\n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=UTF-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | "Language: te\n" 20 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 21 | 22 | msgid "Cancel" 23 | msgstr "రద్దుచేయి" 24 | 25 | msgid "Close" 26 | msgstr "మూసివేయి" 27 | 28 | #. create the edit menu 29 | msgid "Edit" 30 | msgstr "సవరించు" 31 | 32 | msgid "OK" 33 | msgstr "సరే" 34 | 35 | msgid "Save" 36 | msgstr "భద్రపరుచు" 37 | 38 | msgid "Select" 39 | msgstr "ఎంచుకోండి" 40 | 41 | #. Translator credits (translators who want to be credited for their 42 | #. contributions can add their names here as the translation) 43 | msgid "translator-credits" 44 | msgstr "" 45 | "Launchpad Contributions:\n" 46 | " Praveen Illa https://launchpad.net/~telugulinux\n" 47 | " వీవెన్ https://launchpad.net/~veeven" 48 | -------------------------------------------------------------------------------- /src/main/po/he.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (he) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | # Translators: 7 | # Simon Legner, 2022 8 | # 9 | msgid "" 10 | msgstr "" 11 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 12 | "Report-Msgid-Bugs-To: \n" 13 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 14 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 15 | "Language-Team: Hebrew (https://www.transifex.com/josm/teams/2544/he/)\n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=UTF-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | "Language: he\n" 20 | "Plural-Forms: nplurals=4; plural=(n == 1 && n % 1 == 0) ? 0 : (n == 2 && n % 1 == 0) ? 1: (n % 10 == 0 && n % 1 == 0 && n > 10) ? 2 : 3;\n" 21 | 22 | msgid "Add" 23 | msgstr "הוסף" 24 | 25 | msgid "Cancel" 26 | msgstr "ביטול" 27 | 28 | msgid "Close" 29 | msgstr "סגור" 30 | 31 | msgid "Down" 32 | msgstr "מטה" 33 | 34 | #. create the edit menu 35 | msgid "Edit" 36 | msgstr "ערוך" 37 | 38 | #. create the file menu 39 | msgid "File" 40 | msgstr "קובץ" 41 | 42 | msgid "OK" 43 | msgstr "אישור" 44 | 45 | msgid "Remove" 46 | msgstr "הסר" 47 | 48 | msgid "Save" 49 | msgstr "שמירה" 50 | 51 | msgid "Select" 52 | msgstr "בחר" 53 | 54 | msgid "Up" 55 | msgstr "מעלה" 56 | 57 | msgid "unknown" 58 | msgstr "לא ידוע" 59 | -------------------------------------------------------------------------------- /src/main/po/sq.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (sq) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | # Translators: 7 | # Simon Legner, 2022 8 | # 9 | msgid "" 10 | msgstr "" 11 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 12 | "Report-Msgid-Bugs-To: \n" 13 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 14 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 15 | "Language-Team: Albanian (https://www.transifex.com/josm/teams/2544/sq/)\n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=UTF-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | "Language: sq\n" 20 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 21 | 22 | msgid "Cancel" 23 | msgstr "Anulo" 24 | 25 | msgid "OK" 26 | msgstr "OK" 27 | 28 | msgid "Select" 29 | msgstr "Përzgjidh" 30 | 31 | #. Translator credits (translators who want to be credited for their 32 | #. contributions can add their names here as the translation) 33 | msgid "translator-credits" 34 | msgstr "" 35 | "Launchpad Contributions:\n" 36 | " Ahmet Rama https://launchpad.net/~meti32\n" 37 | " Besfort https://launchpad.net/~besiguri\n" 38 | " Sidorela Uku https://launchpad.net/~sidorela\n" 39 | " StefanPrifti https://launchpad.net/~stefan-al\n" 40 | " bresta https://launchpad.net/~bresta\n" 41 | " heroid https://launchpad.net/~heroid" 42 | -------------------------------------------------------------------------------- /src/main/java/org/openstreetmap/josm/plugins/scripting/ui/LaunchRunScriptDialogAction.java: -------------------------------------------------------------------------------- 1 | package org.openstreetmap.josm.plugins.scripting.ui; 2 | 3 | import org.openstreetmap.josm.actions.JosmAction; 4 | import org.openstreetmap.josm.gui.help.HelpUtil; 5 | import org.openstreetmap.josm.tools.Shortcut; 6 | 7 | import java.awt.event.ActionEvent; 8 | import java.awt.event.KeyEvent; 9 | import java.io.Serial; 10 | 11 | import static org.openstreetmap.josm.tools.I18n.tr; 12 | 13 | public class LaunchRunScriptDialogAction extends JosmAction { 14 | @Serial 15 | private static final long serialVersionUID = 1L; 16 | 17 | public LaunchRunScriptDialogAction() { 18 | super(tr("Run..."), // title 19 | "run", // icon name 20 | tr("Run a script"), // tooltip 21 | Shortcut.registerShortcut("scripting:runScript", 22 | tr("Scripting: Run a Script"), KeyEvent.VK_R, 23 | Shortcut.NONE // don't assign an action group, let 24 | // the user assign in the preferences 25 | ), false, // don't register toolbar item 26 | "scripting:runScript", false // don't install adapters 27 | ); 28 | putValue("help", HelpUtil.ht("/Plugin/Scripting")); 29 | } 30 | 31 | @Override 32 | public void actionPerformed(ActionEvent evt) { 33 | RunScriptDialog.getInstance().setVisible(true); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/po/br.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (br) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | # Translators: 7 | # Simon Legner, 2018 8 | # Florian Schäfer, 2022 9 | # 10 | msgid "" 11 | msgstr "" 12 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 13 | "Report-Msgid-Bugs-To: \n" 14 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 15 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 16 | "Language-Team: Breton (https://www.transifex.com/josm/teams/2544/br/)\n" 17 | "MIME-Version: 1.0\n" 18 | "Content-Type: text/plain; charset=UTF-8\n" 19 | "Content-Transfer-Encoding: 8bit\n" 20 | "Language: br\n" 21 | "Plural-Forms: nplurals=5; plural=((n%10 == 1) && (n%100 != 11) && (n%100 !=71) && (n%100 !=91) ? 0 :(n%10 == 2) && (n%100 != 12) && (n%100 !=72) && (n%100 !=92) ? 1 :(n%10 ==3 || n%10==4 || n%10==9) && (n%100 < 10 || n% 100 > 19) && (n%100 < 70 || n%100 > 79) && (n%100 < 90 || n%100 > 99) ? 2 :(n != 0 && n % 1000000 == 0) ? 3 : 4);\n" 22 | 23 | msgid "Cancel" 24 | msgstr "Nullañ" 25 | 26 | #. Translator credits (translators who want to be credited for their 27 | #. contributions can add their names here as the translation) 28 | msgid "translator-credits" 29 | msgstr "" 30 | "Launchpad Contributions:\n" 31 | " ChRogel https://launchpad.net/~christian-rogel\n" 32 | " Fulup https://launchpad.net/~fulup-jakez" 33 | -------------------------------------------------------------------------------- /src/main/resources/release-notes/v0.2.0.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

Release v0.2.0

6 | 7 | 14 | 15 |

16 | Support for Mozilla Rhino 17 | and the JavaScript API V1 18 | is deprecated. 19 |
20 | End of 2022 it will be removed from the scripting plugin. 21 | Consider to migrate your scripts to the 22 | GraalJS engine 23 | and the JavaScript API V2. 24 |

25 | 26 | 27 | -------------------------------------------------------------------------------- /src/main/resources/release-notes/v0.2.2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

Release v0.2.2

6 | 7 |
    8 |
  • New: introduces JavaScript API V3, 9 | to be used with GraalJS
  • 10 |
  • New: adds support for ECMAScript Modules (ES Modules)
  • 11 |
12 | 13 |

14 | The JavaScript API V2 15 | is deprecated. 16 |
17 | End of 2022 it will be removed from the scripting plugin. Consider to migrate your scripts to the 18 | JavaScript API V3. 19 |

20 | 21 |

22 | Support for Mozilla Rhino 23 | and the JavaScript API V1 24 | is deprecated. 25 |
26 | End of 2022 it will be removed from the scripting plugin. 27 | Consider to migrate your scripts to the 28 | GraalJS engine 29 | and the JavaScript API V2. 30 |

31 | 32 | 33 | -------------------------------------------------------------------------------- /src/main/resources/release-notes/v0.2.4.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

Release v0.2.4

6 | 7 |
    8 |
  • New: improved feedback in case of errors when running a script
  • 9 |
  • Bug fix: fix bug in loading syntax style rules
  • 10 |
  • Bug fix: fix bug with displaying the menu of most recently run scripts
  • 11 |
12 | 13 |

14 | The JavaScript API V2 15 | is deprecated. 16 |
17 | End of 2022 it will be removed from the scripting plugin. Consider to migrate your scripts to the 18 | JavaScript API V3. 19 |

20 | 21 |

22 | Support for Mozilla Rhino 23 | and the JavaScript API V1 24 | is deprecated. 25 |
26 | End of 2022 it will be removed from the scripting plugin. 27 | Consider to migrate your scripts to the 28 | GraalJS engine 29 | and the JavaScript API V3. 30 |

31 | 32 | 33 | -------------------------------------------------------------------------------- /src/main/po/bs.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (bs) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | # Translators: 7 | # Simon Legner, 2022 8 | # 9 | msgid "" 10 | msgstr "" 11 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 12 | "Report-Msgid-Bugs-To: \n" 13 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 14 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 15 | "Language-Team: Bosnian (https://www.transifex.com/josm/teams/2544/bs/)\n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=UTF-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | "Language: bs\n" 20 | "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" 21 | 22 | msgid "Cancel" 23 | msgstr "Poništi" 24 | 25 | #. create the edit menu 26 | msgid "Edit" 27 | msgstr "Uredi" 28 | 29 | msgid "OK" 30 | msgstr "U redu" 31 | 32 | msgid "unknown" 33 | msgstr "nepoznato" 34 | 35 | #. Translator credits (translators who want to be credited for their 36 | #. contributions can add their names here as the translation) 37 | msgid "translator-credits" 38 | msgstr "" 39 | "Launchpad Contributions:\n" 40 | " Alem Arnaut https://launchpad.net/~alem-arnaut\n" 41 | " Alen Mahovic https://launchpad.net/~eyeofthestorm\n" 42 | " Kenan Dervišević https://launchpad.net/~kenan3008\n" 43 | " Miro Glavić https://launchpad.net/~klek" 44 | -------------------------------------------------------------------------------- /src/main/po/de_DE.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (de_DE) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | # Translators: 7 | # Simon Legner, 2022 8 | # 9 | msgid "" 10 | msgstr "" 11 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 12 | "Report-Msgid-Bugs-To: \n" 13 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 14 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 15 | "Language-Team: German (Germany) (https://www.transifex.com/josm/teams/2544/de_DE/)\n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=UTF-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | "Language: de_DE\n" 20 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 21 | 22 | msgid "Cancel" 23 | msgstr "Abbrechen" 24 | 25 | #. Translator credits (translators who want to be credited for their 26 | #. contributions can add their names here as the translation) 27 | msgid "translator-credits" 28 | msgstr "" 29 | "Launchpad Contributions:\n" 30 | " Alexander Domanski https://launchpad.net/~alexander-domanski\n" 31 | " Alexander Wunschik https://launchpad.net/~alex-wunschik\n" 32 | " Julian Metzler https://launchpad.net/~mezgrman\n" 33 | " Skyman https://launchpad.net/~sskyman\n" 34 | " eknus https://launchpad.net/~michael-sunke\n" 35 | " morbz https://launchpad.net/~morbz1\n" 36 | " ralekuja https://launchpad.net/~ralekuja\n" 37 | " tijuca https://launchpad.net/~c-schoenert" 38 | -------------------------------------------------------------------------------- /src/test/functional/java/org/openstreetmap/josm/plugins/scripting/ScriptEngineSelectionDialogTest.java: -------------------------------------------------------------------------------- 1 | package org.openstreetmap.josm.plugins.scripting; 2 | 3 | import org.openstreetmap.josm.plugins.scripting.fixtures.JOSMFixture; 4 | import org.openstreetmap.josm.plugins.scripting.model.ScriptEngineDescriptor; 5 | import org.openstreetmap.josm.plugins.scripting.ui.ScriptEngineSelectionDialog; 6 | 7 | import javax.swing.*; 8 | import java.awt.*; 9 | 10 | /** 11 | * functional, interactive test for {@link ScriptEngineSelectionDialog} 12 | */ 13 | public class ScriptEngineSelectionDialogTest extends JFrame { 14 | 15 | ScriptEngineSelectionDialogTest() throws Exception { 16 | getContentPane().setLayout(new FlowLayout()); 17 | setSize(100,100); 18 | JButton btn = new JButton("Launch"); 19 | getContentPane().add(btn); 20 | btn.addActionListener(e -> { 21 | ScriptEngineDescriptor desc = 22 | ScriptEngineSelectionDialog.select( 23 | ScriptEngineSelectionDialogTest.this,null); 24 | System.out.println(desc); 25 | }); 26 | 27 | @SuppressWarnings("unused") 28 | final JOSMFixture fixture = JOSMFixture.createFixture(true /* with gui */); 29 | } 30 | 31 | static public void main(String[] args) throws Exception { 32 | ScriptEngineSelectionDialogTest app = 33 | new ScriptEngineSelectionDialogTest(); 34 | app.setVisible(true); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/org/openstreetmap/josm/plugins/scripting/js/api/MultiCommand.java: -------------------------------------------------------------------------------- 1 | package org.openstreetmap.josm.plugins.scripting.js.api; 2 | 3 | import java.util.Arrays; 4 | import java.util.Collection; 5 | import java.util.List; 6 | import java.util.Objects; 7 | import java.util.stream.Collectors; 8 | 9 | import javax.validation.constraints.NotNull; 10 | 11 | import org.openstreetmap.josm.command.Command; 12 | import org.openstreetmap.josm.command.PseudoCommand; 13 | import org.openstreetmap.josm.data.osm.DataSet; 14 | import org.openstreetmap.josm.data.osm.OsmPrimitive; 15 | import org.openstreetmap.josm.gui.layer.OsmDataLayer; 16 | 17 | abstract public class MultiCommand extends Command{ 18 | 19 | protected OsmPrimitive[] primitives; 20 | 21 | protected static DataSet getDataSet(@NotNull OsmDataLayer layer) { 22 | Objects.requireNonNull(layer); 23 | return layer.data; 24 | } 25 | 26 | public MultiCommand(@NotNull OsmDataLayer layer) { 27 | super(getDataSet(layer)); 28 | } 29 | 30 | protected List normalize(Collection toAdd) { 31 | return toAdd.stream() 32 | .filter(Objects::nonNull) 33 | .distinct() 34 | .collect(Collectors.toList()); 35 | } 36 | 37 | @Override 38 | public Collection getChildren() { 39 | return Arrays.stream(primitives) 40 | .map(CommandForPrimitive::new) 41 | .collect(Collectors.toList()); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/po/sr.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (sr) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | # Translators: 7 | # Slobodan Simić, 2018 8 | # Simon Legner, 2022 9 | # 10 | msgid "" 11 | msgstr "" 12 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 13 | "Report-Msgid-Bugs-To: \n" 14 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 15 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 16 | "Language-Team: Serbian (https://www.transifex.com/josm/teams/2544/sr/)\n" 17 | "MIME-Version: 1.0\n" 18 | "Content-Type: text/plain; charset=UTF-8\n" 19 | "Content-Transfer-Encoding: 8bit\n" 20 | "Language: sr\n" 21 | "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" 22 | 23 | msgid "Cancel" 24 | msgstr "Одустани" 25 | 26 | #. create the edit menu 27 | msgid "Edit" 28 | msgstr "Уреди" 29 | 30 | msgid "OK" 31 | msgstr "У реду" 32 | 33 | #. Translator credits (translators who want to be credited for their 34 | #. contributions can add their names here as the translation) 35 | msgid "translator-credits" 36 | msgstr "" 37 | "Launchpad Contributions:\n" 38 | " Slobodan Simić https://launchpad.net/~slsimic\n" 39 | " Данило Шеган https://launchpad.net/~danilo\n" 40 | " Мирослав Николић https://launchpad.net/~lipek\n" 41 | " Никола Смоленски https://launchpad.net/~smolenski\n" 42 | " Предраг Супуровић YT9TP https://launchpad.net/~pedja-3" 43 | -------------------------------------------------------------------------------- /src/main/resources/release-notes/v0.2.10.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

Release v0.2.10

6 | 7 |
    8 |
  • Bug Fix: #97: Can't load josm object as ES Module 9 |
  • 10 |
  • improved loading standard ES modules on the Windows platform
  • 11 |
  • improved loading custom ES modules on the Windows platform
  • 12 | 13 | 14 |
15 | 16 |

17 | The JavaScript API V2 18 | is deprecated. 19 |
20 | End of 2023 it will be removed from the scripting plugin. Consider to migrate your scripts to the 21 | JavaScript API V3. 22 |

23 | 24 |

25 | Support for Mozilla Rhino 26 | and the JavaScript API V1 27 | is deprecated. 28 |
29 | End of 2023 it will be removed from the scripting plugin. Consider to migrate your scripts to the 30 | GraalJS engine 31 | and the JavaScript API V3. 32 |

33 | 34 | 35 | -------------------------------------------------------------------------------- /src/test/unit/groovy/org/openstreetmap/josm/plugins/scripting/BaseTestCase.groovy: -------------------------------------------------------------------------------- 1 | package org.openstreetmap.josm.plugins.scripting 2 | 3 | import org.junit.jupiter.api.BeforeAll 4 | 5 | import java.util.logging.Logger 6 | 7 | class BaseTestCase { 8 | static final def logger = Logger.getLogger(BaseTestCase.class.name) 9 | 10 | protected static File scriptingJarFile 11 | 12 | static public final String ENV_JOSM_SCRIPTING_PLUGIN_HOME = "JOSM_SCRIPTING_PLUGIN_HOME" 13 | 14 | static File getProjectHome() { 15 | def projectDirEnv = System.getenv(ENV_JOSM_SCRIPTING_PLUGIN_HOME) 16 | def projectDir 17 | if (projectDirEnv == null) { 18 | projectDir = new File(".") 19 | logger.warning( 20 | "environment variable '${ENV_JOSM_SCRIPTING_PLUGIN_HOME}' not set. " + 21 | "Assuming project home '${projectDir.absolutePath}'" 22 | ) 23 | } else { 24 | projectDir = new File(projectDirEnv) 25 | } 26 | logger.info("using project home '${projectDir.absolutePath}'") 27 | return projectDir 28 | } 29 | 30 | @BeforeAll 31 | static void lookupScriptingJarFile() { 32 | scriptingJarFile = new File(getProjectHome(), "build/dist/scripting.jar") 33 | if (!scriptingJarFile.isFile() || !scriptingJarFile.exists() || !scriptingJarFile.canRead()) { 34 | throw new IllegalStateException( 35 | "Plugin jar file '$scriptingJarFile.absolutePath' not found.") 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/po/mr.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (mr) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | # Translators: 7 | # Florian Schäfer, 2018 8 | # Simon Legner, 2022 9 | # 10 | msgid "" 11 | msgstr "" 12 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 13 | "Report-Msgid-Bugs-To: \n" 14 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 15 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 16 | "Language-Team: Marathi (https://www.transifex.com/josm/teams/2544/mr/)\n" 17 | "MIME-Version: 1.0\n" 18 | "Content-Type: text/plain; charset=UTF-8\n" 19 | "Content-Transfer-Encoding: 8bit\n" 20 | "Language: mr\n" 21 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 22 | 23 | msgid "Cancel" 24 | msgstr "रद्द करा" 25 | 26 | msgid "Close" 27 | msgstr "बंद करा" 28 | 29 | msgid "Down" 30 | msgstr "खाली" 31 | 32 | #. create the edit menu 33 | msgid "Edit" 34 | msgstr "संपादन" 35 | 36 | msgid "OK" 37 | msgstr "ठीक" 38 | 39 | msgid "Open" 40 | msgstr "खुला" 41 | 42 | msgid "Save" 43 | msgstr "साठवा" 44 | 45 | msgid "Select" 46 | msgstr "निवडा" 47 | 48 | msgid "Up" 49 | msgstr "वर" 50 | 51 | msgid "Version:" 52 | msgstr "आवृत्ती:" 53 | 54 | msgid "unknown" 55 | msgstr "अज्ञात" 56 | 57 | #. Translator credits (translators who want to be credited for their 58 | #. contributions can add their names here as the translation) 59 | msgid "translator-credits" 60 | msgstr "" 61 | "Launchpad Contributions:\n" 62 | " Singleton https://launchpad.net/~singleton47+ubuntuone" 63 | -------------------------------------------------------------------------------- /src/test/unit/groovy/org/openstreetmap/josm/plugins/scripting/graalvm/api/JSActionTest.groovy: -------------------------------------------------------------------------------- 1 | package org.openstreetmap.josm.plugins.scripting.graalvm.api 2 | 3 | import org.junit.jupiter.api.Test 4 | import org.openstreetmap.josm.plugins.scripting.graalvm.AbstractGraalVMBasedTest 5 | 6 | class JSActionTest extends AbstractGraalVMBasedTest { 7 | 8 | @Test 9 | void "can create a JSAction"() { 10 | final code = """ 11 | import {JSAction} from 'josm/ui/menu' 12 | import * as util from 'josm/util' 13 | import josm from 'josm' 14 | 15 | const JMenuItem = Java.type('javax.swing.JMenuItem') 16 | 17 | const action = new JSAction({ 18 | name: "My Action", 19 | iconName: 'myicon', 20 | toolbarId: 'myToolbarId', 21 | tooltip: "This is my action", 22 | onInitEnabled: function() { 23 | util.println('onInitEnabled: entering ...') 24 | }, 25 | onUpdateEnabled: function() { 26 | util.println('onUpdateEnabled: entering ...') 27 | }, 28 | onExecute: function() { 29 | util.println('Action is executing ...') 30 | } 31 | }) 32 | const fileMenu = josm.menu.get('file') 33 | fileMenu.addSeparator() 34 | fileMenu.add(new JMenuItem(action)) 35 | """ 36 | facade.eval(graalJSDescriptor, code) 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/org/openstreetmap/josm/plugins/scripting/ui/console/SaveAsAction.java: -------------------------------------------------------------------------------- 1 | package org.openstreetmap.josm.plugins.scripting.ui.console; 2 | 3 | import org.openstreetmap.josm.tools.ImageProvider; 4 | 5 | import javax.swing.*; 6 | import java.awt.event.ActionEvent; 7 | import java.io.File; 8 | import java.util.logging.Logger; 9 | 10 | import static org.openstreetmap.josm.tools.I18n.tr; 11 | 12 | public class SaveAsAction extends AbstractAction { 13 | @SuppressWarnings("unused") 14 | static private final Logger logger = 15 | Logger.getLogger(SaveAsAction.class.getName()); 16 | 17 | private File askFile() { 18 | final JFileChooser chooser = new JFileChooser(); 19 | chooser.setDialogTitle(tr("Select a script")); 20 | chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); 21 | chooser.setMultiSelectionEnabled(false); 22 | chooser.setFileHidingEnabled(false); 23 | final int ret = chooser.showSaveDialog(ScriptingConsole.getInstance()); 24 | if (ret != JFileChooser.APPROVE_OPTION) return null; 25 | 26 | return chooser.getSelectedFile(); 27 | } 28 | 29 | SaveAsAction() { 30 | putValue(NAME, tr("Save as ...")); 31 | putValue(SHORT_DESCRIPTION, tr("Save to a script file")); 32 | putValue(SMALL_ICON, ImageProvider.get("save_as", ImageProvider.ImageSizes.MENU)); 33 | } 34 | 35 | @Override 36 | public void actionPerformed(ActionEvent e) { 37 | final File f = askFile(); 38 | if (f == null) return; 39 | ScriptingConsole.getInstance().save(f); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/resources/release-notes/v0.2.9.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

Release v0.2.9

6 | 7 | 15 | 16 |

17 | The JavaScript API V2 18 | is deprecated. 19 |
20 | End of 2023 it will be removed from the scripting plugin. Consider to migrate your scripts to the 21 | JavaScript API V3. 22 |

23 | 24 |

25 | Support for Mozilla Rhino 26 | and the JavaScript API V1 27 | is deprecated. 28 |
29 | End of 2023 it will be removed from the scripting plugin. 30 | Consider to migrate your scripts to the 31 | GraalJS engine 32 | and the JavaScript API V3. 33 |

34 | 35 | 36 | -------------------------------------------------------------------------------- /src/test/common/java/org/openstreetmap/josm/plugins/scripting/fixtures/JOSMFixture.java: -------------------------------------------------------------------------------- 1 | package org.openstreetmap.josm.plugins.scripting.fixtures; 2 | 3 | import java.io.File; 4 | import java.nio.file.Files; 5 | import java.util.logging.Logger; 6 | 7 | import static java.text.MessageFormat.format; 8 | 9 | @SuppressWarnings("unused") 10 | public class JOSMFixture extends org.openstreetmap.josm.JOSMFixture { 11 | static public final String DEFAULT_JOSM_HOME = "build/josm.home"; 12 | static private final Logger logger = Logger.getLogger(JOSMFixture.class.getName()); 13 | 14 | public static JOSMFixture createFixture(final boolean withGui) throws Exception { 15 | String josmHome = System.getProperty("josm.home"); 16 | if (josmHome == null) { 17 | josmHome = DEFAULT_JOSM_HOME; 18 | logger.info(format("system property ''josm.home'' not set. " 19 | + "Setting it to the default value ''{0}''", 20 | new File(josmHome).getAbsolutePath())); 21 | } 22 | Files.createDirectories(new File(josmHome).toPath()); 23 | final JOSMFixture fixture = new JOSMFixture(josmHome); 24 | fixture.init(withGui); 25 | return fixture; 26 | } 27 | 28 | public static JOSMFixture createFixture() throws Exception{ 29 | return createFixture(false /* no gui */); 30 | } 31 | 32 | private final String josmHome; 33 | 34 | public String getJosmHome() { 35 | return josmHome; 36 | } 37 | 38 | public JOSMFixture(final String josmHome) throws Exception { 39 | super(josmHome); 40 | this.josmHome = josmHome; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/po/oc.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (oc) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | # Translators: 7 | # Simon Legner, 2022 8 | # 9 | msgid "" 10 | msgstr "" 11 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 12 | "Report-Msgid-Bugs-To: \n" 13 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 14 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 15 | "Language-Team: Occitan (post 1500) (https://www.transifex.com/josm/teams/2544/oc/)\n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=UTF-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | "Language: oc\n" 20 | "Plural-Forms: nplurals=2; plural=(n > 1);\n" 21 | 22 | msgid "Add" 23 | msgstr "Apondre" 24 | 25 | msgid "Cancel" 26 | msgstr "Anullar" 27 | 28 | msgid "Close" 29 | msgstr "Tampar" 30 | 31 | msgid "Down" 32 | msgstr "Davalar" 33 | 34 | #. create the edit menu 35 | msgid "Edit" 36 | msgstr "Editar" 37 | 38 | #. create the file menu 39 | msgid "File" 40 | msgstr "Fichièr" 41 | 42 | msgid "OK" 43 | msgstr "D'acòrdi" 44 | 45 | msgid "Open" 46 | msgstr "Dobrir" 47 | 48 | msgid "Remove" 49 | msgstr "Levar" 50 | 51 | msgid "Save" 52 | msgstr "Salvar" 53 | 54 | msgid "Select" 55 | msgstr "Seleccionar" 56 | 57 | msgid "Up" 58 | msgstr "Montar" 59 | 60 | msgid "unknown" 61 | msgstr "desconegut" 62 | 63 | #. Translator credits (translators who want to be credited for their 64 | #. contributions can add their names here as the translation) 65 | msgid "translator-credits" 66 | msgstr "" 67 | "Launchpad Contributions:\n" 68 | " Cédric VALMARY (Tot en òc) https://launchpad.net/~cvalmary" 69 | -------------------------------------------------------------------------------- /jsdoc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Creates the jsdoc documentation 4 | # 5 | 6 | prepare_output_dir() { 7 | local output_dir=$1 8 | 9 | mkdir -p "${output_dir}/v3" 10 | } 11 | 12 | print_help() { 13 | echo "./jsdoc.sh [args]" 14 | echo " -o | --outputdir " 15 | echo " optional. default is 'out'" 16 | echo " -h | --help" 17 | echo " print help information" 18 | } 19 | 20 | # default output directory 21 | OUTPUT_DIR="out" 22 | 23 | while [ $# -gt 0 ] ; 24 | do 25 | arg=$1 26 | case $arg in 27 | -o | --output-dir) 28 | shift 29 | if [ $# -eq 0 ] ; then 30 | echo "error: missing outputdir" 1>&2 31 | print_help 32 | exit 1 33 | fi 34 | OUTPUT_DIR=$1 35 | shift 36 | ;; 37 | 38 | *) 39 | echo "error: unsupported command line argument '$arg'" 1>&2 40 | print_help 41 | exit 1 42 | ;; 43 | esac 44 | done 45 | 46 | prepare_output_dir $OUTPUT_DIR 47 | 48 | # the path to the jsdoc templates and project specific js modules 49 | TEMPLATE_PATH=$(pwd)/docstrap/template 50 | #TEMPLATE_PATH=$HOME/repositories/docstrap/template 51 | 52 | # add the template path to the node path if not yet present 53 | if [ "$(echo $NODE_PATH | tr ":" "\n" | grep $TEMPLATE_PATH)" == "" ] ; then 54 | export NODE_PATH=$NODE_PATH:$TEMPLATE_PATH 55 | fi 56 | 57 | JSDOC=`which jsdoc` 58 | if [ "$JSDOC" == "" ] ; then 59 | echo "error: jsdoc not found" 60 | echo "Make sure jsdoc is installed. See README.md" 61 | exit 1 62 | fi 63 | 64 | echo "Generating documentation for API version 'v3' in '$OUTPUT_DIR/v3' ..." 65 | jsdoc \ 66 | -c jsdoc.v3.conf \ 67 | -t $TEMPLATE_PATH \ 68 | -d $OUTPUT_DIR/v3 69 | -------------------------------------------------------------------------------- /src/main/po/ta.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (ta) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | # Translators: 7 | # Arun Balaji, 2018 8 | # Simon Legner, 2022 9 | # 10 | msgid "" 11 | msgstr "" 12 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 13 | "Report-Msgid-Bugs-To: \n" 14 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 15 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 16 | "Language-Team: Tamil (https://www.transifex.com/josm/teams/2544/ta/)\n" 17 | "MIME-Version: 1.0\n" 18 | "Content-Type: text/plain; charset=UTF-8\n" 19 | "Content-Transfer-Encoding: 8bit\n" 20 | "Language: ta\n" 21 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 22 | 23 | msgid "Add" 24 | msgstr "சேர்" 25 | 26 | msgid "Cancel" 27 | msgstr "ரத்து செய்" 28 | 29 | msgid "Close" 30 | msgstr "மூடுக" 31 | 32 | msgid "Down" 33 | msgstr "கீழே " 34 | 35 | #. create the edit menu 36 | msgid "Edit" 37 | msgstr "தொகுத்தல்" 38 | 39 | #. create the file menu 40 | msgid "File" 41 | msgstr "கோப்பு" 42 | 43 | msgid "File:" 44 | msgstr "கோப்பு:" 45 | 46 | msgid "JAR file" 47 | msgstr "JAR கோப்பு" 48 | 49 | msgid "Language version:" 50 | msgstr "மொழி பதிப்பு:" 51 | 52 | msgid "Language:" 53 | msgstr "மொழி:" 54 | 55 | msgid "Name:" 56 | msgstr "பெயர்:" 57 | 58 | msgid "OK" 59 | msgstr "சரி" 60 | 61 | msgid "Open" 62 | msgstr "திற" 63 | 64 | msgid "Remove" 65 | msgstr "நீக்கு" 66 | 67 | msgid "Save" 68 | msgstr "சேமி" 69 | 70 | msgid "Select" 71 | msgstr "தேர்ந்தெடு" 72 | 73 | msgid "Up" 74 | msgstr "மேலே" 75 | 76 | msgid "Version:" 77 | msgstr "பதிப்பு:" 78 | 79 | msgid "cancel" 80 | msgstr "ரத்து செய்" 81 | -------------------------------------------------------------------------------- /src/test/unit/groovy/org/openstreetmap/josm/plugins/scripting/model/ScriptEngineTypeTest.groovy: -------------------------------------------------------------------------------- 1 | package org.openstreetmap.josm.plugins.scripting.model 2 | 3 | import org.junit.jupiter.api.Test 4 | import org.openstreetmap.josm.plugins.scripting.model.ScriptEngineDescriptor.ScriptEngineType 5 | import static org.junit.Assert.* 6 | 7 | class ScriptEngineTypeTest { 8 | 9 | @Test 10 | void "should initialize engine type from supported engine preference value"() { 11 | def type 12 | 13 | type = ScriptEngineType.fromPreferencesValue("plugged/rhino") 14 | assertEquals(ScriptEngineType.PLUGGED, type) 15 | 16 | type = ScriptEngineType.fromPreferencesValue("graalvm/s") 17 | assertEquals(ScriptEngineType.GRAALVM, type) 18 | 19 | type = ScriptEngineType.fromPreferencesValue("plugged") 20 | assertEquals(ScriptEngineType.PLUGGED, type) 21 | 22 | type = ScriptEngineType.fromPreferencesValue("graalvm") 23 | assertEquals(ScriptEngineType.GRAALVM, type) 24 | } 25 | 26 | @Test 27 | void "should normalize preference values for scripting engines"() { 28 | def type 29 | 30 | type = ScriptEngineType.fromPreferencesValue(" GraalVM/JS ") 31 | assertEquals(ScriptEngineType.GRAALVM, type) 32 | 33 | type = ScriptEngineType.fromPreferencesValue("\t plugged/rhino \t") 34 | assertEquals(ScriptEngineType.PLUGGED, type) 35 | 36 | type = ScriptEngineType.fromPreferencesValue(" plugged ") 37 | assertEquals(ScriptEngineType.PLUGGED, type) 38 | 39 | type = ScriptEngineType.fromPreferencesValue(" GrAaLVM ") 40 | assertEquals(ScriptEngineType.GRAALVM, type) 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/resources/contrib/LICENSE.RSyntaxTextArea: -------------------------------------------------------------------------------- 1 | Source: https://github.com/bobbylight/RSyntaxTextArea/blob/master/RSyntaxTextArea/src/main/resources/META-INF/LICENSE 2 | 3 | Copyright (c) 2019, Robert Futrell 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | * Neither the name of the author nor the names of its contributors may 14 | be used to endorse or promote products derived from this software 15 | without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 21 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /src/main/po/sl.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (sl) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | # Translators: 7 | # Simon Legner, 2022 8 | # 9 | msgid "" 10 | msgstr "" 11 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 12 | "Report-Msgid-Bugs-To: \n" 13 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 14 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 15 | "Language-Team: Slovenian (https://www.transifex.com/josm/teams/2544/sl/)\n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=UTF-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | "Language: sl\n" 20 | "Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n" 21 | 22 | msgid "Add" 23 | msgstr "Dodaj" 24 | 25 | msgid "Cancel" 26 | msgstr "Prekliči" 27 | 28 | msgid "Close" 29 | msgstr "Zapri" 30 | 31 | msgid "Down" 32 | msgstr "Dol" 33 | 34 | #. create the edit menu 35 | msgid "Edit" 36 | msgstr "Uredi" 37 | 38 | #. create the file menu 39 | msgid "File" 40 | msgstr "Datoteka" 41 | 42 | msgid "OK" 43 | msgstr "Potrdi" 44 | 45 | msgid "Remove" 46 | msgstr "Odstrani" 47 | 48 | msgid "Save" 49 | msgstr "Shrani" 50 | 51 | msgid "Select" 52 | msgstr "Izberite" 53 | 54 | msgid "Up" 55 | msgstr "Gor" 56 | 57 | msgid "unknown" 58 | msgstr "neznan" 59 | 60 | #. Translator credits (translators who want to be credited for their 61 | #. contributions can add their names here as the translation) 62 | msgid "translator-credits" 63 | msgstr "" 64 | "Launchpad Contributions:\n" 65 | " Aleš Trtnik https://launchpad.net/~ales\n" 66 | " Dirk Stöcker https://launchpad.net/~stoecker\n" 67 | " Štefan Baebler https://launchpad.net/~stefanba" 68 | -------------------------------------------------------------------------------- /src/main/java/org/openstreetmap/josm/plugins/scripting/preferences/common/ImportPathCellRenderer.java: -------------------------------------------------------------------------------- 1 | package org.openstreetmap.josm.plugins.scripting.preferences.common; 2 | 3 | import javax.swing.*; 4 | import java.awt.*; 5 | import java.io.File; 6 | import java.util.logging.Logger; 7 | 8 | import static org.openstreetmap.josm.plugins.scripting.preferences.common.IconUtil.saveImageGet; 9 | 10 | public class ImportPathCellRenderer extends JLabel implements ListCellRenderer { 11 | 12 | @SuppressWarnings("unused") 13 | static private final Logger logger = 14 | Logger.getLogger(ImportPathCellRenderer.class.getName()); 15 | 16 | private final Icon jarIcon; 17 | private final Icon dirIcon; 18 | 19 | public ImportPathCellRenderer() { 20 | setOpaque(true); 21 | jarIcon = saveImageGet("jar"); 22 | dirIcon = saveImageGet("directory"); 23 | } 24 | 25 | @Override 26 | public Component getListCellRendererComponent(JList list, 27 | File path, 28 | int index, boolean isSelected, boolean hasFocus) { 29 | setText(path.getAbsolutePath()); 30 | if (isSelected) { 31 | setForeground(UIManager.getColor("List.selectionForeground")); 32 | setBackground(UIManager.getColor("List.selectionBackground")); 33 | } else { 34 | setForeground(UIManager.getColor("List.foreground")); 35 | setBackground(UIManager.getColor("List.background")); 36 | } 37 | if (path.isDirectory()) { 38 | setIcon(dirIcon); 39 | } else if (path.isFile() && path.getName().endsWith(".jar")) { 40 | setIcon(jarIcon); 41 | } else { 42 | setIcon(null); 43 | } 44 | return this; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/org/openstreetmap/josm/plugins/scripting/ui/console/SaveAction.java: -------------------------------------------------------------------------------- 1 | package org.openstreetmap.josm.plugins.scripting.ui.console; 2 | 3 | import org.openstreetmap.josm.tools.ImageProvider; 4 | 5 | import javax.swing.*; 6 | import java.awt.event.ActionEvent; 7 | import java.beans.PropertyChangeEvent; 8 | import java.beans.PropertyChangeListener; 9 | import java.util.logging.Logger; 10 | 11 | import static org.openstreetmap.josm.tools.I18n.tr; 12 | 13 | public class SaveAction extends AbstractAction implements PropertyChangeListener { 14 | 15 | @SuppressWarnings("unused") 16 | static private final Logger logger = Logger.getLogger(SaveAsAction.class.getName()); 17 | 18 | SaveAction() { 19 | putValue(NAME, tr("Save")); 20 | putValue(SHORT_DESCRIPTION, tr("Save script to current file")); 21 | putValue(SMALL_ICON, ImageProvider.get("save", ImageProvider.ImageSizes.MENU)); 22 | updateEnabledState(); 23 | } 24 | 25 | @Override 26 | public void actionPerformed(ActionEvent e) { 27 | ScriptingConsole.getInstance().save(); 28 | } 29 | 30 | private void updateEnabledState() { 31 | final ScriptingConsole console = ScriptingConsole.getInstance(); 32 | if (console == null) { 33 | setEnabled(false); 34 | return; 35 | } 36 | setEnabled(console.getScriptEditorModel().getScriptFile().isPresent()); 37 | } 38 | 39 | /* --------------------------------------------------------------------- */ 40 | /* interface PropertyChangeListener */ 41 | /* --------------------------------------------------------------------- */ 42 | @Override 43 | public void propertyChange(PropertyChangeEvent evt) { 44 | updateEnabledState(); 45 | } 46 | } -------------------------------------------------------------------------------- /src/main/java/org/openstreetmap/josm/plugins/scripting/preferences/graalvm/ESModuleRepoConfigurationPanel.java: -------------------------------------------------------------------------------- 1 | package org.openstreetmap.josm.plugins.scripting.preferences.graalvm; 2 | 3 | import org.openstreetmap.josm.data.Preferences; 4 | import org.openstreetmap.josm.plugins.scripting.graalvm.esmodule.ESModuleResolver; 5 | import org.openstreetmap.josm.plugins.scripting.ui.EditorPaneBuilder; 6 | 7 | import javax.swing.*; 8 | import javax.validation.constraints.NotNull; 9 | import java.awt.*; 10 | 11 | import static org.openstreetmap.josm.tools.I18n.tr; 12 | 13 | public class ESModuleRepoConfigurationPanel extends AbstractRepoConfigurationPanel { 14 | protected JPanel buildInfoPanel() { 15 | final JEditorPane pane = EditorPaneBuilder.buildInfoEditorPane(); 16 | final String text = 17 | "" 18 | + tr( 19 | "

" 20 | + "GraalJS can load ECMAScript Modules (ES Modules)." 21 | + "It resolves ES Modules in the directories and jar files configured below." 22 | + "

" 23 | ) 24 | + ""; 25 | pane.setText(text); 26 | final JPanel pnl = new JPanel(new BorderLayout()); 27 | pnl.add(pane, BorderLayout.CENTER); 28 | return pnl; 29 | } 30 | 31 | protected RepositoriesListModel buildRepositoriesListModel(@NotNull final ListSelectionModel selectionModel) { 32 | final var model = new RepositoriesListModel(selectionModel); 33 | model.loadRepositories(ESModuleResolver.getInstance()); 34 | return model; 35 | } 36 | 37 | public void persistToPreferences() { 38 | mdlRepositories.saveRepositories(ESModuleResolver.getInstance()); 39 | ESModuleResolver.getInstance().saveToPreferences(Preferences.main()); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/org/openstreetmap/josm/plugins/scripting/graalvm/GraalVMFacadeFactory.java: -------------------------------------------------------------------------------- 1 | package org.openstreetmap.josm.plugins.scripting.graalvm; 2 | 3 | import java.util.logging.Level; 4 | import java.util.logging.Logger; 5 | 6 | public class GraalVMFacadeFactory { 7 | static private final Logger logger = Logger.getLogger(GraalVMFacadeFactory.class.getName()); 8 | private static IGraalVMFacade instance = null; 9 | 10 | /** 11 | * Replies true, if the GraalVM is present and if the GraalVM polyglot API can be used 12 | * 13 | * @return true, if GraalVM is present 14 | */ 15 | static public boolean isGraalVMPresent() { 16 | try { 17 | Class.forName("org.graalvm.polyglot.Context"); 18 | return true; 19 | } catch (ClassNotFoundException e) { 20 | logger.log(Level.FINEST, "class not found", e); 21 | return false; 22 | } 23 | } 24 | 25 | /** 26 | * Replies a facade to the GraalVM or null, if the GraalVM isn't on 27 | * the classpath or if it can't be initialized 28 | * 29 | * @return a facade to the GraalVM 30 | */ 31 | static public IGraalVMFacade createGraalVMFacade() { 32 | if (!isGraalVMPresent()) { 33 | logger.warning("GraalVM polyglot API isn't on the class path. Support for GraalVM is disabled."); 34 | return null; 35 | } 36 | return new GraalVMFacade(); 37 | } 38 | 39 | /** 40 | * Creates a GraalVM facade if it doesn't exist yet and replies the current 41 | * GraalVM facade 42 | * 43 | * @return the facade 44 | */ 45 | static public IGraalVMFacade getOrCreateGraalVMFacade() { 46 | if (instance == null) { 47 | instance = createGraalVMFacade(); 48 | } 49 | return instance; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/po/en_AU.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (en_AU) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | # Translators: 7 | # Simon Legner, 2022 8 | # 9 | msgid "" 10 | msgstr "" 11 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 12 | "Report-Msgid-Bugs-To: \n" 13 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 14 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 15 | "Language-Team: English (Australia) (https://www.transifex.com/josm/teams/2544/en_AU/)\n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=UTF-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | "Language: en_AU\n" 20 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 21 | 22 | msgid "Add" 23 | msgstr "Add" 24 | 25 | msgid "Cancel" 26 | msgstr "Cancel" 27 | 28 | msgid "Close" 29 | msgstr "Close" 30 | 31 | msgid "Down" 32 | msgstr "Down" 33 | 34 | #. create the edit menu 35 | msgid "Edit" 36 | msgstr "Edit" 37 | 38 | #. create the file menu 39 | msgid "File" 40 | msgstr "File" 41 | 42 | msgid "OK" 43 | msgstr "OK" 44 | 45 | msgid "Open" 46 | msgstr "Open" 47 | 48 | msgid "Remove" 49 | msgstr "Remove" 50 | 51 | msgid "Save" 52 | msgstr "Save" 53 | 54 | msgid "Select" 55 | msgstr "Select" 56 | 57 | msgid "Up" 58 | msgstr "Up" 59 | 60 | msgid "unknown" 61 | msgstr "unknown" 62 | 63 | #. Translator credits (translators who want to be credited for their 64 | #. contributions can add their names here as the translation) 65 | msgid "translator-credits" 66 | msgstr "" 67 | "Launchpad Contributions:\n" 68 | " Craig Rathbone https://launchpad.net/~craigrat\n" 69 | " Daniel Neel https://launchpad.net/~dneelyep\n" 70 | " Dirk Stöcker https://launchpad.net/~stoecker\n" 71 | " Mark Pulley https://launchpad.net/~mrpulley\n" 72 | " Robert Readman https://launchpad.net/~robert-readman" 73 | -------------------------------------------------------------------------------- /src/main/po/km.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (km) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | # Translators: 7 | # Simon Legner, 2022 8 | # 9 | msgid "" 10 | msgstr "" 11 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 12 | "Report-Msgid-Bugs-To: \n" 13 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 14 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 15 | "Language-Team: Khmer (https://www.transifex.com/josm/teams/2544/km/)\n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=UTF-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | "Language: km\n" 20 | "Plural-Forms: nplurals=1; plural=0;\n" 21 | 22 | msgid "Add" 23 | msgstr "បន្ថែម" 24 | 25 | msgid "Add toolbar button" 26 | msgstr "បន្ថែម​ប៊ូតុង​របារ​ឧបករណ៍" 27 | 28 | msgid "Cancel" 29 | msgstr "បោះបង់" 30 | 31 | msgid "Close" 32 | msgstr "បិទ" 33 | 34 | msgid "Down" 35 | msgstr "ចុះក្រោម" 36 | 37 | #. create the edit menu 38 | msgid "Edit" 39 | msgstr "កែសម្រួល" 40 | 41 | #. create the file menu 42 | msgid "File" 43 | msgstr "ឯកសារ" 44 | 45 | msgid "OK" 46 | msgstr "យល់​​ព្រម" 47 | 48 | msgid "Open" 49 | msgstr "បើក" 50 | 51 | msgid "Remove" 52 | msgstr "យកចេញ" 53 | 54 | msgid "Save" 55 | msgstr "រក្សាទុក" 56 | 57 | msgid "Select" 58 | msgstr "ជ្រើសរើស" 59 | 60 | msgid "Up" 61 | msgstr "ឡើង​លើ" 62 | 63 | msgid "Version:" 64 | msgstr "កំណែ៖" 65 | 66 | msgid "unknown" 67 | msgstr "មិន​ស្គាល់" 68 | 69 | #. Translator credits (translators who want to be credited for their 70 | #. contributions can add their names here as the translation) 71 | msgid "translator-credits" 72 | msgstr "" 73 | "Launchpad Contributions:\n" 74 | " Sophea Sok https://launchpad.net/~sksophea\n" 75 | " chhorran https://launchpad.net/~chhorran\n" 76 | " វ័ណថារិទ្ធ https://launchpad.net/~vantharith-oum" 77 | -------------------------------------------------------------------------------- /src/test/unit/groovy/org/openstreetmap/josm/plugins/scripting/graalvm/api/APIV3FunctionalTest.groovy: -------------------------------------------------------------------------------- 1 | package org.openstreetmap.josm.plugins.scripting.graalvm.api 2 | 3 | 4 | import org.junit.jupiter.api.BeforeEach 5 | import org.junit.jupiter.api.Test 6 | import org.openstreetmap.josm.plugins.scripting.graalvm.AbstractGraalVMBasedTest 7 | import org.openstreetmap.josm.plugins.scripting.graalvm.esmodule.ESModuleResolver 8 | import org.openstreetmap.josm.plugins.scripting.graalvm.esmodule.FileSystemESModuleRepository 9 | 10 | class APIV3FunctionalTest extends AbstractGraalVMBasedTest{ 11 | 12 | static private ESModuleResolver resolver 13 | 14 | @BeforeEach 15 | void setupResolverAndContext() { 16 | resolver = ESModuleResolver.instance 17 | final repo = new FileSystemESModuleRepository(new File( 18 | getProjectHome(), 19 | "src/test/functional/javascript/v3" 20 | )) 21 | resolver.setUserDefinedRepositories(List.of(repo)) 22 | } 23 | 24 | final def testModules = [ 25 | "command-add-test", 26 | "command-change-test", 27 | "command-delete-test", 28 | "command-undo-redo-test", 29 | "ds-test", 30 | "layer-test", 31 | "menu-bar-test", 32 | "menu-test", 33 | "open-files-test", 34 | "api-download-test" 35 | // don't run api-upload-test as part of the test suite 36 | // "api-upload-test" 37 | ] 38 | 39 | @Test 40 | void "can execute functional tests"() { 41 | testModules.forEach(module -> { 42 | facade.resetContext() 43 | getLogger().info("Running tests in module $module ...") 44 | final source = """ 45 | import {run} from '$module' 46 | run() 47 | """ 48 | facade.eval(graalJSDescriptor, source) 49 | }) 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/po/vi.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (vi) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | # Translators: 7 | # Florian Schäfer, 2018 8 | # Simon Legner, 2022 9 | # 10 | msgid "" 11 | msgstr "" 12 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 13 | "Report-Msgid-Bugs-To: \n" 14 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 15 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 16 | "Language-Team: Vietnamese (https://www.transifex.com/josm/teams/2544/vi/)\n" 17 | "MIME-Version: 1.0\n" 18 | "Content-Type: text/plain; charset=UTF-8\n" 19 | "Content-Transfer-Encoding: 8bit\n" 20 | "Language: vi\n" 21 | "Plural-Forms: nplurals=1; plural=0;\n" 22 | 23 | msgid "Add" 24 | msgstr "Thêm" 25 | 26 | msgid "Add toolbar button" 27 | msgstr "nút trên thanh công cụ Add" 28 | 29 | msgid "Cancel" 30 | msgstr "Hủy bỏ" 31 | 32 | msgid "Close" 33 | msgstr "Đóng" 34 | 35 | msgid "Down" 36 | msgstr "Down" 37 | 38 | #. create the edit menu 39 | msgid "Edit" 40 | msgstr "Sửa" 41 | 42 | msgid "OK" 43 | msgstr "OK" 44 | 45 | msgid "Open" 46 | msgstr "Open" 47 | 48 | msgid "Remove" 49 | msgstr "Hủy bỏ" 50 | 51 | msgid "Save" 52 | msgstr "Lưu" 53 | 54 | msgid "Select" 55 | msgstr "Chọn" 56 | 57 | msgid "Up" 58 | msgstr "Up" 59 | 60 | msgid "Version:" 61 | msgstr "Version:" 62 | 63 | msgid "unknown" 64 | msgstr "không rõ" 65 | 66 | #. Translator credits (translators who want to be credited for their 67 | #. contributions can add their names here as the translation) 68 | msgid "translator-credits" 69 | msgstr "" 70 | "Launchpad Contributions:\n" 71 | " Hb https://launchpad.net/~hbb\n" 72 | " Huy Le https://launchpad.net/~huy-lenq\n" 73 | " Le Viet Thanh https://launchpad.net/~lethanhx2k\n" 74 | " Minh Nguyễn https://launchpad.net/~mxn\n" 75 | " Mạnh https://launchpad.net/~laituanmanh32" 76 | -------------------------------------------------------------------------------- /src/test/unit/groovy/org/openstreetmap/josm/plugins/scripting/graalvm/CommonJSModuleRepositoryFactoryTest.groovy: -------------------------------------------------------------------------------- 1 | package org.openstreetmap.josm.plugins.scripting.graalvm 2 | 3 | import static org.junit.Assert.assertTrue 4 | import org.junit.jupiter.api.BeforeAll 5 | import org.junit.jupiter.api.Test 6 | import org.openstreetmap.josm.plugins.scripting.graalvm.commonjs.CommonJSModuleRepositoryFactory 7 | import org.openstreetmap.josm.plugins.scripting.graalvm.commonjs.FileSystemJSModuleRepository 8 | import org.openstreetmap.josm.plugins.scripting.graalvm.commonjs.JarJSModuleRepository 9 | 10 | class CommonJSModuleRepositoryFactoryTest { 11 | 12 | static def projectHome 13 | 14 | @BeforeAll 15 | static void readEnvironmentVariables() { 16 | projectHome = System.getenv("JOSM_SCRIPTING_PLUGIN_HOME") 17 | if (projectHome == null) { 18 | throw new Exception( 19 | "environment variable JOSM_SCRIPTING_PLUGIN_HOME missing") 20 | } 21 | } 22 | 23 | static String jarReposBaseDir() { 24 | return "${projectHome}/src/test/resources/jar-repos" 25 | } 26 | 27 | static File testJarFile(String name){ 28 | return new File(jarReposBaseDir(), name) 29 | } 30 | 31 | @Test 32 | void "should build a repo with a valid file uri"() { 33 | def factory = CommonJSModuleRepositoryFactory.instance 34 | def uri = new File("/foo/bar").toURI() 35 | def repo = factory.build(uri) 36 | assertTrue(repo instanceof FileSystemJSModuleRepository) 37 | } 38 | 39 | @Test 40 | void "should build a repo with a valid jar uri"() { 41 | def factory = CommonJSModuleRepositoryFactory.instance 42 | def uri = "jar:${testJarFile('jar-repo-2.jar').toURI().toString()}!/foo" 43 | def repo = factory.build(uri) 44 | assertTrue(repo instanceof JarJSModuleRepository) 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/po/ca@valencia.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (ca@valencia) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | # Translators: 7 | # Simon Legner, 2022 8 | # 9 | msgid "" 10 | msgstr "" 11 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 12 | "Report-Msgid-Bugs-To: \n" 13 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 14 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 15 | "Language-Team: Catalan (Valencian) (https://www.transifex.com/josm/teams/2544/ca@valencia/)\n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=UTF-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | "Language: ca@valencia\n" 20 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 21 | 22 | msgid "Add" 23 | msgstr "Afig" 24 | 25 | msgid "Cancel" 26 | msgstr "Cancel·la" 27 | 28 | msgid "Clear log" 29 | msgstr "Neteja el registre" 30 | 31 | msgid "Close" 32 | msgstr "Tanca" 33 | 34 | msgid "Down" 35 | msgstr "Avall" 36 | 37 | #. create the edit menu 38 | msgid "Edit" 39 | msgstr "Edita" 40 | 41 | #. create the file menu 42 | msgid "File" 43 | msgstr "Fitxer" 44 | 45 | msgid "Name:" 46 | msgstr "Nom:" 47 | 48 | msgid "OK" 49 | msgstr "D’acord" 50 | 51 | msgid "Open" 52 | msgstr "Obri" 53 | 54 | msgid "Remove" 55 | msgstr "Suprimeix" 56 | 57 | msgid "Save" 58 | msgstr "Guarda" 59 | 60 | msgid "Select" 61 | msgstr "Selecciona" 62 | 63 | msgid "Up" 64 | msgstr "Amunt" 65 | 66 | msgid "Version:" 67 | msgstr "Versió:" 68 | 69 | msgid "unknown" 70 | msgstr "desconegut" 71 | 72 | #. Translator credits (translators who want to be credited for their 73 | #. contributions can add their names here as the translation) 74 | msgid "translator-credits" 75 | msgstr "" 76 | "Launchpad Contributions:\n" 77 | " Dirk Stöcker https://launchpad.net/~stoecker\n" 78 | " pitort https://launchpad.net/~pitort" 79 | -------------------------------------------------------------------------------- /src/test/unit/groovy/org/openstreetmap/josm/plugins/scripting/graalvm/esmodule/AbstractESModuleRepositoryTest.groovy: -------------------------------------------------------------------------------- 1 | package org.openstreetmap.josm.plugins.scripting.graalvm.esmodule 2 | 3 | import org.junit.jupiter.api.Test 4 | import org.openstreetmap.josm.plugins.scripting.BaseTestCase 5 | import org.openstreetmap.josm.plugins.scripting.model.RelativePath 6 | 7 | import static org.junit.Assert.assertFalse 8 | import static org.junit.Assert.assertTrue 9 | 10 | class AbstractESModuleRepositoryTest extends BaseTestCase{ 11 | 12 | @Test 13 | void "accepts ES Module path with correct prefix"() { 14 | final path = RelativePath.of( 15 | IESModuleRepository.ES_MODULE_REPO_PATH_PREFIX, 16 | UUID.randomUUID().toString() 17 | ) 18 | assertTrue(AbstractESModuleRepository.startsWithESModuleRepoPathPrefix(path)) 19 | } 20 | 21 | @Test 22 | void "rejects illegal ES Module paths with incorrect prefix"() { 23 | def path 24 | 25 | // path is null 26 | assertFalse(AbstractESModuleRepository.startsWithESModuleRepoPathPrefix(null)) 27 | 28 | // path is not absolute 29 | path = RelativePath.parse("foo/bar") 30 | assertFalse(AbstractESModuleRepository.startsWithESModuleRepoPathPrefix(path)) 31 | 32 | // path is too short 33 | path = RelativePath.parse("foo") 34 | assertFalse(AbstractESModuleRepository.startsWithESModuleRepoPathPrefix(path)) 35 | 36 | // path doesn't start with 'es-module-repo' 37 | path = RelativePath.parse("foo/bar/baz") 38 | assertFalse(AbstractESModuleRepository.startsWithESModuleRepoPathPrefix(path)) 39 | 40 | // second component isn't an UUID 41 | path = RelativePath.parse("${IESModuleRepository.ES_MODULE_REPO_PATH_PREFIX}/foo/baz") 42 | assertFalse(AbstractESModuleRepository.startsWithESModuleRepoPathPrefix(path)) 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/org/openstreetmap/josm/plugins/scripting/ui/SwingUtil.java: -------------------------------------------------------------------------------- 1 | package org.openstreetmap.josm.plugins.scripting.ui; 2 | 3 | import javax.swing.*; 4 | import javax.validation.constraints.NotNull; 5 | import java.lang.reflect.InvocationTargetException; 6 | import java.util.Objects; 7 | import java.util.logging.Level; 8 | import java.util.logging.Logger; 9 | import static java.text.MessageFormat.format; 10 | 11 | public class SwingUtil { 12 | static private final Logger logger = Logger.getLogger(SwingUtil.class.getName()); 13 | 14 | /** 15 | * Executes a runnable on the Swing EDT 16 | * 17 | * @param r the runnable 18 | * @throws NullPointerException if r is null 19 | * @throws RuntimeException if r wraps and exception (wrapped in a RuntimeException) 20 | */ 21 | static public void runOnSwingEDT(@NotNull final Runnable r){ 22 | Objects.requireNonNull(r); 23 | if (SwingUtilities.isEventDispatchThread()) { 24 | r.run(); 25 | } else { 26 | try { 27 | SwingUtilities.invokeAndWait(r); 28 | } catch(InvocationTargetException e){ 29 | Throwable throwable = e.getCause(); 30 | if (throwable instanceof Error) { 31 | throw (Error) throwable; 32 | } else if(throwable instanceof RuntimeException) { 33 | throw (RuntimeException) throwable; 34 | } 35 | // no other checked exceptions expected - log a warning 36 | logger.log(Level.WARNING, format( 37 | "Unexpected exception wrapped in InvocationTargetException: {0}", 38 | throwable.toString() 39 | ), throwable); 40 | } catch(InterruptedException e){ 41 | Thread.currentThread().interrupt(); 42 | } 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/po/hr.po: -------------------------------------------------------------------------------- 1 | # Translations for the JOSM plugin 'scripting' (hr) 2 | # Copyright (C) 2022 Gubaer 3 | # This file is distributed under the same license as the josm-plugin_scripting package. 4 | # FIRST AUTHOR, YEAR. 5 | # 6 | # Translators: 7 | # Simon Legner, 2022 8 | # 9 | msgid "" 10 | msgstr "" 11 | "Project-Id-Version: josm-plugin_scripting v0.2.0\n" 12 | "Report-Msgid-Bugs-To: \n" 13 | "POT-Creation-Date: 2022-05-19 18:29+0200\n" 14 | "PO-Revision-Date: 2018-01-17 21:36+0000\n" 15 | "Language-Team: Croatian (https://www.transifex.com/josm/teams/2544/hr/)\n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=UTF-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | "Language: hr\n" 20 | "Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" 21 | 22 | msgid "Add" 23 | msgstr "Dodaj" 24 | 25 | msgid "Cancel" 26 | msgstr "Poništi" 27 | 28 | msgid "Close" 29 | msgstr "Zatvori" 30 | 31 | msgid "Down" 32 | msgstr "Dole" 33 | 34 | #. create the edit menu 35 | msgid "Edit" 36 | msgstr "Uredi" 37 | 38 | msgid "OK" 39 | msgstr "U redu" 40 | 41 | msgid "Open" 42 | msgstr "Otvori" 43 | 44 | msgid "Remove" 45 | msgstr "Ukloni" 46 | 47 | msgid "Save" 48 | msgstr "Spremi" 49 | 50 | msgid "Select" 51 | msgstr "Odaberi" 52 | 53 | msgid "Up" 54 | msgstr "Gore" 55 | 56 | msgid "unknown" 57 | msgstr "nepoznat" 58 | 59 | #. Translator credits (translators who want to be credited for their 60 | #. contributions can add their names here as the translation) 61 | msgid "translator-credits" 62 | msgstr "" 63 | "Launchpad Contributions:\n" 64 | " Filip Janko https://launchpad.net/~filipjanko2\n" 65 | " Marjan Vrban https://launchpad.net/~mvrban\n" 66 | " Miroslav Matejaš https://launchpad.net/~silverspace+amd64\n" 67 | " gogo https://launchpad.net/~trebelnik-stefina\n" 68 | " hbogner https://launchpad.net/~hbogner\n" 69 | " nixa https://launchpad.net/~nikola-kapraljevic" 70 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | 2 | # either 'latest', 'tested', 'release', or a number like 18427 3 | # Default: 'latest' 4 | # 5 | # Or use command line option: -Pplugin.josmCompileVersion=... 6 | #plugin.josmCompileVersion=18427 7 | 8 | # properties for gradle-josm-plugin 9 | plugin.class=org.openstreetmap.josm.plugins.scripting.ScriptingPlugin 10 | plugin.description=Runs scripts in JOSM 11 | plugin.icon=images/script-engine.png 12 | plugin.link=https://gubaer.github.io/josm-scripting-plugin 13 | plugin.canloadatruntime=true 14 | 15 | # the GitHub user name 16 | josm.github.user=gubaer 17 | # the GitHub repository 18 | josm.github.repository=josm-scripting-plugin 19 | 20 | #------------------------------ 21 | # properties for the GraalVM 22 | #------------------------------ 23 | # either 'linux-amd64' or 'windows-amd64' 24 | graalvm.platform=linux-amd64 25 | # either 'jdk17' or 'jdk21' 26 | graalvm.jdk=jdk17 27 | # for Java 17 we download GraalVM Community Editions from Github because since 2024 downloading from the Oracle 28 | # website requires authentication 29 | graalvm.download.jdk17.linux-amd64=https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-17.0.9/graalvm-community-jdk-17.0.9_linux-x64_bin.tar.gz 30 | graalvm.download.jdk17.windows-amd64=https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-17.0.9/graalvm-community-jdk-17.0.9_windows-x64_bin.zip 31 | # for Java 21 we download the latest GraalVM release from the Oracle website 32 | graalvm.download.jdk21.linux-amd64=https://download.oracle.com/graalvm/21/latest/graalvm-jdk-21_linux-x64_bin.tar.gz 33 | graalvm.download.jdk21.windows-amd64=https://download.oracle.com/graalvm/21/latest/graalvm-jdk-21_windows-x64_bin.zip 34 | 35 | #------------------------------- 36 | # dependency versions 37 | #------------------------------- 38 | dep.groovy=4.0.27 39 | dep.mustache=0.9.14 40 | dep.rsyntaxtextarea=3.6.0 41 | dep.commons-compress=1.27.1 42 | dep.jupiter=5.13.1 43 | dep.graalvm-sdk=23.0.1 -------------------------------------------------------------------------------- /src/test/unit/groovy/org/openstreetmap/josm/plugins/scripting/graalvm/ModuleIDTest.groovy: -------------------------------------------------------------------------------- 1 | package org.openstreetmap.josm.plugins.scripting.graalvm 2 | 3 | import org.junit.jupiter.api.Test 4 | import org.openstreetmap.josm.plugins.scripting.model.RelativePath 5 | 6 | import static org.junit.Assert.* 7 | 8 | class ModuleIDTest { 9 | 10 | @Test 11 | void "isAbsolute or isRelative - for absolute module ID"() { 12 | def id = new ModuleID(RelativePath.parse("foo/bar")) 13 | assertTrue(id.isAbsolute()) 14 | assertFalse(id.isRelative()) 15 | } 16 | 17 | @Test 18 | void "isAbsolute - return false, for relative ID starting with _dot__slash_"() { 19 | def id = new ModuleID(RelativePath.parse("./foo/bar")) 20 | assertFalse(id.isAbsolute()) 21 | assertTrue(id.isRelative()) 22 | } 23 | 24 | @Test 25 | void "isAbsolute - return false, for relative ID starting with _dot__dot__slash_"() { 26 | def id = new ModuleID(RelativePath.parse("../foo/bar")) 27 | assertFalse(id.isAbsolute()) 28 | assertTrue(id.isRelative()) 29 | } 30 | 31 | @Test 32 | void "normalized - already normalized"() { 33 | def id = new ModuleID(RelativePath.parse("foo/bar")) 34 | def normalized = id.normalized() 35 | assertEquals(id.toString(), normalized.toString()) 36 | assertEquals(id, normalized) 37 | } 38 | 39 | @Test 40 | void "normalized - remove trailing 'js'"() { 41 | def id = new ModuleID(RelativePath.parse("foo/bar.js")) 42 | def normalized = id.normalized() 43 | assertEquals("foo/bar", normalized.toString()) 44 | } 45 | 46 | @Test 47 | void "normalized - collapse sequences of _slash_"() { 48 | def id = new ModuleID(RelativePath.parse("foo////bar///baz//a.js")) 49 | def normalized = id.normalized() 50 | assertEquals("foo/bar/baz/a", normalized.toString()) 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /testing/windows/README.md: -------------------------------------------------------------------------------- 1 | This directory provides an environment to interactively test JOSM and the scripting plugin with different JOSM, JDK, GraalVM, and GraalJS versions. 2 | 3 | Use [`manage.ps1](manage.ps1) to prepare and manage the test environment, in particular to 4 | 5 | * download and install JOSM versions 6 | * download and install JDKs (jdk11 and jdk17) 7 | * download and install GraalVMs for jdk11 or jdk17 8 | * download and install GraalJS versions 9 | * manage a JOSM_HOME for the testing environment (create and init, delete) 10 | * deploy the current scripting plugin (the locally built `scripting.jar`) to the testing environment 11 | 12 | Run `manage.ps1 -help` for additional information. 13 | 14 | Use [`josm.ps`](josm.ps1) to launch JOSM and the scripting plugin either with a stock JDK (with or without GraalJS) or with a GraalVM version. 15 | 16 | Run `josm.ps1 -help` for additional information. 17 | 18 | If you get an error *execution of scripts is disabled on this system* run the following command in the PowerShell console: 19 | ```powershell 20 | # enable execution of the scripts on the local machine 21 | Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine 22 | ``` 23 | 24 | # Supported configurations 25 | 26 | * Stock JDK17 or JDK21 with GraalJS <= 23.0.0 27 | * for GraalJS <= 23.0.0 `java` has to be launched with the following modules 28 | ``` 29 | java ` 30 | --add-modules "org.graalvm.sdk,org.graalvm.js,com.oracle.truffle.regex,org.graalvm.truffle" 31 | ``` 32 | 33 | * GraalVM for JDK17 34 | * ships with the updater tool `bin/gu.bat` 35 | * use `gu.bat` to install the GraalVM `js` language 36 | 37 | * GraalVM for JDK21 38 | * doesn't include the updater tool `bin/gu.bat` anymore 39 | * combine it with a GraalJS release >= 23.1.1 with the following modules 40 | ``` 41 | java ` 42 | --add-modules "org.graalvm.polyglot,org.graalvm.word,org.graalvm.collections" 43 | ``` -------------------------------------------------------------------------------- /src/main/javascript/v3/clipboard.mjs: -------------------------------------------------------------------------------- 1 | /** 2 | * Provides access to the system clipboard 3 | * 4 | * @module clipboard 5 | * 6 | * @example 7 | * import clipboard from 'clipboard' 8 | * 9 | */ 10 | 11 | /* global Java */ 12 | const clipboard = {} 13 | export default clipboard 14 | 15 | /** 16 | * Set or get the clipboard content as text 17 | * 18 | *
19 | *
get
20 | *
Replies the clipboard content as text or undefined, 21 | * if no clipboard content is available or if it can't be converted to a 22 | * string.
23 | * 24 | *
set
25 | *
Sets the clipboard content
26 | *
27 | * 28 | * @example 29 | * import clipboard from 'clipboard' 30 | * // set the clipboard content 31 | * clipboard.text = 'Hello World!' 32 | * 33 | * @property {string} text clipboard content as text 34 | * @name text 35 | * @summary Set or get the clipboard content as text 36 | * @static 37 | */ 38 | Object.defineProperty(clipboard, 'text', { 39 | enumerable: true, 40 | get: function () { 41 | const Toolkit = Java.type('java.awt.Toolkit') 42 | const DataFlavor = Java.type('java.awt.datatransfer.DataFlavor') 43 | const transferable = Toolkit.getDefaultToolkit() 44 | .getSystemClipboard().getContents(null) 45 | try { 46 | if (transferable && transferable.isDataFlavorSupported(DataFlavor.stringFlavor)) { 47 | return transferable.getTransferData(DataFlavor.stringFlavor) 48 | } 49 | } catch (e) { 50 | } 51 | return undefined 52 | }, 53 | 54 | set: function (value) { 55 | const StringSelection = Java.type('java.awt.datatransfer.StringSelection') 56 | const Toolkit = Java.type('java.awt.Toolkit') 57 | Toolkit.getDefaultToolkit().getSystemClipboard().setContents( 58 | new StringSelection(String(value || '')), 59 | null 60 | ) 61 | } 62 | }) 63 | -------------------------------------------------------------------------------- /src/main/java/org/openstreetmap/josm/plugins/scripting/graalvm/TypeResolveFunction.java: -------------------------------------------------------------------------------- 1 | package org.openstreetmap.josm.plugins.scripting.graalvm; 2 | 3 | import org.graalvm.polyglot.Value; 4 | import org.openstreetmap.josm.plugins.scripting.ScriptingPlugin; 5 | 6 | import java.util.function.Function; 7 | import java.util.logging.Level; 8 | import java.util.logging.Logger; 9 | 10 | import static java.text.MessageFormat.format; 11 | 12 | /** 13 | * Supports access from JavaScript to Java classes in the plugin. The standard 14 | * Java.type(...) function in GraalJS can't access them because 15 | * of class loading issues (probably because JOSM loads the scripting.jar 16 | * dynamically). 17 | */ 18 | @SuppressWarnings("unused") 19 | public class TypeResolveFunction implements Function { 20 | static private final Logger logger = Logger.getLogger(TypeResolveFunction.class.getName()); 21 | 22 | @Override 23 | public Value apply(String className) { 24 | final String basePackageName = ScriptingPlugin.class.getPackageName(); 25 | if (className == null || !className.startsWith(basePackageName)) { 26 | if (logger.isLoggable(Level.FINE)) { 27 | logger.log(Level.FINE, format( 28 | "Couldn''t lookup a java class in the plugin jar. Class name is null or doesn''t belong " + 29 | "to the plugin package. className=''{0}''", className 30 | )); 31 | } 32 | return null; 33 | } 34 | try { 35 | final Class clazz = Class.forName(className); 36 | return Value.asValue(clazz); 37 | } catch (ClassNotFoundException e) { 38 | if (logger.isLoggable(Level.FINE)) { 39 | logger.log(Level.FINE, format( 40 | "Couldn''t lookup a java class in the plugin jar. className=''{0}''", className 41 | ), e); 42 | } 43 | return null; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/resources/contrib/LICENSE.graaljs: -------------------------------------------------------------------------------- 1 | Copyright (c) 2019, Oracle and/or its affiliates. 2 | 3 | The Universal Permissive License (UPL), Version 1.0 4 | 5 | Subject to the condition set forth below, permission is hereby 6 | granted to any person obtaining a copy of this software, associated 7 | documentation and/or data (collectively the "Software"), free of charge and 8 | under any and all copyright rights in the Software, and any and all patent 9 | rights owned or freely licensable by each licensor hereunder covering either 10 | (i) the unmodified Software as contributed to or provided by such licensor, or 11 | (ii) the Larger Works (as defined below), to deal in both 12 | 13 | 14 | 15 | (a) the Software, and 16 | 17 | (b) any piece of software and/or hardware listed in the lrgrwrks.txt 18 | file if one is included with the Software (each a “Larger Work” to which 19 | the Software is contributed by such licensors), 20 | 21 | without restriction, including without limitation the rights to 22 | copy, create derivative works of, display, perform, and distribute the Software 23 | and make, use, sell, offer for sale, import, export, have made, and have sold 24 | the Software and the Larger Work(s), and to sublicense the foregoing rights on 25 | either these or other terms. 26 | 27 | This license is subject to the following condition: 28 | 29 | The above copyright notice and either this complete permission 30 | notice or at a minimum a reference to the UPL must be included in all copies or 31 | substantial portions of the Software. 32 | 33 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 34 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 35 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO 36 | EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES 37 | OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 38 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 39 | DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /jsdoc.v3.conf: -------------------------------------------------------------------------------- 1 | { 2 | "tags": { 3 | "allowUnknownTags": true 4 | }, 5 | "source": { 6 | "include": [ 7 | "src/main/javascript/v3/josm.mjs", 8 | "src/main/javascript/v3/clipboard.mjs", 9 | "src/main/javascript/v3/josm/api.mjs", 10 | "src/main/javascript/v3/josm/command.mjs", 11 | "src/main/javascript/v3/josm/builder.mjs", 12 | "src/main/javascript/v3/josm/builder/node-builder.mjs", 13 | "src/main/javascript/v3/josm/builder/way-builder.mjs", 14 | "src/main/javascript/v3/josm/builder/relation-builder.mjs", 15 | "src/main/javascript/v3/josm/ds.mjs", 16 | "src/main/javascript/v3/josm/layers.mjs", 17 | "src/main/javascript/v3/josm/scriptingconsole.mjs", 18 | "src/main/javascript/v3/josm/util.mjs", 19 | "src/main/javascript/v3/josm/unittest.mjs", 20 | "src/main/javascript/v3/josm/ui/menu.mjs" 21 | ], 22 | "includePattern": ".+\\.mjs(doc)?$", 23 | "excludePattern": "(^|\\/)_" 24 | }, 25 | "plugins": [ 26 | "docstrap/template/ForClassTagPlugin" 27 | ], 28 | "templates": { 29 | "logoFile": "", 30 | "cleverLinks": false, 31 | "monospaceLinks": false, 32 | "dateFormat": "ddd MMM Do YYYY", 33 | "outputSourceFiles": true, 34 | "outputSourcePath": true, 35 | "systemName": "JOSM Scripting Plugin - JavaScript API V3", 36 | "footer": "", 37 | "copyright": "© Contributors to the JOSM Scripting Plugin", 38 | "navType": "vertical", 39 | "theme": "cosmo", 40 | "linenums": true, 41 | "collapseSymbols": false, 42 | "inverseNav": true, 43 | "protocol": "html://", 44 | "methodHeadingReturns": false 45 | }, 46 | "markdown": { 47 | "parser": "gfm", 48 | "hardwrap": true 49 | }, 50 | "opts": { 51 | "apiVersion": "v3" 52 | }, 53 | "sourceType": "module" 54 | } -------------------------------------------------------------------------------- /src/test/functional/javascript/v3/open-files-test.js: -------------------------------------------------------------------------------- 1 | /* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^_" }] */ 2 | 3 | /* global Java */ 4 | 5 | const System = Java.type('java.lang.System') 6 | const Exception = Java.type('java.lang.Exception') 7 | 8 | import josm from 'josm' 9 | import * as util from 'josm/util' 10 | import { suite, test, expectError } from 'josm/unittest' 11 | 12 | function log (msg) { 13 | System.out.println(msg) 14 | } 15 | 16 | function josmScriptingPluginHome () { 17 | const homeDir = System.getenv('JOSM_SCRIPTING_PLUGIN_HOME') 18 | if (homeDir === null) { 19 | throw new Error('environment variable JOSM_SCRIPTING_PLUGIN_HOME not set') 20 | } 21 | return homeDir 22 | } 23 | 24 | const suites = [] 25 | const resourcesDir = `${josmScriptingPluginHome()}/src/test/resources/sample-data-files` 26 | 27 | suites.push(suite('open files', 28 | test('open a data and a gpx file in two layers', () => { 29 | const File = Java.type('java.io.File') 30 | const osmFile = `${resourcesDir}/test-josm-open.osm` 31 | const gpxFile = `${resourcesDir}/test-josm-open.gpx` 32 | 33 | function clearLayers () { 34 | for (let i = 0; i < 2; i++) { 35 | josm.layers.remove(i) 36 | } 37 | } 38 | 39 | clearLayers() 40 | 41 | // open two files in two layers 42 | josm.open( 43 | osmFile, 44 | new File(gpxFile) 45 | ) 46 | 47 | // open is asynchronous, wait 2s, then check whether the layers 48 | // are available 49 | const Thread = Java.type('java.lang.Thread') 50 | Thread.sleep(2000) 51 | 52 | util.assert(josm.layers.length === 2, 'expected two layers, got {0}', josm.layers.length) 53 | clearLayers() 54 | }) 55 | )) 56 | 57 | export function run () { 58 | const numFails = suites 59 | .map((suite) => suite.run()) 60 | .reduce((acc, i) => acc + i) 61 | 62 | if (numFails > 0) { 63 | throw new Exception(`There are ${numFails} failing tests`) 64 | } else { 65 | System.out.println('All tests ran successfully! ') 66 | } 67 | } 68 | --------------------------------------------------------------------------------