My Profile
Help
Hot Topics
Top Community Contributors
Helmut Ortmann
Helmut Ortmann
Freelancer (Consultant)Use Java, C# & Co for your Scripting
Use the power of modern IDEs and languages like Java, C#, F#, VB, or C++ for your EA Scripting. Here you find everything you need for a quick-start.
Develop your solution, let's say a Text to Speech application for selected EA items. Code it in your favourite language with all the benefits of your IDE - the developing, debugging, version control and your life-cycle. In short, professional software development with a state of the art IDE.
Just add one line of code in EA VB Scripts to call this Text to Speech application for Browser, Diagram, Model Search.
You find an error, a new release, no big deal. Just deploy the application at your desktop.
Benefits
-
Well known Software Life-Cycle
-
Let IDE and compiler work for you
-
A vast amount of libraries, examples and tutorials
-
Easy testing and debugging
Principle
EA: VB Script glue-code
' Run the C#, VB, F#, C++ Console Programm,
result = RunCommand(myScript.exe, "DoTask1", guid, "", "") ' C# vb script glue-code
' Run the Java Class, let Java do everything
result = RunCommandJava("%EA_SCRIPT_HOME%", "SparxSystems.RepositoryInterface", " ", " "," ", " ") ' Java vb script glue-code
Example in C#
Other languages are similar.
switch (command) { // Decide what to do
case: "TextToSpeech":
var el = _repository.GetElementByGuid (guid); // get the passed element
_repository.ShowInProjectView(el); // show the passed element in project browser
break;
case: "DoTask2":
break;
}
Example Java
public void PrintPackage( org.sparx.Package pkg)
{
Trace( pkg.GetName());
Collection<org.sparx.Package> packages = pkg.GetPackages();
for(short i = 0; i < packages.GetCount(); i++)
{
PrintPackage(packages.GetAt(i));
}
}
Summary
You find the whole article, the code, an EA-Repository and the Tutorial at GitHub, ScriptDotNet.
Converting the glue-code from VB Script to JScript or JavaScript is no big deal.
Import ReqIF Requirements, from tools like DOORS & co
ReqIF is an international standard to exchange requirements between different tools. Eclipse also supports ReqIF with
With hoReverse you can import and roundtrip a bunch of requirements modules in EA. Just one click and hoReverse updates all your requirements:
- A package is a requirement module
- Nested Requirements for headings and requirements
- Graphics
- Embedded files like *.pdf
- Arbitrary columns/ attributes
The ReqIF format is also reasonable to exchange information with test & validation.
Principles
ReqIF exchanges Modules which consists of Headings and Requirments. All is packed as *.reqifz (an XML zip file) to easily import and roundtrip all the Modules and Requirements with one file transfer.
Workflow
ReqIF and hoReverse support import but also roundtrip to exchange information like:
- Enumeration: Init, Accepted, Rejected, InWork
- Text: Comment
Preparation
Update the import specification:
- Name of import and export ReqIF file
- ReqIF Module to EA Package associations
- ReqIF columns to use for graphics, name, alias, etc
- ReqIF columns to apply for a roundtrip
- EA type and stereotype to create
- e.g. Test
Import
- User: Receive the ReqIf file (myReqIf.reqifz or so)
- User: Click on 'Import' of the import specification
- EA: Imports all modules from ReqIF and creates the requirements or what else
- EA: Move deleted requirements into the trash package
Export/Roundtrip
- User: Changes the agreed ReqIF Attributes in EA (Tagged Values)
- User: Click on Export to export all to the specified export file (myExportReqIf.reqifz or so)
- EA: Writes the ReqIF file with the updated roundtrip attributes
See all:
Feel free to participate or give advice.
Best regards,
Helmut
Add-In install without admin privileges
Do you want to install your EA Add-Ins without admin privileges? This article shows you how to make a WIX installer which supports a non-admin installation of your EA Add-In. If you already have a WIX installer, you see how to make just a few changes to install your EA-Addin without admin rights.
You may also check EXPloring EA, Non-admin installation of AddIns and Tutorial, Geert Bellekens: Addin in 10 Minutes.
All here described you can see in the Open Source hoTools (see GITHUB) projects:
With WIX Toolset for creating your *.msi installer file you can make:
- Simple non-admin installer, per user installation
- Modify your WIX installation with just a few modifications
- No admin privileges required
- No dialogue, just click and eberything runs almost invisible
- GUI for per-user (no admin required) or per-machine installation
- Make your WIX Installation with GUI where you can choose
- per-user (no admin required)
- per-machine
- Make your WIX Installation with GUI where you can choose
Backgound:
A per-user installation doesn't need any admin privileges. If you want to install your EA Add-In as per-machine installation this is only possible with local admin privileges.
The Microsoft Installer , Single Package Authoring, can install per-user without admin privileges. No admin install needs some precautions:
- Install in 'LocalAppDataFolder'
- Register Add-In in 'HKMU'
- Register the DLLs in 'HKCR'
- Say the installer you want per-user with limited privileges
- InstallScope='perUser'
- InstallPrivileges='limited'
Make it easy:
Here you find a lot of explanations. Usually you:
- Adapt Product.wxs with a few information Product.wxs
- Add your components/ files to your file.wxs
- Add your default install folder to directories.wxs
- Don't touch (just takeover or don't use, only used for GUI solution, Single Authoring Package)
The whole Article 'Add-In without Admin privileges'. There you find:
- Details
- Backgroundinformations
- Examples
- Tips
- A lot of links
I appreciate your feedback, your improvements and your experiences. With pleasure I integrate your suggestions.
Thanks a lot,
Helmut
LINQ to SQL to boost your Find, Verify & Metrics
- Combine SQL like query language with the power of C#, VB, or F#
- Database independent
- IntelliSense, AutoComplete
- Let the compiler find your typos
- How to leverage LINQ to SQL in your Add-In (Example SimpleAddIn of open source hoTools)
- LINQPad, the off-the-shelf interactive Scratchpad
You find standard SQL somehow old, limited, difficult to learn and has a lot of dialects? You think a Compiler can find a lot of your typos, Then give LINQ to SQL a try. You have two possibilities:
- LINQPad as an interactive query and debugging tool, database independent, C#, F#, VB
- Develop your Add-In with LINQ to SQL
The main advantages of LINQ for SQL are:
- Database independent
- Combines the benefits of SQL like and Code (C#, F#, VB)
- IntelliSense, Autocomplete, let the Compiler find your typos
- Powerful Debug as you know from C# & Co.
- LINQ provides a rich Eco-System (SQL, XML to name a few)
The LINQPad:
Ready to use Scratchpad to run, debug and visualize your Find and Debug for all your EA Databases. Show the code for the above grid:
IntelliSense, Autocomplete:
Let the Compiler find your typos.
Export to Excel:
Steps with LINQPad:
- Create a new connection to your EA Database
- Assign the connection to the query at hand
Look inside:
- Combine queries and Code
- EA Databases supported
- Arbitrary complex queries without the limitations of SQL
- Edit, Debug, Visualize
- C#, F#, VB, LINQ (XML, SQL,..)
Add-In with LINQ to SQL:
You find two examples to tinker with in AddInSimple (part of hoTools). In essence:
- Determine Database and connection string
- Run LINQ query to DataTable
- Output DataTable to EA Model Search
- Enjoy
The results:
Start with AddinSimple and EAExample.eap.
Control Code:
The Query:
Summary:
LINQ to SQL is the solution for complex queries:
- Interactive query tool LINPad
- In your Add-In to easily handle complex queries database independent
- Database independent
- IntelliSense and AutoComplete
- Compiler verifies against EA Database (no typos, type safe)
- Comprehensive debug features
From viewpoint EA user:
- Find in EA - everything without SQL limitations
- Verify your EA models
- Make metrics of your EA models
Write it once and use it for all your EA databases - regardless of location or type. Just connect your query with the new Database.
References:
- AddInSimple to show the basics
- LINQPad for SQL
- LINQPad for command line, call from EA
- LINQPad predicate builder
- LINQPad Tips & Tricks by Dan Clarke
- LINQ to SQL driver
- Tips&Tricks
- Implementation
This and more you can see at https://github.com/Helmut-Ortmann/EnterpriseArchitect_hoTools/wiki/LinqToSql.
I appreciate your experiences and feedback!
Kind regards,
Helmut
Use C#, Java, for your VB Scripting
Use C#, Java from your EA Context Menu:
This works for all EA Versions, even without Administration rights to install an Add-In or so.
EA Version 13 supports an IDE to develope in C# and Java with full EA API support and debugging. They name it Hybrid Scripting. You may use the EA 13 Hybrid Script environment or other IDEs. Going the first steps is easier with EA 13.
This article shows you with a little example how to use C# for your Scripting. After you have understood C#, it should be easy to use Java in a similar way. The main idea is to use a small wrapper you call within your VB Script. Of course, after you have understood it's also easy to write this little wrapper for JavaScipt/JScript.
SPARX delivers two DLLs to use the EA API efficiently. With these DLLs, you can use the EA Hybrid development environment as well as any other IDE you like most. In other words: You can use the power of state of the art languages to perform your scripting. Integrating Scripting in EA is as easy as you know it from the well-known Scripting Languages VB Script, JavaScript, JScript. This without installing anything or needing Admin rights.
Just insert the line:
- 'RunCommand("myLogic.exe, "", " ")'
in your VB Script and you are done with VBScript to call your C#. Java would be similar.
Let's make a quick example with EA Version 13 and C#:
Make an EA C# ConsoleApplication
- Create a new EA Project
- Create a Package ('Select and Apply Model Pattern')
- C#, RepositoryInterface 4.0
- c:\temp\hybrid
- Build the Application
- Have a look in the generated Application
- c:\temp\hybrid\RepositoryInterface 4.0\
Import VBScript wrapper to call C#
- Configure, Transfer, Import Reference Data
- Make EA Scripting visible
- Code, Scripting (you may have to refresh Scripts)
- You see the new VB Scripts inside the ScriptGroup HybridScripting:
- RunCommand
- RunCommandTest
Run C# ConsoleApplication.exe
- Adapt VBScript RunCommandTest
- Adapt path to 'ConsoleApplication.exe'
- See
- Line:28/29 Needed references
- Line:35 Path to *.exe which executes your logic
- Line:36 The call of the wrapper, result contains the StandardOutput of the Script
- Run VBScript RunCommandTest
- Right Click on RunCommandTest
- Run Script
How do you use it
There are two approaches: Generates you VB Script by inserting the the wrapper Call in the EA templates at the appropriate location. The other way is to remove the template and just call the wrapper like
'result = RunCommand("myLogic.exe, "", " ")'
instead of the using the template scuffold.
Under the hood
EA delivers the two dlls:
- Interop.EA.dll
- SparxSystems.Repository.dll
They expect the Process ID, first parameter, to know which EA Instance the *.exe wants to use. So, RunCommands makes:
- Estiminate the own Process ID
- Call 'RunCommand...'
- Reads the Standard output from your *.exe
- Returns to Standard output to the caller
Inside the *.exe you have full access to the EA API.
JavaScript, JScript, Java?
With this example it's easy to migrate 'RunCommand' to JavaScript or JScript. Remember, you can use every Language supported by EA and every IDE you like most.
References
- SPARX Webinar Hybrid Scripting
- SPARX Tutorial Hybrid Scripting
- hoTools Hybrid Scripting
- RunCommand.vbs (The wrapper to call your C#, Java,..)
- https://github.com/Helmut-Ortmann/EnterpriseArchitect_hoTools/blob/master/HybridScripting/vb/RunCommand.vbs
- RunCommandTest.vbs (An Example with EA example C# Hybrid Script ConsoleApplication.exe, see Tutorial )
- https://github.com/Helmut-Ortmann/EnterpriseArchitect_hoTools/blob/master/HybridScripting/vb/RunCommandTest.vbs
Show or hide Ports, Activity Parameters or Action Pins
Abstract
You have a diagram, and you want to show or hide:
- Port, Activity Parameter, Action Pin
- Label of Port, Activity Parameter or Action Pin
- Type of Port
Select the nodes where you want to show or hide, click on the appropriate hoTools Button and hoTools will do the rest.
Description
Ports are powerful means to define a structure with specified points of interactions (Ports). The Port type is the specification of the interaction point. It also works for:
- UML Port
- SysML Block, Part, Port
- Activity Parameter (no type hide/show supported)
- Action Pin (no type hide/show supported)
Select:
- Nothing on the diagram to run on the whole diagram
- Nodes you want to perform the show/hide operation
Buttons
- SP Show Port, Parameter, Action Pin
- HP Hide Port, Parameter, Action Pin
- SPL Show Port, Parameter, Action Pin Label
- HPL Hide Port, Parameter, Action Pin Label
- SPT Show Port Type
- HPT Hide Port Type
Advanced Features
- Move selected ports
- Explore the WiKi for mode information.
Installation
The easiest way is to go to GitHub, and load the current release of hoTools. At GitHub you can also find a WiKi.
The procedure:
- You need local administration rights to install an EA Addin
- Load hoTools2.1.1.msi from Github or the attachment
- Deinstall an older release of hoTools
- Run hoTools2.1.1.msi
References
- hoTools in GitHub
- WiKi in GitHub
- Description Port show/hide
- Release with installation description and more
I appreciate your feedback !!
hoTools: SQL with Tabbed Editing, Macros, Templates,
Abstract
Build your EA SQL Query with a tabbed editor. Load and Save it to your file system. Use elaborate Macros to access EA features like #CurrentItemID#, DiagramSelectedElements_IDS#, .. Everything tuned to make it easy and to concentrate at the job of hand. Even Conveyed Items on a connector are easy to handle.
Just right click in the Editor and 'Insert Macro, Template, Recent File,..'.
You want to use your beloved Editor. Just do it. The SQL are saved to file and hoTools recognizes changes made outside.
Features
- Tab editing
- Macros, Insert Macro from a list
- #Branch#, #Package#,#DiagramElements_IDS#, #DiagramSelectedElements_IDS#, #CurrentItemID#,#CurrentItemGUID#
- #ConnectorID#, #ConveyedItemsIDS#,
- Comments // my lovely Comment
- DB specific section easy without remembering the syntax
- Templates, Insert Template from a list
- Wild Card support without doind anything as to write your beloved '*' or so. It will be converted according to current DB
- Just use *,?, %,_,^or ! (hoTools translate sit to your database)
- Recent File
- Undo/Redo
- Keys
- CTRL+L Load from File
- CTRL+R Run SQL
- CTRL+S Store
- CRRL+SHIFT+S Store all
- Help (just a click from you)
- Tooltips
- Get Error of SQL
- Get SQL as sent to EA
- Configurable
- A lot more to find out
Gallery
Main Window
Run SQL
If you have a <Search Term> enter it and run (Click on Button or CTRL+R). Remember: Unde Menu Help you find:
- SQL Error with one click
- SQL sent to EA with one click
The results are schown in EA Model Search Window.
Load Tab from recent files
Insert Macro
Insert Template
Insert Macro
Tooltips
Installation
- run hoTools2.02.msi (attachment or GitHub)
- .NET 4.5 or greate
- Enterprise Architect 9.0 or greater
- Local administration rights
More
Thanks to Geert Bellekens who gave me lot of ideas and code from his great NAVIGATOR!
Your advice is appreciated!
Script move/delete items from Search Result
Delete or move elements to package which are found by Searches (SQL, Query Builder, Standard Searches). These vbscripts allow you to easily handle found elements and to develop your own vbscripts to manipulate found things. In effect these scripts use bookmarked or elements copied to clipboard. It's an extension fo Geert Bellekens VBScripting Library.
Abstract:
- Use SQL Searches to move or delete found elements, diagrams or packages copied to Clipboard
- Use Bookmarked elements from e.g. Standard / QueryBuilder Searches to move or delete elements
- Handle bookmarked or result of SQL searches with your individual script
These scripts are using Geert Bellekens Script Framework (powerful!, Open Source)
- See also there for updates, folder ho
Standard Search / Bookmark:
- Set bookmarks
- e.g. by Standard Search
- If move: Select target package in ProjectBrowser
- Run Script:
- hoModelSearch, DeleteBookmarkedItems or
- hoProjectBrowser, MoveBookmarkedToSelectedPackage
Standard Search / Clipboard:
- Run SQL Search
- each row shall contain GUID of the items to handle
- Copy wanted rows to clipboard (eg: CTRL+A, CTRL+C)
- If move: Select target package in ProjectBrowser
- Run Script:
- hoModelSearch, DeleteClipmarkedItems or
- hoProjectBrowser, MoveClipmarkedToSelectedPackage
In Action: Delete item found by SQL Search or Query Builder Search
- Run SQL Search with element GUID as result / Run Query Builder Search
- Copy to Clipboard (SQL Search / Bookmark (Query Builder Search)
- Run Delete ClipboardedItems / Delete BookmarkedItems
Move items found by SQL Search to package
- Copy found elements to Clipboard
- Select Package, Right Click, Scripts,...
Move bookmarked items
(bookmarked in eg. Diagram or found by Standard Search / Query Builder Search) to selected package)
- Run Standard Search or Query Builder Search
- Bookmark wanted elements
- Select Package, Right Click, Scripts,...
- It works
Install
- Project DataManagement, Import ReferenceData, Select File (Script.xml)
- Select 'Automation Scripts'
- Import
- See the scripts for details:
- ho (reusable groups to extend functionality according to your needs)
- hoModelSearch Group of type ModelSearch
- DeleteBookmarkedItems
- DeleteClipboardedItems
- hoProjectBrowser Group of type ProjectBrowser
- DeleteBookmarkedItems
- DeleteClipboardedItems
Bookmarks (see also EA help):
- Search Window: Query Builder Results, Right Click, Bookmark Element,
- Diagram: Select elements, Shift + Space
- Diagram: Select elements, Edit, Bookmark selected,
Search & Replace
Abstract:
ho_Tools is a powerful "Find and replace" tool for texts in Elements, Diagrams and Packages. You can search recursive from a starting package or globally by a search.
It allows simple text search or powerful regular expressions to change name, note and more.
ho_Tools easily allows you to find & replace strings in your model. This is done by simple text comparison or with powerful regular expressions.
It works on EA elements, Packages and Diagrams and can change:
- Name
- Note
- Tagged Value
- Constraint
There are the following two operating modes:
- Search recursive from a selected package
- Use an EA Search like Simple or your own SQL search
First test the search. The Icons for the type need to be displayed to let ho_Tools work properly
If you have advices or questions feel free to contact me.
Installation:
-Deinstall old release
-Run the ho_Tools_Setup.msi;
- Current release: https://dl.dropboxusercontent.com/u/66337741/ho_Replace/ho_Replace.zip
Toolset to set linestyle, quick search, search / service on button / keyboard and a lot more
Abstract:
A toolset to make every day life easier. The main functions are:
- Set line style in diagram by just a click
- Searches and services at Buttons / Keyboard keys
- Navigate by click
- Change Author
- Change *.xml file of a controlled package
- Create / update Activity diagram for an operation
- etc.
Description:
- Quickly set line style to selected Diagram, Elements and/or Connector
LV= Lateral Vertical
LH= Lateral Horizontal
TH= Tree Vertical
etc., see tooltip - Quick search for class, attribute, operation
- Navigate between structure and behavior
- Specification (Open the links of file properties, source code, *.xml file)
- Create Activities and Parameters for operations
- Searches and services on buttons and keyboard keys
- Sample Queries
- Sample scripts at your finger tip
- And a lot more to experience
Have a look at the help and give it a try.
Installation:
You get the newest release from:
https://dl.dropboxusercontent.com/u/66337741/ho_Tools/ho_Tools.zip
- Run ho_tools_Setup_V1.035.msi (delete old release first)
- Copy ho_ToolsTechnology.xml to c:\Programme\Sparx Systems\EA\MDGTechnologies\
- With EA:
Project,Import Reference Data, ... ho_Tools_Scripts.XML