public override void OnExecute(CommandEventArgs e) { IAnkhPackage package = e.Context.GetService <IAnkhPackage>(); AnkhToolWindow toolWindow; switch (e.Command) { case AnkhCommand.ShowPendingChanges: toolWindow = AnkhToolWindow.PendingChanges; break; case AnkhCommand.ShowWorkingCopyExplorer: toolWindow = AnkhToolWindow.WorkingCopyExplorer; break; case AnkhCommand.ShowRepositoryExplorer: toolWindow = AnkhToolWindow.RepositoryExplorer; break; case AnkhCommand.ShowSubversionInfo: toolWindow = AnkhToolWindow.SvnInfo; break; default: return; } package.ShowToolWindow(toolWindow); if (e.Command == AnkhCommand.ShowRepositoryExplorer) { IAnkhSolutionSettings ss = e.GetService <IAnkhSolutionSettings>(); if (ss.ProjectRootUri != null) { RepositoryExplorerControl ctrl = e.Selection.ActiveDialogOrFrameControl as RepositoryExplorerControl; if (ctrl != null) { ctrl.AddRoot(ss.ProjectRootUri); } } } }
public void OnExecute(CommandEventArgs e) { Uri info; if (e.Argument is string) { string arg = (string)e.Argument; info = null; if (SvnItem.IsValidPath(arg, true)) { SvnItem item = e.GetService <ISvnStatusCache>()[arg]; if (item.IsVersioned) { info = item.Uri; if (item.IsFile) { info = new Uri(info, "./"); } } } if (info == null) { info = new Uri((string)e.Argument); } } else if (e.Argument is Uri) { info = (Uri)e.Argument; } else { using (RepositorySelectionWizard wizard = new RepositorySelectionWizard(e.Context)) { if (wizard.ShowDialog(e.Context) != DialogResult.OK) { return; } info = wizard.GetSelectedRepositoryUri(); } } if (info != null) { RepositoryExplorerControl ctrl = e.Selection.ActiveDialogOrFrameControl as RepositoryExplorerControl; if (ctrl == null) { IAnkhPackage pkg = e.GetService <IAnkhPackage>(); pkg.ShowToolWindow(AnkhToolWindow.RepositoryExplorer); } ctrl = e.Selection.ActiveDialogOrFrameControl as RepositoryExplorerControl; if (ctrl != null) { ctrl.AddRoot(info); } } }