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

Pages: [1] 2 3 ... 7
1
Are you able to open the same file from an non-Japanese version of Access?
Yeah, I used already MDB Viewer Plus to look into the database to find something suspicious, but with no success. My english EA, however, does not allow me to open the file. It's funny that an XMI Export of the same project (exported from Japanese version) followed by an XMI Import in my English version works.

2
Yes, actually I already found a problem, which is directly related to EA itself. When trying to open an EAP file that has been created with the Japanese version (I'm using the English version), EA signals "An Error has occurred: Unrecognized database format" and refuses opening the project.

Any ideas from Sparx side what the cause of this problem could be and how to solve this issue?

Jan

3
Hi all,

I'm currently having a customer from Japan using the Japanese edition of EA. I wonder, if the different language and in particular the different characters might brake something in our add-ins. I mainly think about plain SQL query interpretation going through Rep.SQLQuery() and Rep.Execute().

Did someone of you guys experience problems with that?

Many thanks!
Jan

4
General Board / Re: Recursive SQL statements using WITH (CTE)
« on: August 01, 2017, 09:09:15 pm »
What you can also try is directly working on the EAP project with C# DB access mechanisms. I did that once for updating absolute paths for toolbox profile icons to the current version control checkout path (helps enormously if different work on MDG development). I believe with this method, the syntax you are allowed to use is just the database technology itself, so you could try the with statement with this method:

Code: [Select]
                var profilesProject =  "profiles.eap";
                const string iconFolder = "\\icons";
                try
                {

                    OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;"
                                                               + "Data Source=" + profilesProject);
                    conn.Open();

                    using (DataTable dt = new DataTable())
                    {
                        using (OleDbDataAdapter adapter = new OleDbDataAdapter(@"SELECT [Default],ID FROM t_attribute WHERE Name='Icon'", conn))
                        {
                            adapter.Fill(dt);
                        }
                        List<string> queries = new List<string>();
                        foreach (DataRow row in dt.Rows)
                        {
                            string toolboxIconPath = row["Default"].ToString();
                            if (!toolboxIconPath.StartsWith(executingFolder))
                            {
                                int index = toolboxIconPath.IndexOf(iconFolder);
                                if (index > 0)
                                {
                                    string newPath = executingFolder + toolboxIconPath.Substring(index);
                                    Console.WriteLine("\tReplacement: " + toolboxIconPath + " -> " + newPath);
                                    queries.Add("UPDATE [t_attribute] SET [Default]='"+newPath+"' WHERE [ID]="+row["ID"]);
                                }
                            }
                        }

                        if (queries.Any())
                        {
                            Console.WriteLine("\nAre the replaced paths correct? Go on with 'y'");
                            ConsoleKeyInfo pressedChar = Console.ReadKey();
                            if (pressedChar.KeyChar == 'y')
                            {
                                foreach (string query in queries)
                                {
                                    using (OleDbCommand cmd = new OleDbCommand(query, conn))
                                    {
                                        cmd.ExecuteNonQuery();
                                    }
                                }
                                Console.WriteLine("\nToolbox Icon Paths updated successfully :-)");
                            }
                        }
                    }

                }
                catch (Exception e)
                {
                    Console.WriteLine("\nAn error occured during updating the toolbox icon image paths. Are you sure that you have the SVN lock on the profiles.eap file?");
                }
                Console.WriteLine("\n\nPress any key to exit...");
                Console.ReadKey();

5
Be aware that not every connector has a diagram link row by default. This is yet another inconsistency to diagram objects. Before changing the diagram link via SQL make sure that the diagram link for your connector and specific diagram really exists. If this is not the case, you can create the link via code.

We do this for similar use cases (in this case bend point application to connectors) like shown below. The importance piece is the logic plus the insert query, which took me quite some time to get it accepted by EA.

Code: [Select]
        public void changeConnectorLayout(IDualConnector conn, int diagramID, IEnumerable<Point> bendPoints = null)
        {
            string diagramLinkAvailableQuery = "SELECT ConnectorID FROM t_diagramlinks WHERE ConnectorID=" + conn.ConnectorID + " AND DiagramID=" + diagramID;
            string linkAvailable = EAFacade.RetrievalCore.getFieldByQuery(diagramLinkAvailableQuery, "ConnectorID");
            if (linkAvailable == null)
            {
                string insertDiagramLinkSQL = "INSERT INTO t_diagramlinks(DiagramID, ConnectorID, Geometry, Style, Hidden) " +
                    "VALUES(" + diagramID + "," + conn.ConnectorID + @",'EDGE=1;$LLB=;LLT=;LMT=;LMB=;LRT=;LRB=;IRHS=;ILHS=;','Mode=3;Color=-1;LWidth=0;Tree=OR;',False)";
                EAFacade.rep.Execute(insertDiagramLinkSQL);
                changeConnectorLayout(conn, diagramID, bendPoints);
            }
            else
            {
                ConnectorLayout layout = new ConnectorLayout(conn.ConnectorID, diagramID);
                layout.Create();

                string newStyleSQL = layout.GetStyleDBString();
                string newGeometrySQL = layout.GetGeometryDBString();
                string newBendPoints = layout.SetBendPoints(bendPoints.ToList());

                string setBendPointsSQL = "UPDATE t_diagramlinks SET Style='" + newStyleSQL + "', Geometry='" + newGeometrySQL + "', Path='" + newBendPoints + "' WHERE DiagramID=" + diagramID + " AND ConnectorID=" + conn.ConnectorID;
                EAFacade.rep.Execute(setBendPointsSQL);
            }
        }

