Recent Posts

Pages: [1] 2 3 ... 10
1
Hi,

To use a custom window you have to develop a DLL for each Custom Window according to the Microsoft COM model. Then you have to make sure that this DLL is correctly registered for COM. If this is done correctly adding it within your AddIn to EA is a simple call. I have seen this call in your code.

I usually start with a running solution and adapt it to my needs. This approach works for me.

The first time I used Geert Bellekens Add-Ins to get familiar. Over time I developed my own little Add-In which I usually use to start a new project. You can find it together with a lot of documented experiences at https://github.com/Helmut-Ortmann/EnterpriseArchitect_hoTools/wiki/AddIn. It's part of the free tool hoTools. To see adding Custom Windows, you have to look into hoTools or similar AddIns.

Of course, there are a lot of other useful AddIns to start with. Geert is always an excellent address to search for.

To summarize:
The rules for a Custom Window are the same as for the primary Addin. You have to develop a dll and register it as COM object. The difference is:
- The Custom Window contains a GUI (FORM or WPF)
- You make a Call to register the registered DLL to EA from your basic AddIn.

I admit I've invested a lot of time for my first running AddIn with a Custom Window. Most issues are around correctly registering it as a COM object. Make sure that there are no Exceptions in Constructors (not easy to find).

Kind regards,

Helmut

2
Hi Phil

A quick thought - you have said that you have registered the class, have you?
User guide says "Once the custom control has been created and registered on the target system"

EA will look for a class with the name (in your example) "TestAddIn.MyCustomControl" in the registry.
Use RegEdit to check that there is an entry under HKEY_CLASSES_ROOT

I've forgotten to do it before now.

Adrian



3
Hi All

I am attempting to add a custom window to an addin and have used Sparx's rather brief notes

http://sparxsystems.com/enterprise_architect_user_guide/13.5/automation/custom_docked_window.html

However the addiin window is not added:

I am using Visual Studio 2013 and C# .Net 4.5

My Code is as below:

