Book a Demo

Author Topic: How to use the addin window  (Read 11170 times)

Helmut Ortmann

  • EA User
  • **
  • Posts: 970
  • Karma: +42/-1
    • View Profile
How to use the addin window
« on: September 06, 2013, 04:22:33 am »
Hello,

has someone a little sample of how to use the addin window. For example to enter a text field or a button.

Thanks,

Helmut
Coaching, Training, Workshop (Addins: hoTools, Search&Replace, LineStyle)

stao

  • EA User
  • **
  • Posts: 137
  • Karma: +0/-0
    • View Profile
Re: How to use the addin window
« Reply #1 on: September 06, 2013, 07:12:56 am »
Hi Helmut,

you can add your own C# UserControl(s) to the addin window(s)

e.g.
Code: [Select]
if (globalFunctions == null)
                globalFunctions = Repository.AddWindow("eMoflon Global Functions", "EAEcoreAddin.ControlPanel.GlobalFunctions") as GlobalFunctions;

....

public partial class GlobalFunctions : UserControl

//here you can add TextFields, Buttons or whatever



stao

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: How to use the addin window
« Reply #2 on: September 06, 2013, 03:29:30 pm »

Helmut Ortmann

  • EA User
  • **
  • Posts: 970
  • Karma: +42/-1
    • View Profile
Re: How to use the addin window
« Reply #3 on: September 06, 2013, 08:06:08 pm »
Hi Geert,

thanks for your help.

The Navigator and the tools around are always a good source. I've found the solution to my problem in Navigator.

Thanks,

Helmut
Coaching, Training, Workshop (Addins: hoTools, Search&Replace, LineStyle)

IntrestedInEa

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: How to use the addin window
« Reply #4 on: September 11, 2013, 05:23:27 am »
Quote
Hi Geert,

thanks for your help.

The Navigator and the tools around are always a good source. I've found the solution to my problem in Navigator.

Thanks,

Helmut


Hi! I have tried the same, but could not sort it out. I'm a still a rookie when it comes to programming. I have a working add-in so far, the one with say hello & say goodbye. And now I am trying to add a window. What I have done so far is:
1. created a usercontrol (windows forms) called MainControl, it really has nothing in it, just blue backroundcolor so that I would be able to se if it appears in the add-in window.
2. key lines from my main add-in class:

Code: [Select]
private MainControl MainControl;

public String EA_Connect(EA.Repository Repository)
{
            //No special processing required.
          
            
            this.MainControl =      Repository.AddWindow("HelloAddinWindow", "PwExperimental.AddInWindow.MainControl") as MainControl;
            return "a string";
 }



But it was not this simple, do I have to add something in the MainControl class?

Thankful for any reply!

Regards Peter

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: How to use the addin window
« Reply #5 on: September 11, 2013, 05:36:31 am »
You receive an ActiveX control in this.MainControl. In order to populate it you need to call the right Windoze methods which you IDE will likely provide for you.

q.

IntrestedInEa

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: How to use the addin window
« Reply #6 on: September 11, 2013, 05:59:59 am »
Hi qwerty!