6
Hi guys,

I'm modeling and analyzing component architectures with a custom profile + add-in. The syntax and semantics are pretty close to SysML and therefore I'd like to have an arbitrary number of diagrams (like Internal Block Diagrams) per component. As far as I understand, EA's SysML extension derives the association of a diagram to a block only through the implicit containment in the project browser, i.e. when I move the diagram somewhere different in the model, the "formal" relation gets lost.

This is exactly the problem I'm trying to solve. The possibilities I thought about are:
1. Introduce a reference list tagged value to the component that is manually maintained in the add-in.
2. If a list of associated diagrams should be retrieved, search through the diagram elements of existing diagrams and take the ones, where the component is used largest element containing its realization.

In the past, we used Option 1 in similar use cases, but it proved to be a pain in the ass to maintain tagged value lists of GUIDs manually during deletion and creation. In addition, reuse model parts in different projects is pretty hard, because the GUIDs get outdated quickly in that case.
Option 2 is again implicit and not very robust.

Does anyone of you have a better idea, how this could be solved? The ideal solution would be a connector between an element and a diagram, but that is not possible as far as i know.

Thanks for any insight!
Jan

7
Hi guys,

I have defined several relation stereotypes in our profiles that serve for traceability and containment. The containment relations aim at specifying a containment structure being independent from the implicit containment existent through the project browser. The driver for this decision was EA's automatic model movement of elements to other parents based on diagram movement.

When elements are created from the toolbox or programmatically, the relations are automatically created. As we know, a connector is shown by default, if both source and target element appear together in a diagram. This clutters diagrams a lot for my specific use case, therefore I'd like to hide these connectors by default. My approach for doing so was to hide the diagram links in code directly after I put the elements and the connector in the diagram programmatically.

The problem is that the hiding doesn't have any effect, because the diagram link is apparently not created immediately, when the elements (connected already in the model) are put in the diagram.

I wonder if it's possible to hide certain stereotyped connectors through the profile definition directly.

I didn't find anything in the docs w.r.t such a feature. If this is not possible, I have to solve that programmatically somehow.

In this case: Did someone face a similar issue in the past that diagram links only appear delayed in t_diagramlinks and probably has a solution for this issue?

Another option, we used for similar things in the past was to use refGUID tagged values referencing the related elements. However, I remember, they had to be maintained manually (i.e. potential inconsistencies because of deletions of referenced elements) and therefore we discarded this approach back then.

Thanks for your help, guys :-)

Jan

8
If you click on the Sparx menu on the left upper corner of the tool, you will see a search bar at the bottom of the menu. There you can enter old menu entries and invoke them! Alternatively, you can change the Visual Style under Start > Workspace > Visual Style to Microsoft Office 2016. After that a search bar is shown directly next to the main menus (on the right).

9
General Board / Re: Auto layout Diagram from Visual Basic
« on: August 26, 2016, 11:32:26 pm »
Long story short:

Paolo is right: You cannot programmatically access the layout types like Circle, Box, etc. you know from the UI.

The only means of performing some programmatic layout with EA is through
Code: [Select]
Project.layoutDiagramEx(string DiagramGUID, long LayoutStyle, long Iterations, long LayerSpacing, long ColumnSpacing, boolean SaveToDiagram)
where LayoutStyle is one of the Enum values qwerty posted.

10
General Board / Re: Auto layout Diagram from Visual Basic
« on: August 23, 2016, 09:06:08 pm »
Hi Knightrider,

have a look at the Project Interface class and its layoutDiagramEx() method.

http://www.sparxsystems.com/enterprise_architect_user_guide/12.1/automation_and_scripting/project_2.html

Best Regards,
Jan

11
Bugs and Issues / Re: Model Root Package API inconsistency
« on: August 21, 2016, 03:14:31 am »
Hi Helmut,

I know about the different package types EA has, but in any case, the two methods should return the same object type for the same thing.

12
Bugs and Issues / Re: Model Root Package API inconsistency
« on: August 19, 2016, 12:22:45 am »
-> Uploaded pictures to server!

13
Bugs and Issues / Model Root Package API inconsistency
« on: August 18, 2016, 11:37:04 pm »
Hi guys,

I'm currently developing with EA 12.1 Build 1229.

The repository context item getter methods are somehow inconsistent for model root packages as can be seen in the following pictures.



For the "Model" root package:



For the "Bugs" normal package:



As can be seen, the context item types differ in the first case.

The million-dollar question: Is this a bug or a feature with a well-thought reason behind?

Thanks for enlightenment!
Jan

14
Suggestions and Requests / Re: Stop SPAM
« on: August 13, 2016, 02:24:21 am »
Yeah, pretty annoying if you get notified about all new threads in the forum.

@Sparxians: Please include captchas for submitting topics/replies as every forum does it nowadays!

15
Yeah, Geert is right! Cross-thread invocation of dialogs/controls/forms is a weird thing in .NET.

Search for Control.Invoke() and Control.BeginInvoke() to find the method suiting your use case.

More information on the topic you can find here

Jan

Pages: [1] 2 3 ... 7