Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: L.Krobot on March 13, 2015, 02:20:54 am
-
I have my own Add-In that shows the custom properties dialog instead of the standard (default one), but in some cases i need to show also the deafault one, directly from my Add-In form ....
how I can do this (which API I have to call) ???
thx, ljk
-
Check out Model.cs (https://github.com/GeertBellekens/Enterprise-Architect-Add-in-Framework/blob/master/EAAddinFramework/EAWrappers/Model.cs) in the Enterprise Architect Addin Framework (https://github.com/GeertBellekens/Enterprise-Architect-Add-in-Framework)
/// <summary>
/// opens the properties dialog for this item
/// </summary>
/// <param name="item">the item to open the properties dialog for</param>
public void openProperties(UML.UMLItem item)
{
//get the type string
string typeString = string.Empty;
int itemID = 0;
if (item is Package)
{
typeString = "PKG";
itemID = ((Package)item).packageID;
}
else if (item is ElementWrapper)
{
typeString = "ELM";
itemID = ((ElementWrapper)item).id;
}
else if (item is Attribute)
{
typeString = "ATT";
itemID = ((Attribute)item).id;
}
else if (item is Operation)
{
typeString = "OP";
itemID = ((Operation)item).id;
}
else if (item is Diagram)
{
typeString = "DGM";
itemID = ((Diagram)item).DiagramID;
}
// TODO: figure out how to open the properties dialog for a connector.
// else if (item is ConnectorWrapper)
// {
// //typeString = "CON";
// typeString = "MSG";
// itemID = ((ConnectorWrapper)item).id;
// }
//open the actual dialog
if (this.mainEAWindow != null
&& typeString != string.Empty
&& itemID != 0)
{
string ret = this.wrappedModel.CustomCommand("CFormCommandHelper", "ProcessCommand", "Dlg=" + typeString + ";id=" + itemID.ToString() + ";hwnd=" + this.mainEAWindow.Handle);
}
}
which needs
/// <summary>
/// the main EA window to use when opening properties dialogs
/// </summary>
public IWin32Window mainEAWindow
{
get
{
if //(true)
(this._mainEAWindow == null)
{
List<Process> allProcesses = new List<Process>( Process.GetProcesses());
Process proc = allProcesses.Find(pr => pr.ProcessName == "EA");
//if we don't find the process then we set the mainwindow to null
if (proc == null
|| proc.MainWindowHandle == null)
{
this._mainEAWindow = null;
}
else
{
//found it. Create new WindowWrapper
this._mainEAWindow = new WindowWrapper(proc.MainWindowHandle);
}
}
return this._mainEAWindow;
}
}
I still haven't found the key to use for the connector properties, so if anyone finds out...
Geert