archimatetool/archi-scripting-plugin

[Feature request] open and/or select programmatically a view in the UI

rchevallier opened this issue · 5 comments

jArchi allows to manipulate concepts and visual object. It also add the possibility to manipulate a model in the UI (model.openInUI(), model.setAsCurrent()). But it is missing verbs to manipulate a view in the UI.

Use case example:

  • a jArchi script which for all views in a model will calculate some validation on a view. But a a view doesn't validate, the script stops and show the view in Archi UI which is in error
  • a script which gather some specific elements on conditions, and with interactive selection in a dialog box, display the appropriate view of the model to the user.

Proposition

Most important verb would be to open/show/select a view in the UI:

view.open() - open a view editor in UI (and make it current?)
or
view.setAsCurrent() - open a view editor in UI and make it current

or any other syntax

Other interesting verbs could be:

view.isOpened() - true if opened
view.isCurrent() - true if opened and current
view.close() - close the view in UI
model.listOpenedViews() - list all opened views (equivalent to $("view").filter(v => v.isOpened())

Hi, I can see that view.openInUI() (named to match model.openInUI()) might be useful, as well as view.close(), but there is no notion of a "current view" as there is a "current model".

Not sure how useful view.isOpened() is given that you if you need to know that to decide whether you should open it you could just call view.openInUI() and it will open if closed, and ignore it if already open. Same for view.close().

So, an easy win would be to consider view.openInUI() and view.close().