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

Pages: [1] 2
1
General Board / Re: Adding tagged values to certain elements
« on: December 16, 2014, 10:38:43 pm »
Maybe that C# implementation will help you:


EA.ConnectorTag tag = message.TaggedValues.AddNew("operation_guid", "String");
                        tag.Value = method.MethodGUID;                        
                        tag.Update();

                        message.TaggedValues.Refresh();
                        message.Update();


That's the example how to add Tagged Value to connector element.
But "TaggedValue" is available in other elements too.

2
Bugs and Issues / Re: EA 12 - Invoking Update() on Connector -> EA C
« on: September 08, 2015, 05:49:29 pm »
Thank you for quick answer.
Workaround works fine.

I will create a bug report today.

3
Bugs and Issues / EA 12 - Invoking Update() on Connector -> EA Cr
« on: September 08, 2015, 12:42:53 am »
Hi,

I was working very long time on implementing C# plugin for generating custom communications diagrams. And it was working great until version 12 appears :(.

I have found that there's a significant change in internal API (in ver.12) implementation, which causes EA crash when I'm trying to Update() programatically instance of Connector class.

After some investigation I have found that for some reason, some person decided that now it's impossible to create and Update()  Connector instance with type 'Collaboration' between:
- 'Actor' and 'Object' or even between two 'Object's

Of course it's possible to create that manually. I checked exported xml file and I have found that:

<UML:TaggedValue tag="ea_type" value="Collaboration"/>
<UML:TaggedValue tag="direction" value="Source -&gt; Destination"/>
.....
<UML:TaggedValue tag="ea_sourceType" value="Actor"/>
<UML:TaggedValue tag="ea_targetType" value="Object"/>

It worked perfectly in previous version 10 and 11.
Could someone can help me ?

Thank in advance.

Code pieces:

//simple connection between Actor(root of diagram) and first class 'Object'
EA.Connector connector = previous.m_diagramElement.Connectors.AddNew("", "Association");
connector.SupplierID = current.m_diagramElement.ElementID;            
connector.Direction = "Source -> Destination";            


//Manually you should  'Add Message from XX to YY" by selecting from previously created connector on diagram submenu (RMB)
//To achieve the same programatically I created message connector
EA.Connector message = previous.m_diagramElement.Connectors.AddNew(functionData.MethodName, "Collaboration");
message.SupplierID = current.m_diagramElement.ElementID;
message.Direction = "Source -> Destination";

connector.Update();
message.SupplierEnd.Ordering = 1;            
message.ClientEnd.Aggregation = connector.ConnectorID;            
message.ClientEnd.AllowDuplicates = true;
message.ClientEnd.Ordering = 1;
message.Update() <<--------------- Here is a crash

When I use try catch statement, the exception message is:

'Collaboration' is not legal for Actor --> Object' !!

Why it's possible to do it manually, I don't understand  :(

Is it possible to set in C# code that I want to use Lib with version 10 or 11 ?

4
It's C# code:

EA.Connector newConnector = yourElement.Connectors.AddNew("", "Association");//or other types ass "Collaboration" etc.
newConnector.ConveyedItems.AddNew("", "");

( in VB it should be almost the same)

5
Why can't you add all connectors names to some List or Dictionary, and sort them after that ?

6
Hi,

I would like to know if someone can help me with changing a color of EA.Element problem ?

Thank you.

7
I have checked 0,1,2 and neither of those options works.

Maybe I have discovered some hidden feature :)

8
Strange but it works only this way.

If I will add that "message connector" to "asscociate connector" by hand then in database field "SourceIsAggregate" for "message connector" is set to "associate connector" id.

In C# I have achieved the same result like that:

