public void EA_GetMenuState(global::EA.Repository Repository, String Location, String MenuName, String ItemName, ref bool IsEnabled, ref bool IsChecked) { if (IsProjectOpen(Repository)) { Object selectedItem; global::EA.ObjectType selectedType = Repository.GetContextItem(out selectedItem); switch (ItemName) { case menuCopy: IsEnabled = selectedType == global::EA.ObjectType.otDiagram; break; case menuExport: IsEnabled = selectedType == global::EA.ObjectType.otDiagram; break; default: IsEnabled = false; break; } } else { // If no open project, disable all menu options IsEnabled = false; } }
/// <summary> /// the EA hook we use to show the selected element in the Navigator window /// </summary> /// <param name="Repository"></param> /// <param name="GUID"></param> /// <param name="ot"></param> public override void EA_OnContextItemChanged(global::EA.Repository Repository, string GUID, global::EA.ObjectType ot) { try { if (this.settings.trackSelectedElement) { this.navigate(); } } catch (Exception e) { //log debug information Logger.logFileName = System.IO.Path.GetTempPath() + "EANavigatorDebug.log"; Logger.logError(e.Message + " " + e.StackTrace); MessageBox.Show("Oops something went wrong! Please send the logfile at location: " + Environment.NewLine + Logger.logFileName + Environment.NewLine + "to [email protected] for further investigation" , "EA Navigator Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }