Eclipse use of jArchi images

Started by Thomas Rohde, May 04, 2023, 11:09:24 AM

Previous topic - Next topic

Thomas Rohde

I am doing some scripting, where I take the custom image of an element and displaying it in an Eclipse widget. I realise that jArchi ".image" does not return a "org.eclipse.swt.graphics.Image". Is there any way I can convert a jArchi image to an Eclipse image?

Phil Beauvoir

Hi Thomas,

once an image is loaded in jArchi with object.image = model.createImage("cat.png") it is stored internally to the model and is referenced thereafter by its internal id so it's not possible to get the image data from jArchi to re-use it. However, if you have the original image stored somewhere you could load it with some JS:

const Image = Java.type("org.eclipse.swt.graphics.Image");
const Display = Java.type("org.eclipse.swt.widgets.Display");

var img = new Image(Display.current, "cat.png");

// Use the image

// Dispose the image when done
img.dispose();
If you value and use Archi, please consider making a donation!
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.