The very simple Test Addin:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace TestAddIn
{
    public class TestAddIn
    {
        // ----------------------------------------------------------------------
        // Menu Strings
        // ----------------------------------------------------------------------

        private String menuHeader = null;
        private String[] menuOptions = { null };

        private bool safeDeleteIsEnabled;
        private MyCustomControl myCustomControl;       
 
        //-----------------------------------------------------------------------
        // Constructor
        //-----------------------------------------------------------------------

        public TestAddIn()
        {
            safeDeleteIsEnabled = true;
            menuHeader = "-&Tester";
            menuOptions = new String[] { "&Checked", "-", "&Unchecked", "-", "&Show Window", "&Hide Window"};

        }

        // Enterprise Architect standard extension methods

        public void EA_Connect(EA.Repository repository)
        {

            myCustomControl = (MyCustomControl)repository.AddWindow
                     ("Test Addin", "TestAddIn.MyCustomControl");
            if (myCustomControl == null)
            {
                MessageBox.Show("Test AaddIn Custom Window not added");
            }
            else
            {
                MessageBox.Show("Test AddIn Custom Window added);
         }
        }

        public void EA_Disconnect()
        {
            GC.Collect();
            GC.WaitForPendingFinalizers();
        }

        public object EA_GetMenuItems(EA.Repository repository,
                                      string menuLocation,
                                      string menuName)
        {

            if (menuName == String.Empty)
            {
                //return top level menu option
                return menuHeader;
            }
            if (menuName == this.menuHeader)
            {
                // return submenu options
                return menuOptions;
            }
            else
            {
                return string.Empty;
            }
        }

        public void EA_GetMenuState(EA.Repository repository,
                                    string menuLocation,
                                    string menuName,
                                    string itemName,
                                    ref bool isEnabled,
                                    ref bool isChecked)
        {
            switch (menuLocation)
            {
                case "MainMenu":
                    switch (itemName)
                    {
                        case "&Checked":
                            isEnabled = true;
                            isChecked = safeDeleteIsEnabled;
                            break;
                        case "&Unchecked":
                            isEnabled = true;
                            isChecked = !safeDeleteIsEnabled;
                            break;
                    }
                    break;
            }
        }

        public void EA_MenuClick(EA.Repository repository,
                                    string menuLocation,
                                    string menuName,
                                    string itemName)
        {
            switch (itemName)
            {
                case "&Checked":
                    safeDeleteIsEnabled = !safeDeleteIsEnabled;
                    break;
                case "&Unchecked":
                    safeDeleteIsEnabled = !safeDeleteIsEnabled;
                    break;
            }
        }
    }

}

The addin window has been added to the solutions as a Visual Studio Custom Control and the Code is:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace TestAddIn
{
    public partial class MyCustomControl : Control
    {
        public MyCustomControl()
        {
            InitializeComponent();
        }

        protected override void OnPaint(PaintEventArgs pe)
        {
            base.OnPaint(pe);
        }

        private void label1_Click(object sender, EventArgs e)
        {

        }
    }
}

Everything builds fine and the addin works fine, but the reference nyCustomControl is always null thus indicating the Custom Window has not not been added.

Using the Extend | Manage | Add-in Windows returns No loaded add-ins are using this window

I must be missing something, but what?

All namespaces and names are correct.s

One curious thing, the article by Sparx on Custom Windows, mentions an ActiveX Custom Control and and OCX file. I do not see any OCX file in my build, so if this is what is missing, how is such an OCX file created, and where should it be located.

Any help or advice will be most appreciated.

Phil
4
General Board / Re: Plugin of Script?
« Last post by qwerty on October 21, 2017, 07:59:46 am »
It's fairly easy to find that. The DiagramObject has its Style property where you find "Lollipop=1;" or you don't.

Anyhow, I found the use of Ports much more convenient where you add Provided/RequiredInterfaces that can be classified (since EA is so consistent Ctrl-L does not work and you need to open the properties dialog to use the ellipsis button here).

q.
5
General Board / Re: Plugin of Script?
« Last post by ngong on October 21, 2017, 06:21:02 am »
qwerty, Paolo - thank you for your helpful contribution: a script for processing all interfaces on the current diagram would do - at least in the first place.

Paolo - I looked around Shapescript examples. I understood that they are used to do other notations than provided by UML and they are bound to a certain stereotype. That is not what I want. I like to switch some Rectangle/Circle property somewhere, not to draw anything.

From Geerts scripts tutorial I found a Diagram script close to what I try to achieve. It is fairly easy to loop over all interfaces found on a diagram.
But how to determine whether the shape is rectangle or circle? And how to switch it? I could not find a certain property or function of the located EA.element. I also wonder whether this should be a property of that interface EA.element. It should show up as a circle on the one current diagram only! For my understanding it could be a property of the relation between the Interface EA.element and the Diagram it is located on. Hmm ... how to find that in the Automation Object Model?

I feel I am close but would like to ask for some help here.

Kind Regards


Rolf
6
I am with qwerty, and I use the profile helper whenever I am able to.

In this case I just was not able to, because I was looking for a way to define with the profile helper a tag using a Tagged Value Type Format. This I found by adding strings like <memo>,  <data> in Default Value.
But what on earth is the difference in putting a string in the Default Value field of the profile helper in comparison to put the string in the Initial Value field of an attribute?


At the end I can say that there is no feature at all in the profile helper to define a tag with a tagged value type of type <time> and most others, as defined here:
https://www.sparxsystems.com/enterprise_architect_user_guide/13.5/modeling_tools/predefinedtaggedvaluetypes.html


You have to go outside, defining uml tagged value types and afterwards, when using the profile helper again you have to know the “Predefined” does not refer to the major content you find here https://www.sparxsystems.com/enterprise_architect_user_guide/13.5/modeling_tools/predefinedtaggedvaluetypes.html
but more to the content here:
https://www.sparxsystems.com/enterprise_architect_user_guide/13.5/modeling_tools/predefinedtaggedvaluetypes.html

I have a "not so simple MDG" and I maintain that for years. I know and sometimes forget most pitfalls and sources of errors and there are a lot, even when using the helpers.
It is far away from beeing such simple as "Use the helpers and all works fine".

Anyhow, I am absolutely sure, that with not much effort the power of MDG could be made much handier for creation.
7
Bugs and Issues / Re: Test, Issue, Defect,… Requirement dependencies
« Last post by qwerty on October 20, 2017, 07:57:06 pm »
As said: rather than putting lots of effort in putting in more and more useless gimmicks some base cleanup would work wonders. If there were a simple concept to configure your own properties for elements, that would remedy a lot. Means you make a cut and get rid of old burdens. (I will probably not see that in my lifetime.)

q.
8
Bugs and Issues / Re: Test, Issue, Defect,… Requirement dependencies
« Last post by Uffe on October 20, 2017, 07:33:19 pm »
In fairness, MoSCoW priorities can be easily configured into either the priority or the status fields. Using status even gives you the option to visualize it.

If you want that to be the standard in your organization, you also have the option of creating a base project with those settings.

/U
9
General Board / Re: Security Disabled - How to reset security
« Last post by Uffe on October 20, 2017, 07:16:34 pm »
Hacking the database manually is in no way supported by the vendor. What you should do is restore a backup from before the project was broken.

That said, t_secpolicies is a simple property/value table. Clearing it, or selected rows in it, should remove security altogether and allow you to re-enable it which should recreate the default "admin" user.

But I don't know what's gone wrong with your project, it's impossible to tell just from what you describe. There are many other components that come together to make an EA deployment. Cloud connections are one complication, for instance, and there are several others. Only you know what decisions you made in your deployment.

So I make no promises and take no responsibility. You are completely on your own here.


/Uffe
10
Bugs and Issues / Re: Test, Issue, Defect,… Requirement dependencies
« Last post by qwerty on October 20, 2017, 06:56:46 pm »
You should have a beer with skiwi ;-)

q.
Pages: [1] 2 3 ... 10