Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Ribeye

Pages: 1 [2]
16
I am successfully assigning stereotypes to elements I am creating in C#.

When it comes to setting values of tags that the stereotype has I am failing.

I copied code from https://sparxsystems.com/forums/smf/index.php?topic=6097.0 but it is creating new tags, not setting the tag values of the stereotype.

I cant find example code anywhere.

Here is that I have come to.
        // https://sparxsystems.com/forums/smf/index.php?topic=6097.0
        public static bool addTaggedValue(EA.Element elementParam, string tagName, string value)
        {
            TaggedValue tag = elementParam.TaggedValuesEx.GetByName(tagName);
            if (tag == null)
            {
                TaggedValue element = elementParam.TaggedValuesEx.AddNew(tagName, value);
                element.Value = value;
                element.Update(); //must be executed in order to save new tagged value
                elementParam.Update(); // is it needed?
                elementParam.TaggedValues.Refresh();
                String debugString = element.FQName; // always ""
                return true;
            }
            tag.Value = value;
            tag.Update();
            elementParam.Update(); // is it needed?
            elementParam.TaggedValues.Refresh();
            return false;
        }

17
Thanks Geert - they confirmed it is not implemented.

18
I am thinking to assign key strokes to the menu functions using Start > View > Visual Style > Customize > Keyboard.

From C# you can send keystrokes, I see in the documentation.

Maybe that is an option.

Except I see not all menu options are available from "customise" form, so you cant assign a keyboard shortcut e.g.  Develop->Data Modelling -> Import

19
Oh.

Can it be done in Javascript?

I cant find a way for that either.

20
I am writing C# plugins using Visual Studio.

On my plugins menu I would like to have a menu item that triggers the Develop -> Data Modeling -> Import function.

How do you trigger standard EA menu items from C#?
 

21
oh!

I will test "import" from the EA_MenuClick javascript.

If that does not work it would mean if I have a common javascript function that I want to use in lots of places I have to copy it lots of times.

Many thanks for your input Geert, very helpful.

22
Yes, I get point 1): I put my Specialize->Tools->JavaScript javascript (called "validate") into a scripts group type which will determine where the is shown.

But I want to run the "validate" javascript from my add-in menu - not seeing that in group type options. So I put my "validate" javascript script into group type "Normal Group".

Then I want to call "validate" javascript script (that is in a "Normal Group") from a EA_MenuClick javascript of my plugin.

How to do that?

Re point 2) Presumably you need to include "validate" javascript in the EA_MenuClick javascript  some how. So I thought !INC might be a EA way of doing that, but it only seems to work in Specialize->Tools->JavaScript javascript .

23
I have:

a) created some add-ins - they appear under Specialize -> Addins. Look good. The <<javascriptAddin>> class has both EA_GetMenuItems and EA_MenuClick, which are working fine.

b) written some javascript scripts using functions under Specialize -> Javascript Library. They are also running fine.

Now I want to execute my b) javascript scripts from by a) menu items.

How do you do this?

I have search everywhere for an answer with no luck. I tried syntax like

 !INC Local Scripts.EAConstants-JScript

as it is used b) javascripts, but this causes a) EA_MenuClick javascript to throw a syntax error
2)

 

Pages: 1 [2]