private void RegisterAddInAsWindow() { try { _gui = _rep.AddTab(hoAddinTemplateGui.Gui.TabName, hoAddinTemplateGui.Gui.ProgId); if (_gui == null) { MessageBox.Show($"TabName:'{hoAddinTemplateGui.Gui.TabName}'\r\nProgId:'{hoAddinTemplateGui.Gui.ProgId}'", "Can't install Add-In 'hoAddinTemplate' as Window"); } ; } catch (Exception e) { MessageBox.Show($"TabName:'{hoAddinTemplateGui.Gui.TabName}'\r\nProgId:'{hoAddinTemplateGui.Gui.ProgId}'\r\n\r\n{e}", "Can't show Add-In 'hoAddinTemplate' in EA."); throw; } }
//Called when user makes a selection in the menu. //This is your main exit point to the rest of your Add-in public void EA_MenuClick(EA.Repository Repository, string Location, string MenuName, string ItemName) { try { EA.Package SelectedPackage = Repository.GetTreeSelectedPackage(); switch (ItemName) { case "Import R1.1": new R11Importer().import(Repository, SelectedPackage); break; case "Import R2": new R2Importer().import(Repository, SelectedPackage); break; case "Validate": new R2Validator().validate(Repository, SelectedPackage); break; case "Update Style": UpdateStyle_recurseEaPackage(SelectedPackage); break; case "Edit Profile": new ProfilingForm().Show(Repository, SelectedPackage); break; case "Compile Profile": CompileProfile(Repository, SelectedPackage); break; case "Merge Profiles": new MergeProfilesForm().PopulateAndShow(); break; case "Create Diagram": CreateDiagram(Repository); break; case "Quick Access Tab": if (view_ctrl == null || !view_ctrl.Visible) { if (view_ctrl != null) { // if control removed dispose old instance view_ctrl.Dispose(); } view_ctrl = (QuickAccessControl)Repository.AddTab("HL7 FM", "HL7_FM_EA_Extension.QuickAccessControl"); view_ctrl.SetRepository(Repository); Repository.ActivateTab("HL7 FM"); } break; case "FM Browser Tab": if (mb_ctrl == null || !mb_ctrl.Visible) { if (mb_ctrl != null) { // if control removed dispose old instance mb_ctrl.Dispose(); } mb_ctrl = (ModelBrowserControl)Repository.AddTab("FM Browser", "HL7_FM_EA_Extension.ModelBrowserControl"); mb_ctrl.SetRepository(Repository); Repository.ActivateTab("FM Browser"); } break; case "About": AboutBox about = new AboutBox(); about.ShowDialog(); break; } } catch (Exception e) { EAHelper.LogMessage(e.ToString()); MessageBox.Show(e.ToString(), "FATAL", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public object AddTab(string TabName, string ControlID) { return(eaRepository.AddTab(TabName, ControlID)); }
//Called when user makes a selection in the menu. //This is your main exit point to the rest of your Add-in public void EA_MenuClick(EA.Repository Repository, string Location, string MenuName, string ItemName) { try { EA.Package selectedPackage = Repository.GetTreeSelectedPackage(); switch (ItemName) { case "Import": Repository.CreateOutputTab(MAX_TABNAME); Repository.ClearOutput(MAX_TABNAME); if (new Filters().import(Repository, selectedPackage)) { // only popup when there were any issues Repository.EnsureOutputVisible(MAX_TABNAME); } break; case "Import NoDelRel": Repository.CreateOutputTab(MAX_TABNAME); Repository.ClearOutput(MAX_TABNAME); if (new Filters().import(Repository, selectedPackage, false)) { // only popup when there were any issues Repository.EnsureOutputVisible(MAX_TABNAME); } break; case "Export": Repository.CreateOutputTab(MAX_TABNAME); Repository.ClearOutput(MAX_TABNAME); if (new Filters().export(Repository)) { // only popup when there were any issues Repository.EnsureOutputVisible(MAX_TABNAME); } break; case "Filters": // TODO: create Config Filters Dialogs MessageBox.Show("NYI"); break; case "Transform": Repository.CreateOutputTab(MAX_TABNAME); Repository.ClearOutput(MAX_TABNAME); if (new TransformParamsForm().Show(Repository)) { // only popup when there were any issues Repository.EnsureOutputVisible(MAX_TABNAME); } break; case "Validate": Repository.CreateOutputTab(MAX_TABNAME); Repository.ClearOutput(MAX_TABNAME); if (new ValidateParamsForm().Show(Repository)) { // only popup when there were any issues Repository.EnsureOutputVisible(MAX_TABNAME); } break; case "Merge Diagrams": mergeDiagrams(Repository, selectedPackage); break; case "Lock": setLocked(selectedPackage, true); break; case "Unlock": setLocked(selectedPackage, false); break; case "Batch": batch(Repository); break; case "Quick Access Tab": if (view_ctrl == null || !view_ctrl.Visible) { if (view_ctrl != null) { // if control removed dispose old instance view_ctrl.Dispose(); } view_ctrl = (QuickAccessControl)Repository.AddTab(MAX_TABNAME, "MAX_EA_Extension.QuickAccessControl"); view_ctrl.SetRepository(Repository); Repository.ActivateTab(MAX_TABNAME); } break; case "About...": AboutBox about = new AboutBox(); about.ShowDialog(); break; } } catch (Exception e) { MessageBox.Show(e.ToString()); } }