Some gists and more to come

Started by merty, February 27, 2023, 20:00:18 PM

Previous topic - Next topic

merty

Hi there,

Here at the "Nederlandse Spoorwegen" (translated to "Dutch Railways"), we are trying to standardize working with Archimate and using the Archi tool for that. Doing so, we are experimenting with coArchi and jarchi and want to start sharing some scripts I made to make life a little bit easier switching to Archi  ;)

I will share the more bigger scripts once I cleaned them up and put them in github repo. I made several scripts for working with Heatmaps and labels/tags and importing/exporting properties of the elements inside those Heatmaps...

I also managed to retrieve elements from ARIS Architect repository (there is one department that use ARIS for Archimate modelling as well) via their API and update them into Archi, but its very specific for the way NS uses ARIS en kind of enviroment, but if someone wants to create there own integration with ARIS Architect and needs some direction, give me a message and I will send it to you

To start, here are some "gists" :

All scripts works with latest jarchi 1.3.1 and Graalvm, didn't test it (yet) with other versions or nashorn...

Isolate Single View to Separate Model
Since we will be working with a repository per department, we will have a lot of elements and view in the model. But sometimes you want to share (or export) just a single view and all elements that are referenced by it. This simple script will make a copy of your model and just throws everything away that isn't related to the selected view (not the fasted way, but sure is the easiest way....)
link:
https://gist.github.com/RemcoSchellekensNS/a528ba45bf1541920075c1504af975f4

Working with Clipboard
Found this example somewhere, good to share it. (Only works for strings, other stuff is possible but much harder to code. Windows clipboard is the most weirdest thing to work with...)
link: https://gist.github.com/RemcoSchellekensNS/c840313d9166ee2dde5be8b878c1668a

jface Message Dialogs
Some testing to use Java jface for more Message Dialogs options (I wanted one with more buttons, for instance). Check out https://gist.github.com/RemcoSchellekensNS/3002d094a01c2136855ff9e1082c58d7

Standard Error Message, with "ok" button and error icon:


Standard Confirm Message, with "ok" and "cancel" button, will return true of false:


Standard Information Message, with "ok" button and information icon:


Standard Question Message, with "yes" "no" buttons, returning "true"/"false":


Standard warning Message, with "ok" button and warning icon:


more sophisticated one, you can provide your own buttons, and set the type of standard icon MessageDialog.NONE or .INFORMATION .QUESTION .WARNING .ERROR .CONFIRM returns index within array of button that has been clicked on:


Have fun,

Remco

Phil Beauvoir

Hi Remco,

welcome to the forums and thanks for sharing these jArchi gists. I hope other jArchi scripters will find them useful!

Regards,

Phil
If you value and use Archi, please consider making a donation!
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.

jsimoncello

Many thanks, your last dialog with 3 buttons gave me an idea, should I need many many buttons :




   
    let Dialog = Java.type('org.eclipse.ui.dialogs.ElementListSelectionDialog');
    let LabelProvider = Java.type('org.eclipse.jface.viewers.LabelProvider');
    let targetTypes = ['application-collaboration', 'application-component', 'application-event', 'application-function', 'application-interaction', 'application-interface', 'application-process', 'application-service', 'artifact', 'business-actor', 'business-collaboration', 'business-event', 'business-function', 'business-interaction', 'business-interface', 'business-object', 'business-process', 'business-role', 'business-service', 'capability', 'communication-network', 'contract', 'course-of-action', 'data-object', 'device', 'distribution-network', 'equipment', 'facility', 'material', 'node', 'path', 'product', 'representation', 'resource', 'system-software', 'technology-collaboration', 'technology-event', 'technology-function', 'technology-interaction', 'technology-interface', 'technology-process', 'technology-service', 'value-stream'];

    let owndialog = new Dialog(shell, new LabelProvider());
    owndialog.setTitle("Choose target type");
    owndialog.setMultipleSelection(false);
    owndialog.setElements(targetTypes);
    let result = owndialog.open()
    if (!result) {
        console.log(owndialog.getResult());
    }

rchevallier