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 - Hoefler1

Pages: [1] 2
1
Can anyone tell me why this would not work? There is an error " 'Function' expected" appearing in the line with "End Try".
There are basically 3 cases:
1. The GUID of the AttrClassifier is in OwnElems -> set IsValid = true
2. The GUID is not in OwnElems -> set IsValid = false
3. There is no Element with the ID of the Classifier (Catch the Exception thrown in first line of Try-Block) -> set IsValid = true

Code: [Select]
public function Validate(item)
dim validationResult
set validationResult = new ValidationResult
...
Try
Dim AttrClassifier As EA.Element = Repository.GetElementByID(Attribute.ClassifierID)
Dim guid
Set guid = AttrClassifier.ElementGUID
If THandler.OwnElems.Contains(guid) Then
validationResult.IsValid = true
set Validate = validationResult
Else
validationResult.IsValid = false
set Validate = validationResult
End If
Catch Exception
validationResult.IsValid = true
set Validate = validationResult
Return 'ignore default classifiers and elements without classifier
End Try
end function

2
General Board / Re: Experience with model validation?!
« on: June 28, 2016, 10:33:48 pm »
I was now able to build a small test rule using your VBScript-Lib.
It works when you just run the script, but unfortunately I always get an error when debugging step by step in EA. It says "Class undefined: 'validationResult' " in 'Rule_BPANotSynchronized.vbs' line 53... however this does not happen when executing without debugging.
Don't you experience this issue? And what might be the reason?

3
General Board / Re: Experience with model validation?!
« on: June 21, 2016, 09:20:52 pm »
Hello Geert,
I want to use your VBScript-Library for Model Validation.
But I am missing the 'Atrias Rules' in the Include.vbs (line 10). Where does this come from?

4
How can I set up profiles for the Relationship Matrix using a script?

I want to automate the creation process for several profiles which must be added to all of my projects.
So running the script should then do the creation.

Where are these profiles even stored?

There is only a Getter for this: Repository.GetRelationshipMatrix() returns something like:
Code: [Select]
...<Profile linktype="Refine" source="Requirement" target="UseCase" direction="0" targetpackage="{...guid...}"
sourcepackage="{...guid...}" showsourcechildren="1" showtargetchildren="1"/>...

5
I don't think that is true. There's Miscdata on an EA.Element as well.

Geert

I'm sorry. You're right.
I had to use Element.get_MiscData(0) to access the DiagramID. Looks like it would work  ;)

Thanks!

6
Hello Geert,

the MiscData is only available if there was a Connector.
But in my case I only have this Hyperlink-Object on a Diagram, as it can be chosen when dragging a diagram from project browser onto another diagram.

7
Automation Interface, Add-Ins and Tools / Get Diagram of a Hyperlink
« on: March 29, 2016, 04:38:14 pm »
Hello,

Having a DiagramObject (e.g. as a Hyperlink, DiagramFrame etc.) that links to another diagram in my Project (on doubleclick),
how can I access the diagram it links to, itself?

Thank you all in advance

8
Thank you!  :D
Works fine now. And I just had to add one simple line (Repository.ReloadDiagram(Diagram.DiagramID);)
Hadn't thought of that simple solution.
I'll still send a bug report for the SelectedConnector.

9
One simple task:
The Add-In has to unselect the currently selected Connector on a Diagram (if there is one selected).
It can be accessed by Diagram.SelectedConnector
The attribute is Read/Write, so I wanted to set it to null, which leads to this error: Invalid interface passed to 'SetSelectedConnector'.

Any ideas?

10
Hello Geert,

Where and how do I call Update()?
Here's the code:
It should add every stereotype of the Package to the Element's. (I will add some if-clause to only adopt the suitable stereotypes)
Code: [Select]
public void EA_OnPostNewElement(EA.Repository Repository, EA.EventProperties Info)
        {
            int ElementID = Int32.Parse(Info.Get("ElementID").Value);
            EA.Element Element = Repository.GetElementByID(ElementID);

            EA.Package Package = Repository.GetPackageByID(Element.PackageID);
            string Stereotype = Package.StereotypeEx;

            Element.StereotypeEx += "," + Stereotype;
        }

11
Hey,
I want to set a certain Stereotype to each newly created element.
I use EA_OnPostNewElement and access the Element itself by
Code: [Select]
int ElementID = Int32.Parse(Info.Get("ElementID").Value);
EA.Element Element = Repository.GetElementByID(ElementID);
(This works fine)
In the User Guide it says for the Element Class:
Quote
StereotypeEx | String | Read/Write
                                   All the applied stereotypes of the element in a comma-separated list.
 
So I want to change this Attribute by assigning it to another String-Value. This shows no effect...
Someone know why?

12
General Board / Re: Model Validation if Category is ticked
« on: March 05, 2016, 12:06:01 am »
If my keys were consistant with the current selection in EA all the time I could simply do this in my Add-In:

Code: [Select]
public bool Category_Active(string cat)
        {
            string reg_value = (string) Registry.GetValue("HKEY_CURRENT_USER\\Software\\Sparx Systems\\EA400\\EA\\OPTIONS",
                "Global Resources::ModelValidation::W", "Key not found");
            //MessageBox.Show(reg_value);
            string catNoBlanks = cat.Replace(" ","");
            return reg_value.Contains(catNoBlanks);
        }

public void EA_OnStartValidation(EA.Repository Repository, Object Args)
        {
            if (Category_Active("My Validation Category"))
            {
                //Run my Validation
            }
            return;
        }

13
General Board / Re: Model Validation if Category is ticked
« on: March 05, 2016, 12:00:57 am »
I'm getting closer!  :)

- The ticked categories are stored in the W-Key of the active technology (<default> = Global Resources)
- The unticked categories are stored in the B-Key

So I do the following:
0. Technology is set to <default>, All the actegories are active (meaning Global Resources::ModelValidation::W contains all of them, ...::B is empty)
1. By "Configure..." I unselect whatever categories I don't want to run in the validation
    Unfortunately (!!) after pressing OK the keys remain the same...
2. I Change the Technology to something else than <default>
    Now the Global Recources-Keys are updated.  (Ticked categories in W, unticked in B)
3. So I go back to <default>

14
General Board / Re: Model Validation if Category is ticked
« on: March 04, 2016, 07:23:06 pm »
Now I see, the two Global Resources::ModelValidation registry keys were just created when selecting something else from the active technology list box, and then switching back to <default>. The "W-key" does now also hold the names of my self-defined categories.
But I'm afraid it does not change when I tick/untick any of the categories in EA. Am I just doing it wrong?

Back to my actual goal: I still want to find out the ticked and unticked categories to use this information in my Add-In.
This way I would be able to only run the program if a certain category is selected.

15
General Board / Re: Model Validation if Category is ticked
« on: March 02, 2016, 11:39:19 pm »
I did now find that key. For me (EA Version 12) it is called "Basic UML 2 Technology::ModelValidation::W"="MVR010000=1;MVR020000=1....".
But it truly doesn't seem to change.
I manually changed the 1s to 0s, to see if this would disable the categories, but it had no effect at all...

Pages: [1] 2