Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: ahafez on May 19, 2020, 09:36:13 pm

Title: Automate Opening the Version Control Settings Window
Post by: ahafez on May 19, 2020, 09:36:13 pm
Hello All,

I want to open the "Version Control Settings" window from a C# add-in, is there an API to do that?

Thanks,
Ahmed Hafez
Title: Re: Automate Opening the Version Control Settings Window
Post by: Geert Bellekens on May 19, 2020, 09:37:55 pm
No, I don't think so.

Geert
Title: Re: Automate Opening the Version Control Settings Window
Post by: ahafez on May 19, 2020, 10:07:01 pm
Hello Geert,

Many thanks for your fast reply.

Do you think is there a workaround to do so?

Thanks,
Ahmed Hafez
Title: Re: Automate Opening the Version Control Settings Window
Post by: Geert Bellekens on May 19, 2020, 10:39:33 pm
Hello Geert,

Many thanks for your fast reply.

Do you think is there a workaround to do so?

Thanks,
Ahmed Hafez
Depends, what do you want to achieve?
Do you really want to open the version control settings dialog, or do you want to allow the user to set the version control settings.

In the latter case you could make your own dialog, get the input from the user and then set the version control settings from your add-in.
Some of these are stored in the database, some in the paths.txt in the user profile (%appdata%)

Geert
Title: Re: Automate Opening the Version Control Settings Window
Post by: ahafez on May 20, 2020, 12:34:39 am
Hello Geert,

I am looking to open the version control settings dialog, to ask the user to complete the missing configuration, which I found in the paths.txt file.

Thanks,
Ahmed Hafez
Title: Re: Automate Opening the Version Control Settings Window
Post by: Geert Bellekens on May 20, 2020, 02:17:43 am
Hello Geert,

I am looking to open the version control settings dialog, to ask the user to complete the missing configuration, which I found in the paths.txt file.

Thanks,
Ahmed Hafez
Isn't that standard behavior? If you open EA with missing configurations EA will show a popup that asks you to fill in the missing config.
If you click Yes, EA opens the dialog.
I don't understand why you would want to replicate that.

Geert
Title: Re: Automate Opening the Version Control Settings Window
Post by: ahafez on May 20, 2020, 02:37:05 am
Hello Geert,

The goal of my add-in is to collect the errors and advice the user hot to fix it.

By the way I could also will need to open other EA dialog for fixing the other issues. That is way I need to know a way to open specific EA dialog.

Thanks,
Ahmed Nabil
Title: Re: Automate Opening the Version Control Settings Window
Post by: Geert Bellekens on May 20, 2020, 03:58:29 am
Hello Geert,

The goal of my add-in is to collect the errors and advice the user hot to fix it.

By the way I could also will need to open other EA dialog for fixing the other issues. That is way I need to know a way to open specific EA dialog.

Thanks,
Ahmed Nabil
I'm afraid most of the dialogs are not accessible from the API.
You might be able to do some stuff by simulating keypresses, but that is notoriously unreliable.

Geert
Title: Re: Automate Opening the Version Control Settings Window
Post by: ahafez on May 20, 2020, 05:01:05 am
Hello Geert,

I agree with you the only way that I found is the Simulating Keyboard Input using SendKeys.SendWait but that will not be a stable solution.

Thanks,
Ahmed Hafez
Title: Re: Automate Opening the Version Control Settings Window
Post by: qwerty on May 20, 2020, 05:22:24 am
There also the hidden Respository.CustomCommand which might (!) do it. It could take a "SEC" parameter, but it's just poking in the mist. If that would work: please let us know ;-)

q.
Title: Re: Automate Opening the Version Control Settings Window
Post by: ahafez on May 20, 2020, 08:28:08 pm
Hello qwerty,

Many thank for your help, but is there a way two find this secret parameter?  ;)

Title: Re: Automate Opening the Version Control Settings Window
Post by: Uffe on May 20, 2020, 08:37:33 pm
I tried adding parameters from the corresponding EA Command hyperlink to CustomCommand(). No good.

Probably not doing it right, but then again, it's undocumented so what's right? Anyway, I only spent five minutes on it. Could still be a way.
Title: Re: Automate Opening the Version Control Settings Window
Post by: Geert Bellekens on May 20, 2020, 08:45:13 pm
Hello qwerty,

Many thank for your help, but is there a way two find this secret parameter?  ;)
They only way really (except for guessing) is to get them from a Sparx Systems employee.
We know a couple of uses because someone from Sparx shared them with us.
Opening the version control settings dialog is not one of those known uses.

Geert
Title: Re: Automate Opening the Version Control Settings Window
Post by: qwerty on May 20, 2020, 09:59:37 pm
You call that like
Code: [Select]
xmlres = Respository.CustomCommand(
  "CFormCommandHelper", "ProcessCommand",
  "Dlg=" + dlg + ";id=" + id + ";hwnd=" + hwnd);
where dlg could eventually be "SEC" (who knows except Sparx?). The ones we know so far are PKG, ELM, ATT, OP, and DGM. Maybe that's just it. Anyhow, why Sparx keeps that a secret function is one of the big questions of the universe. Doesn't do harm and could well be documented. Alas, that's how it is. There are more uses for this operation, but targeting something completely different.

q.
Title: Re: Automate Opening the Version Control Settings Window
Post by: Geert Bellekens on May 20, 2020, 10:57:25 pm
There's also

Code: [Select]
Repository.CustomCommand "Repository", "SynchProfile", "Profile=" & profile & ";Stereotype=" & stereotype & ";"
to synchronize a stereotype

Geert
Title: Re: Automate Opening the Version Control Settings Window
Post by: qwerty on May 20, 2020, 11:08:55 pm
Well then to complete it:

Code: [Select]
xmlres = Respository.CustomCommand("Repository", "ImportRefData", sXML);where sXML contains the reference data.

q.
Title: Re: Automate Opening the Version Control Settings Window
Post by: ahafez on May 20, 2020, 11:27:47 pm
Hello All,

Many thanks all, you are really very supportive guys.

Thanks,
Ahmed Hafez