Thanks for your reply, yes, my IDE (vs2012) has done all that. Initialize method and so on... But it should be possible to just put an empty control in the addinwindow, right? I have put two buttons in the control, still no apperance, but that should not be the problem. I'm sure it is something obvious. I'm looking att Geers example again.  (https://github.com/GeertBellekens/Enterprise-Architect-Add-in-Framework)
had some problems loading the solution though, will se if can get that one to build tomorrow.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: How to use the addin window
« Reply #7 on: September 11, 2013, 03:48:12 pm »
Yes you should be able to use an empty user control.
Some ideas about what could be the problem
- Are you sure the add-in window is visible? (Check menu option Extensions|Add-In Windows)
- Is your assembly containing the user control properly registered in COM?
-Are you sure the fullname of the control is correct?
- What happens if you debug your add-in when EA starts up? Does the AddWindow operation return a valid object?

Geert

PS. What problems did you have with the solution? If you are loading it in Visual Studio its to be expected that it complains about the setup project (because that is only recognized in SharpDevelop) but that should be a real problem. Just remove the setup project from the solution and you should be good to go.
You might also need to reset the reference to Interop.EA.dll if it can't find it.

IntrestedInEa

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: How to use the addin window
« Reply #8 on: September 12, 2013, 06:48:17 am »
Hi!

My windows issue..:
-Yes, Add-in window is visible in EA
-Here my developer skills are insufficient. When you say assembly you mean the dll? And I don't know what to do for proper registration in COM (component object model?), I have done the settings you so clearly described in the hellogoodbyetutorial, register for COM interop and Com visible. Do I have to do something else? Something in the usercontrol class or some more values in regedit?
-fullname of control is correct ([solutionname].[foldername].[user control name]   I have put it in a folder).
-currently using trial so I cant debug. I'm about to get the full version so I will be able to debug soon.

About the problems with the solution:
First I downloded the zip from https://github.com/GeertBellekens/Enterprise-Architect-Add-in-Framework. After that I started vs2012 in admin mode, and browsed to the unzipped solution file (Total Solution) and opened it. Then vs alerts me about the trustworthy thing,ok, and then starts to load the solution. After loading I get the message that all projects could not be loaded correctly. outputwindow says:

K:\Utveckling\Enterprise-Architect-Add-in-Framework-master (2)\UML-Tooling-Framework\UMLToolingFramework\UMLToolingFramework.csproj : error  : The project file could not be loaded. Could not find a part of the path 'K:\Utveckling\Enterprise-Architect-Add-in-Framework-master (2)\UML-Tooling-Framework\UMLToolingFramework\UMLToolingFramework.csproj'.  K:\Utveckling\Enterprise-Architect-Add-in-Framework-master (2)\UML-Tooling-Framework\UMLToolingFramework\UMLToolingFramework.csproj

K:\Utveckling\Enterprise-Architect-Add-in-Framework-master (2)\Enterprise-Architect-Add-in-Framework-master\MyAddin_Setup\MyAddin_Setup.wixproj : error  : The imported project "C:\Tools\Wix\wix.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.  K:\Utveckling\Enterprise-Architect-Add-in-Framework-master (2)\Enterprise-Architect-Add-in-Framework-master\MyAddin_Setup\MyAddin_Setup.wixproj

something about wix? But I have wix toolset 3.7 installed. Got it from http://wix.codeplex.com/

Yes, referense to Interop.EA has to be reset in EAAssinFramework

In EAAddinTester I got the smal warning signs on not just interop, but also on EANavigator (maybe just to install that and referense the proper dll?), EAworksetSharing and UMLToolingFramework.

MyAddin just needs the interop reference to be reset.

MyAddin_Setup (load failed)
UMLToolingFramework(unavailable)

So, I should intall your EAnavigator? but what about the UMLToolingFramework?

Peter
« Last Edit: September 12, 2013, 06:57:34 am by IntrestedInEa »

IntrestedInEa

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: How to use the addin window
« Reply #9 on: September 12, 2013, 07:19:06 am »
Getting closer with the solution-problem. Found your UMLToo.... at https://github.com/GeertBellekens/UML-Tooling-Framework, got it and gave vs2012 a new location for the project, reloaded and it loaded. not tied to build it yet.

Installed the navigator and found some more dll's. one referense not solved, EAWorksetSharing in EAaddintester.


Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: How to use the addin window
« Reply #10 on: September 12, 2013, 04:01:16 pm »
Oh, yes, sorry, I should mention somewhere that you need UMLToolingFramework to be able to use EAAddinFramework. :-[

About the reference in EAAddinTester, don't worry about that, you can just remove the reference and comment out the lines
Code: [Select]
             addins.Add(new TSF.UmlToolingFramework.EANavigator.EAAddin());
              addins.Add(new EAWorksetSharing.EAWorksetSharingAddin());

Yes, when I say assembly that means dll. (or .exe). The settings "register for com interop" and "Com visible" should be enough.
What could be the problem is that you the fullname of the control is not correct. It should be [Namespace].[Name of the user control]
Als you can see in https://github.com/GeertBellekens/Enterprise-Architect-Toolpack/blob/master/EANavigator/EAAddin.cs at line 453 I add the EA Navigator addin with the code:
Code: [Select]
this.navigatorControl = this.model.addWindow("Navigate", "TSF.UmlToolingFramework.EANavigator.NavigatorControl") as NavigatorControl;Which has nothing to do with solutionname and foldername but is pure the namespace and name of the user control class.

What do you mean by "I can't debug because I'm using a trial version". Are you using a trial version of Visual Studio or EA. For EA it shouldn't matter, you can do the same thing with a trial version as with a normal version.
About Visual Studio, you can always try Sharpdevelop that is a free and open source C# IDE with full functionality.

That will help with the setup projects as well. If you keep using Visual Studio then you better delete the setup projects as they won't work in VS.

Geert

IntrestedInEa

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: How to use the addin window
« Reply #11 on: September 16, 2013, 06:38:15 am »
Hi Geert!

Sorry for late reply!

Thanks for your hints about making the project running, will try it soon. Your right about to mention somewhere that you need the UMLToolingFramework. Rookies like me, we just expect things to work when we download solutions examples  :)

Yes, as a matter of fact I emailed sparx about the debug issue. Thing is, when using the trial version and attaching process in vs, EA just closes.  And they know it, however they won't fix it until next version. But I will get the full version next week so thats not an issue any more, I hope  :P

After trying some more I finally realized that I must have missed something about when EA_connect is called, I tried to call addwindow at a different place in the code (why did I not try that earlier... :-[ )and boom, the window appeared. With the full version and debug-possibilities next week I will be able to track tings for real.

SuperThanks for taking time to answer my questions! I really appreciate it! Hope you had a great weekend!

Kind Regards
Peter
« Last Edit: September 16, 2013, 06:39:23 am by IntrestedInEa »