Skip to content

Instantly share code, notes, and snippets.

View romualdrichard's full-sized avatar

Romuald Richard romualdrichard

View GitHub Profile
@romualdrichard
romualdrichard / ModifyPropertyValue.ajs
Created January 30, 2026 08:46
#jarchi modifiy property value
/*
* JArchi Script - Modify User Property Value
*
* This script allows you to search and replace a property value
* on all model objects that have this property.
*
* Uses SWT dialog boxes for user interaction.
*/
// Import necessary SWT classes
/*
* Distribute relationships between multiple selected elements
* Enhanced version - supports multiple elements selection
* Based on: https://forum.archimatetool.com/index.php?topic=1174.0
*/
console.log("Distribute relations - Multi-element version");
var view = selection.parents().filter('archimate-diagram-model').first();
var elements = selection.filter('element');
@romualdrichard
romualdrichard / search_and_create_view.ajs
Created January 29, 2026 13:59
#jarchi create a view from a criteria
/*
* JArchi Script - Search and Create View
* Search for model elements by text and create a view with the results
*/
// Import necessary SWT classes
var SWT = Java.type('org.eclipse.swt.SWT');
var Shell = Java.type('org.eclipse.swt.widgets.Shell');
var Display = Java.type('org.eclipse.swt.widgets.Display');
var Dialog = Java.type('org.eclipse.swt.widgets.Dialog');
@romualdrichard
romualdrichard / duplicate_relation.ajs
Created January 29, 2026 13:08
#jarchi duplicate relationship
/**
* JArchi Script: Duplicate Relationships
*
* This script duplicates selected relationships by creating:
* - A new relationship with the same type, source, target and properties
* - Visual connections in all views where the original relationship appears (optional)
*
* Usage: Select one or more relationships and run the script
*/
@romualdrichard
romualdrichard / Generate-Single-Page-HTML-Export-Interactive.ajs
Created January 23, 2026 09:45
#jarchi Export Single page html interactive
// Generate Single-page HTML Export - Enhanced with Interactive Views
//
// Based on: https://github.com/archi-contribs/jarchi-single-page-html-export
// Enhanced by: Claude (2026) - Added interactive SVG overlays
// STABLE VERSION - Based on v1.9 + v2.0 uncheck fix
//
// Requires jArchi - https://www.archimatetool.com/blog/2018/07/02/jarchi/
// Add this script to the repertory of jarchi-single-page-html-export
// === CONFIGURATION ===
@romualdrichard
romualdrichard / Create View From Properties.ajs
Last active January 8, 2026 13:39
#jarchi Create View from Properties
/*
* jArchi Script: Create or update view based on properties (Elements and Relationships)
* Creates a new view or updates an existing view with elements and/or relationships matching property/value pairs
* Logic: OR between values of same property, AND between different properties
*/
console.clear();
console.show();
// Java imports for the GUI
@romualdrichard
romualdrichard / export_view_tree.ajs
Created January 7, 2026 14:19
#jarchi create new model from views or directory of a model
/*
* jArchi Script: Export Selected Views with Tree Hierarchy
*
* This script displays a dialog with the complete folder and view hierarchy.
* You can check entire folders or individual views.
*
* Process:
* 1. Display tree with checkboxes
* 2. Save the current model with a new name (Save As)
* 3. Delete non-selected views
@romualdrichard
romualdrichard / gist:22727a87cbec472354a691d5ed60933b
Last active April 19, 2024 08:40
#jarchi script which is copying all the aspect of an element in a view and apply them in all the views for elements representing the same concept.
// This script copy appearance of the selected object to all the views of the model for this object.
// Function to copy properties from source to target visual object
function copyVisualObjectProperties(source, target) {
target.borderType = source.borderType;
target.deriveLineColor = source.deriveLineColor;
target.figureType = source.figureType;
target.fillColor = source.fillColor;
target.fontColor = source.fontColor;
target.fontName = source.fontName;
@romualdrichard
romualdrichard / MAJ Date.ajs
Last active December 13, 2024 08:26
#jArchi Script to read .gitconfig to have username and put it in property of the current view, and also add the update date in property of the view
//Script to put date of the day in the property "Date de mise à jour"
// and also the user name of the git in property Auteur
// Lit le fichier .gitconfig de l'utilisateur pour retrouver le nom
var System = Java.type('java.lang.System');
var currentDate = currentDate || new Date();
const Files = Java.type('java.nio.file.Files');