Sparx Systems Enterprise Architect add-in that facilitates simple displaying and editing of tagged values covered by the Plusprofil MDG.
- Sparx Systems Enterprise Architect
- WiX 3.11
- Build the project
PlusprofilAddin
to buildPlusprofilAddin.dll
. - Build the project
PlusprofilAddinInstaller
to buildPlusprofilAddinInstaller.msi
. - Run the installer to install the add-in for the current user.
The installer project for PlusProfilAddin
also contains the installer for at separate plugin called INSERT NAME
. As such when compiling the project, be aware that both add-in projects must be located where the installer project expects them.
Furthermore, should it be needed to add more add-ins to the installer, this may be done by simply adding a new fragment for the add-in, in the installer projects .wxs file.
For development and testing purposes, the build output of PlusprofilAddin (PlusprofilAddin.dll
) can be used without running the installer through the following steps:
- Open the Registry Editor (
regedit.exe
). - Go to
Computer\HKEY_CURRENT_USER\Software\Sparx Systems\EAAddins
. If the keyEAAddins
does not exist, add it. - Add a new key named
PlusprofilAddin
through the context menu, i.e. right click -> New -> Key. - Select the default value in the key, and change the value to
PlusprofilAddin.MainClass
. - Build the project
PlusprofilAddin
to buildPlusprofilAddin.dll
. - Add compiled dll to addin folder "C:\Users<USERNAME>\AppData\Local\Enterprise Architect - Plusprofil Add-in"
To use the above steps, ensure that no versions of PlusprofilAddin.dll
exist other than the version used for testing.
- Start
Enterprise Architect
. - In Visual Studio navigate to --> debug --> attach to process
- Select the process
EA.exe
. - The Visual Studio debugger is now attached to the
Enterpise Architect process
. - Add breakpoints in Visual Studio and use the
PlusprofilAddin
until breakpoint is encountered. - When changes are made to plugin, make sure you build the project again and place the updated
.dll
in the add-in folder - Restart
Enterprise Architect
.
Go to PlusprofilAddin.PlusprofilTaggedValueDefinitions
, found in PlusprofilAddin\PlusprofilTaggedValue.cs
.
In the PlusprofilTaggedValueDefinitions.Definitions
initialization, add an additional PlusprofilTaggedValue
initialization at the end of the list.
The constructor should takes following parameters:
key
: The key used to identify the PlusprofilTaggedValue. Should be identical to the key used in the ViewModels and string resource files.name
: The name used to identify the tagged value in Sparx Systems Enterprise Architect.hasMemoField
: Defines certain behaviour in the add-in, e.g. if line breaks are allowed, as well as how tagged value information is stored in Sparx Systems Enterprise Architect.manyMultiplicity
: Defines certain behaviour in the add-in, e.g. if more than one of the tagged value should be allowed to be created.
Note that it is possible to define multiple PlusprofilTaggedValue
with a similar Name
but different Key
, allowing tagged value behaviour to vary depending on object type by using a different Key
.
In the PlusprofilTaggedValueDefinitions.Definitions
initialization, find the PlusprofilTaggedValue
to modify, either by Name
, their expected name in Sparx Systems Enterprise Architect, or Key
, the key used to identify them in the add-in. The behaviour that can be modified in the constructor is:
key
: The key used to identify the PlusprofilTaggedValue. Should be identical to the key used in the ViewModels and string resource files.name
: The name used to identify the tagged value in Sparx Systems Enterprise Architect.hasMemoField
: Defines certain behaviour in the add-in, e.g. if line breaks are allowed, as well as how tagged value information is stored in Sparx Systems Enterprise Architect.manyMultiplicity
: Defines certain behaviour in the add-in, e.g. if more than one of the tagged value should be allowed to be created.
- Open the relevant resource file, e.g.
PlusprofilAddin\Resources\StringResources.dk-DK.xaml
for Danish orPlusprofilAddin\Resources\StringResources.en-US.xaml
for English. - Find the string value with the key of the PlusprofilTaggedValue to modify.
- Modify the value of the string.
-
Create a new file
StringResources.xx-XX.xaml
, wherexx-XX
is the .NET Language Culture Name, e.g.nl-NL
for Dutch - The Netherlands. -
In the new file, add a new
ResourceDictionary
, i.e.:
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib"/>
-
Create a new
<system:String/>
in theResourceDictionary
for each string to translate. Ensure that thex:Key
corresponds to the key used in the relevant UI element orPlusprofilTaggedValue
. -
Open
PlusprofilAddin.MainClass
, found inPlusprofilAddin\MainClass.cs
.-
Add a field
private const string XMenuOption = "&Open X Editing Window"
, where X is the language to add.Example:
private const string DutchMenuOption = "&Open Dutch Editing Window;
to add a menu option for dutch
-
In
MainClass.EA_GetMenuitems(..)
, add the newly added field tostring[] subMenus
.Example:
string[] subMenus = {DanishMenuOption, EnglishMenuOption, DutchMenuOption};
to add the Dutch option to the menu.
-
In the
itemName
switch statement ofMainClass.EA_MenuClick(..)
, add a new case for the newly added menu option.Example:
case DutchMenuOption: dict.Source = new Uri("pack://application:,,,/PlusprofilAddin;component/Resources/StringResources.nl-NL.xaml", UriKind.Absolute); break;
to add an option for the menu option
DutchMenuOption
, using the fileStringResources.nl-NL.xaml
.
-
-
Consider adding a hotkey for the new language
-
Open the code-behind for
PlusprofilAddin.HotkeyForm
, found inPlusprofilAddin\HotkeyForm.cs
. -
In the try-catch statement of the constructor, add a statement
keyboardHook.RegisterHotKey(parameters)
, using the desired combination of keys and modifier keys as parameters.Example:
keyboardHook.RegisterHotKey(PlusprofilAddin.ModifierKeys.Control | PlusprofilAddin.ModifierKeys.Shift, Keys.Q)
registers the hotkey CTRL + SHIFT + Q.
-
In the switch case of the event handler
KeyboardHook_KeyPressed(object sender, KeyPressedEventArgs e)
, add a case for the previously used combination of keys.Example:
case Keys.Q when e.Modifier == PlusprofilAdd.ModifierKeys.Control | PlusprofilAdd.ModifierKeys.Shift: foo(); break;
calls the function
foo()
when CTRL + SHIFT + Q is pressed.
- Mathias Enggrob Boon - Boonoboo
- Sebastian Esp Nielsen - (https://github.com/SebastianEsp)
This project is licensed under the GNU General License v3.0.