Using elements unique id for cross reference in code and the model, via search ?

13 views
Skip to first unread message

Vasileios Pothos

unread,
Jul 27, 2023, 2:19:21 AMJul 27
to StarUML
Hi.

I was wondering if it's possible to add a feature to StartUML, thus:
1. When right clicking on an item in the Explorer, to have an option saying "Copy Id"
2. When user select "Copy Id" the unique id to be copied as is in memory (and not the whole model as the "Copy" command does). This id from what I can see is a text string like: "AAAAAAGJksVdjrohzdM=".

Then we can use that Id for instance in our docs or in comments in a code to denote we implement that model in the UML, or a specific process or whatever.

Thus when someone see that id in the comments in a part of the code, we should be able to locate it in the StarUML's mdj file. To this end, and extra functionality would be required:

3. In the search menu "Model → Find", the search module to search also the ids of the elements. Thus I can put the id string, which is in a part of the source code and search it in the mdj file, being able to access all the relative diagrams or info stored there.

Extension implementation?
Does anyone knows if this is feasible to be created as an extension, if not implemented in the core of the StarUML software? If anyone could guide me on the relative methods to use for searching and selecting elements by id in the explorer, and copying elements Id (or in general if there is a very good documented API for extensions somewhere) I could try to make an extension (summer time :P).

Thanks

StarUML

unread,
Jul 29, 2023, 4:49:44 AMJul 29
to StarUML
Hi,

The functionality you describe seems possible to implement as an extension.

You have to create a separate search dialog, but adding a new UI is possible but can be tricky. (Perhaps you should use the DOM yourself, or you should.)

Please refer to the documentation here (https://docs.staruml.io/developing-extensions/getting-started), and we recommend that you refer to other open source extensions.

Thanks,

2023년 7월 27일 목요일 오후 3시 19분 21초 UTC+9에 vasileio...@gmail.com님이 작성:

Vasileios Pothos

unread,
Jul 30, 2023, 12:53:16 PMJul 30
to StarUML
Hi. I am able to get the selected element's Id and show it in pop-up window. But I don't find any relative way to copy this string to clipboard of the system.
Any hint on how should I write a string to clipboard and then read whatever clipboard has to a string in StarUML's javascript environment?

Thanks

Vasileios Pothos

unread,
Jul 30, 2023, 2:50:46 PMJul 30
to StarUML
Ok!
I found the way to do it and just completed the extension with the functionality I need in one evening! :D

I've uploaded the extension at:
https://github.com/terablade2001/StarUML-ModelIdCopyAndSelect

Thanks!
Reply all
Reply to author
Forward
0 new messages