Skip to content

Instantly share code, notes, and snippets.

View romualdrichard's full-sized avatar

Romuald Richard romualdrichard

View GitHub Profile
@romualdrichard
romualdrichard / align-and-spread.ajs
Last active February 4, 2026 15:06
#jarchi Align and Spread with dialogbox
// Author: Jean-Charles Perron, based on the work of Rob Kamp
// Requires: jArchi - https://www.archimatetool.com/blog/2018/07/02/jarchi/
// Purpose: SWT dialog to align (left, top, bottom, right) and spread (horizontal, vertical) selected elements
// Date: 2024-01
// Version: 2.0
// Changes:
// 1.0 - Initial version (Rob Kamp / Jean-Charles Perron): spread vertical/horizontal via prompt
// 2.0 - SWT dialog with align left/top/bottom/right + spread H/V, closeable with ESC
// ─── Imports ────────────────────────────────────────────────────────────────
@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 February 5, 2026 13:34
#jarchi Create View from Properties
/*
* jArchi Script – Filtered Views Manager
* ─────────────────────────────────────────
* Tab 1 – "Filter Views" : create or update a single view by property filters
* Tab 2 – "Manage Views" : scan model, list every view that carries saved
* criteria, and batch-update them. Each row has its
* own "Synchronize" checkbox (default ON).
*
* Filter logic
* same property, several values → OR
@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');