Skip to content

Instantly share code, notes, and snippets.

@projetnumero9
projetnumero9 / Attribute - replace string.ajs
Last active February 18, 2024 16:35
Search and replace a string for one or many concepts attribute (litteral string or REGEX) #jarchi
//
// Attribute - replace string
//
// (c) 2019 David GERARD
//
// Search and replace a string for one or many concepts attributes (name, documentation)
//
// Roadmap:
// - when using Regex, implement global replacement if multiple occurences
// - when the replacementString is a Regex, some corrections and improvment still needed
@fanievh
fanievh / Export Selected Folder to New Model.ajs
Last active April 25, 2024 14:13
Export Selected Folder in Source Model to New Target Model #jArchi
/*
* Export Selected Folder in Source Model to New Target Model
*
* https://gist.github.com/fanievh/4ec7d14247616846f3d16b5e22dc80a9
*
* This script copies a selected subset of a source model to a target model. The folder selected
* in the source model, will become the top level folder in the Views folder in the target model. Only
* elements, relationships, diagram objects, connections and images on any of the views in the selected
* folder in the source model, will be created in the target model.
*
@tobinsc
tobinsc / Create Visual Group with Selection.ajs
Created April 14, 2023 13:53
jArchi script to create a visual group with selection #jArchi
//
// Author: Ed Tobin
// Purpose: Create Visual Group with Selection
// Requires: jArchi - https://www.archimatetool.com/blog/2018/07/02/jarchi/
// Date: 14 April 2023
//
// WARNING: drops visual relationships between selected objects
// configure defaults:
// the size of padding around the selected elements
@ThomasRohde
ThomasRohde / modeltrap.ajs
Created April 9, 2023 05:59
Helpful little library function to avoid exceptions in your script because there is no current model. #JArchi #Archi
/*
Author: Thomas Klok Rohde
Description: Catch situations where no model is selected, and prompt user to select a model (if more than 1 model is loaded)
History:
April 9, 2023 : Created
*/
window.promptSelection = function (title, choices) {
let ElementListSelectionDialog = Java.extend(Java.type('org.eclipse.ui.dialogs.ElementListSelectionDialog'));
let LabelProvider = Java.type('org.eclipse.jface.viewers.LabelProvider');
@ThomasRohde
ThomasRohde / Find elements.ajs
Last active April 10, 2023 14:01
This script allows you to enter a search term. The case-insensitive, sub-string, matches will be selected in the model browser. #JArchi, #Archi
/*
Author: Thomas Klok Rohde
Description: Select all elements in the model browser that includes the search term (case insensitive)
History:
March 30, 2023 : Created
*/
const eclipseShell = Java.type('org.eclipse.swt.widgets.Shell');
const TreeItem = Java.type('org.eclipse.swt.widgets.TreeItem');
const Tree = Java.type('org.eclipse.swt.widgets.Tree');
@cybye
cybye / gpt.ajs
Last active June 13, 2023 13:27
AutoDescribe a view and add to view documentation #jarchi
/*
* AutoDescribe a view and add to view documentation
*/
function CallApi(url,api_key, query) {
var imports = new JavaImporter(java.net, java.util, java.lang, java.io, java.nio.charset)
var result=""
@RemcoSchellekensNS
RemcoSchellekensNS / IsolateSingleViewToModel.ajs
Created February 27, 2023 15:43
#jarchi script to isolate single view to a new model containing only view and referenced elements in that view
/*
+++++++++++++++ +++++
+++++++++++++++++ +++++
+++++ +++++ +++++
+++++ +++++ +++++
++++++++++++++++ ++++++++++++++++++
++++++++++++++++++ +++++++++++++++++
+++++ +++++ ++++++
+++++ +++++ ++++++
+++++ ++++++++++++++++++
@RemcoSchellekensNS
RemcoSchellekensNS / clipboard_example.ajs
Created February 27, 2023 15:37
#jarchi script example using clipboard for text exchange
/*
* New Archi Script
*/
// Places string on clipboard
function SetClipboardString(string) {
var Toolkit = Java.type("java.awt.Toolkit");
var Transferable = Java.type("java.awt.datatransfer.StringSelection");
@RemcoSchellekensNS
RemcoSchellekensNS / MessageDialogs_JFace.ajs
Created February 27, 2023 15:35
This #jarchi script shows alternative MessageDialog windows with more options using Java "jface" dialogs
/*
* Example message dialogs via jface
*
*/
var MessageDialog= Java.type('org.eclipse.jface.dialogs.MessageDialog');
// Standard Error Message, with "ok" button and error icon
MessageDialog.openError(shell,"Error","your errortext");
@pmduque
pmduque / Export view to drawio.ajs
Last active April 28, 2024 08:40
Export an Archimate view to be imported into draw.io #jarchi #drawio
/*
* Author: Pedro Duque
* Version: 0.2
* Date: 2022-12-19
*
* PURPOSE:
* This script exports an Archimate view to imported into draw.io (aka diagrams.net).
*
* USAGE:
* - Select a view in Archi