Skip to content

Instantly share code, notes, and snippets.

@yveszoundi
Created April 26, 2024 22:57
Show Gist options
  • Save yveszoundi/2f3dd1e97b616540d86931f55662bed3 to your computer and use it in GitHub Desktop.
Save yveszoundi/2f3dd1e97b616540d86931f55662bed3 to your computer and use it in GitHub Desktop.
#jArchi script to dump Archimate View element types
// Author: Yves Zoundi
// Dump Archimate View element types for either elements or relationships
// This can be useful for custom coloring, custom import/export etc.
console.show()
console.clear()
console.log("START: DumpArchimateViewElementTypes")
let selection = window.promptSelection("Choose types to dump", ["Element Types", "Relationship Types"] )
if (selection) {
let providerClassName = "com.archimatetool.editor.ui.factory.elements.AbstractArchimateElementUIProvider"
if (selection != "Element Types")
providerClassName = "com.archimatetool.editor.ui.factory.relationships.AbstractArchimateRelationshipUIProvider"
let JObjectUIFactory = Java.type("com.archimatetool.editor.ui.factory.ObjectUIFactory")
let JUIProviderClass = Java.type(providerClassName)
let providers = JObjectUIFactory.INSTANCE.getProviders()
let items = []
for (let provider of providers) {
if (JUIProviderClass.class.isAssignableFrom(provider.getClass()))
items.push(provider.getDefaultName().toLowerCase().replaceAll(" ", "-"))
}
items.sort()
for (let item of items)
console.log(item)
}
console.log("END: DumpArchimateViewElementTypes")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment