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; } }
/// Creates a model connecting to the first running instance of EA public Model() { object obj = Marshal.GetActiveObject("EA.App"); global::EA.App eaApp = obj as global::EA.App; wrappedModel = eaApp.Repository; }
bool IsProjectOpen(global::EA.Repository Repository) { try { if (Repository.Models != null) { return(true); } } catch {} return(false); }
/// <summary> /// Execute the actual functions /// </summary> /// <param name="Repository">the repository</param> /// <param name="Location">menu location</param> /// <param name="MenuName">menu name</param> /// <param name="ItemName">option clicked</param> public override void EA_MenuClick(global::EA.Repository Repository, String Location, String MenuName, String ItemName) { switch (ItemName) { case menuFQN: this.selectFQN(); break; case menuGUID: this.selectGUID(); break; case menuAbout: new AboutWindow().ShowDialog(); break; case menuSettings: new NavigatorSettingsForm(this.settings).ShowDialog(); //we need to set the toolbar in case that setting was changed if (this.navigatorControl != null) { this.navigatorControl.toolbarVisible = this.settings.toolbarVisible; } break; case menuOpenInNavigator: this.navigate(); break; default: UML.UMLItem selectedItem = this.model.selectedItem; if (selectedItem != null) { List <UML.UMLItem> elementsToNavigate = this.getElementsToNavigate(ItemName, selectedItem); if (elementsToNavigate.Count == 1) { elementsToNavigate[0].open(); } else if (elementsToNavigate.Count > 1) { NavigatorList dialog = new NavigatorList(elementsToNavigate, selectedItem); dialog.Show(); } else { string message = selectedItem.name + " does not have any " + ItemName.Replace("&", string.Empty); MessageBox.Show(message, "Nothing to navigate", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } break; } }
public void EA_MenuClick( global::EA.Repository Repository, String Location, String MenuName, String ItemName ) { this.repository = Repository; switch(ItemName) { case menuCopy : this.copy(); break; case menuExport : this.export(); break; case menuImport : this.import(); break; case menuSync : this.synchronize(); break; } }
public object EA_GetMenuItems(global::EA.Repository Repository, String Location, String MenuName) { switch (MenuName) { case "": return(menuHeader); case menuHeader: string[] ar = { menuCopy, menuExport, menuImport, menuSync }; return(ar); } return(""); }
public void EA_MenuClick(global::EA.Repository Repository, String Location, String MenuName, String ItemName) { this.repository = Repository; switch (ItemName) { case menuCopy: this.copy(); break; case menuExport: this.export(); break; case menuImport: this.import(); break; case menuSync: this.synchronize(); break; } }
/// <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); } }
/// constructor creates EAModel based on the given repository public Model(global::EA.Repository eaRepository) { wrappedModel = eaRepository; }
public String EA_Connect(global::EA.Repository Repository) { return("a string"); }
/// <summary> /// (re)initialises this model with the given ea repository object /// </summary> /// <param name="eaRepository">the ea repository object</param> public void initialize(global::EA.Repository eaRepository) { wrappedModel = eaRepository; }