EA.Connector associateConnector = SOME_DIAGRAM_ELEMENT.Connectors.AddNew("", "Association");
        EA.Connector messageConnector = SOME_DIAGRAM_ELEMENT.Connectors.AddNew("", "Collaboration");
        ....
        EA.ConnectorTag tag = messageConnector.TaggedValues.AddNew("operation_guid", "String");
        tag.Value = method.MethodGUID;
        ....
        messageConnector.TransitionGuard = "retval=" +   method.ReturnType + ";params=;paramsDlg=" + ....;
        messageConnector.StyleEx = "aliasparamsTO=" + ..... + ";";
        messageConnector.TransitionAction = "Call";
        messageConnector.TransitionEvent = "Synchronous";
        messageConnector.Name = method.Name + .... + ")";
        messageConnector.ClientEnd.Aggregation = connector.ConnectorID;
        messageConnector.ClientEnd.Update();  

9
Ooops, I tried it before, but it didn't work.
Because I forgot about calling update.

So now it's more simple:

message.ClientEnd.Aggregation = connector.ConnectorID;
message.ClientEnd.Update();

Thank you.

10
I have fixed that.

The solution is to run SQL command:

string sqlQuery =
"UPDATE t_connector SET SourceIsAggregate=" + connector.ConnectorID + " WHERE Connector_Id=" + message.ConnectorID;
m_repository.Execute(sqlQuery);

All thanks to 'qwerty' help. Thank you very much once again.

Maybe someone has idea how to do that without using SQL executions?


11
Thank you for you support.

Unfortunately too many information appears after executing that query.
I can't find something useful there. More logical connection I can find in exported xml file.
And I don't know why I should search in whole repository.

12
xref content hasn't change in exported xml file.
Only extendedProperties tag values have additional values as "message_link"

13
I have been trying to simulate in C# the same "behaviour" which I have achieved adding element by hand.

1) I have 2 diagram object - Actor and WriteInt Object

EA.Element element = m_interaction.Elements.AddNew("", "Object");
EA.DiagramObject diagramObj = m_diagram.DiagramObjects.AddNew("","");

2) I have created 2 connectors:

a) Assocation connector between those elements.
b) Second connector ( from exported .xml I know that's connector with Collaboration setting ) can be added using "Add message from .. to .. " from "Association" connector context menu.

If you do that by hand you will see line between Assocation and Collaboration connectors. I want to do that in C#.

14
Hi,

I have created 2 connectors in C#;

First:

EA.Connector connector = previous.m_diagramElement.Connectors.AddNew("", "Association");

Second:

EA.Connector message = previous.m_diagramElement.Connectors.AddNew(functionData.GetMethodName(), "Collaboration");

All refresh and update parts of code have been added
It works fine but I can't connect those two with arrow.
( which you can easly do using options "Add message from .. to .. " from "Association" connector context menu.

I have found in exported xml file that for "Collaboration connector" in extProperties "message_link" variable has been added with 1st connector GUID as value.

<extendedProperties stateflags="IsReturn=false;" virtualInheritance="0" message_link="EAID_AC5CF663_AF22_41ec_80D2_BD526F97913B" diagram="EAID_0B72E9F3_1B43_4505_A059_87963183DB4C" privatedata1="Synchronous" privatedata2="retval=bool;params=;paramsDlg=nameSpace, Key, data;" privatedata3="Call" privatedata4="0.4" privatedata5="SX=-98;SY=3;EX=-68;EY=3;"/>

I have no access to extProperties.
Question is how to simulate that connection in C# (not by hand) ?

Please help me :) Thanks in advance.

15
Automation Interface, Add-Ins and Tools / Re: Setting order of Messages
« on: December 19, 2014, 08:19:22 pm »
After I run my "C# generator" my diagram looks like that:

                      [Actor]
0.3 WriteInt ---   |
                      [Class1]
0.2 WriteData ---  |
                      [Class2]
0.1 Execute ---       |
                      [Class3]

Sorry for that kind of presentation.
So, as you see order is wrong. On that diagram
- lines between Actor , Class1, Class2 represents "Association" connector
- lines from method name to "Association" connectors represents "Collaboration/Message"connector (when you click on that you have Message Property window)
- Class1-3 are Object Instances diagram objects

So , I think now you should understand my problem with order.




Pages: [1] 2