Author Topic: swt dialog box example in jarchi  (Read 425 times)

rchevallier

  • Active Member
  • ***
  • Posts: 70
swt dialog box example in jarchi
« on: April 07, 2020, 17:00:55 PM »
Hi all,

Based on the work of Hervé, but using SWT/Jface instead of Swing to have the same look and feel as Archi, I've developed a configuration dialog box script which can serve as example if you need something similar. Caveat: you need to understand swt widgets and layout.

You can find the code here: https://gist.github.com/rchevallier/d155527dcc3e956848a90e51bf21d7e1

NB: Using VsCode for coding in Javascript, I added some type annotation for type checking functionality of this IDE


Jean-Baptiste Sarrodie

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 695
  • Archi Evangelist and Contributor. Visionary.
    • About me...
Re: swt dialog box example in jarchi
« Reply #1 on: April 07, 2020, 19:06:45 PM »
Hi,

Great! Thank you!

I was missing such example.

Regards,

JB
If you value and use Archi please consider making a donation! https://www.archimatetool.com/donate

Phil Beauvoir

  • Administrator
  • Hero Member
  • *****
  • Posts: 1558
  • Code Punk
    • Archi
Re: swt dialog box example in jarchi
« Reply #2 on: April 07, 2020, 19:58:55 PM »
Yes, thank-you very much for sharing. That's what this forum is all about, users helping each other and sharing. Nice. :-)

Phil
If you value and use Archi please consider making a donation! https://www.archimatetool.com/donate

rchevallier

  • Active Member
  • ***
  • Posts: 70
Re: swt dialog box example in jarchi
« Reply #3 on: April 10, 2020, 14:48:04 PM »
And if anyone has remarks for improvement, please don't hesitate (my 1st code in js, I'm more of a java, scala, python guy) :)

Manj75

  • Senior Member
  • ****
  • Posts: 152
Re: swt dialog box example in jarchi
« Reply #4 on: June 14, 2021, 09:09:17 AM »
I came across this post and the script looked interesting, but on trying it out I get an exception. Is this meant to work straight out of the zip file or am I missing a step?

Code: [Select]
Script Error: javax.script.ScriptException: SyntaxError: file:/C:/Users/Manjit/AppData/Roaming/Archi4/scripts/JFaceConfigDialog.ajs:22:23 Expected an operand but found const
/** @type JavaClass */ const SWT = Java.type('org.eclipse.swt.SWT')
                       ^ in <eval> at line number 1

Appreciate any help to get this working as it would be great to use for same look and feel of Archi.

Phil Beauvoir

  • Administrator
  • Hero Member
  • *****
  • Posts: 1558
  • Code Punk
    • Archi
Re: swt dialog box example in jarchi
« Reply #5 on: June 14, 2021, 09:35:28 AM »
Some of the code in the script is not supported by JS ES5.

In Archi Preferences, Scripting, choose "Nashorn ES6" or "GraalVM".
If you value and use Archi please consider making a donation! https://www.archimatetool.com/donate

Manj75

  • Senior Member
  • ****
  • Posts: 152
Re: swt dialog box example in jarchi
« Reply #6 on: June 14, 2021, 09:44:36 AM »
Thanks Phil - Nashorn ES6 sorted it

rchevallier

  • Active Member
  • ***
  • Posts: 70
Re: swt dialog box example in jarchi
« Reply #7 on: June 14, 2021, 10:55:37 AM »
Thanks Phil
It was not clear indeed it requires ES6 or above
Added a comment in the gist