/// <summary> /// Copy the commit Sha. /// </summary> public override void Execute() { Project project = App.Instance.SalesForceApp.CurrentProject; SimpleRepositoryCommit commit = GetSelectedCommit(); if (project != null && commit != null) { Clipboard.SetText(commit.Sha); } }
/// <summary> /// Open the commit. /// </summary> public override void Execute() { Project project = App.Instance.SalesForceApp.CurrentProject; SimpleRepositoryCommit commit = GetSelectedCommit(); CommitListDocument document = App.Instance.Content.ActiveDocument as CommitListDocument; if (project != null && commit != null && document != null) { string text = null; using (App.Wait("Getting older version.")) text = project.Repository.GetContent(document.File, commit); string title = String.Format("{0} [{1}]", document.File.Name, commit.ShaShort); TextViewDocument doc = new TextViewDocument(project, text, title, "History.png", false); App.Instance.Content.OpenDocument(doc); } }
/// <summary> /// Open the commit. /// </summary> public override void Execute() { Project project = App.Instance.SalesForceApp.CurrentProject; SimpleRepositoryCommit commit = GetSelectedCommit(); string detail = GetSelectedDetail(); CommitListDocument document = App.Instance.Content.ActiveDocument as CommitListDocument; if (project != null && commit != null && detail != null && document != null) { string text = null; using (App.Wait("Getting older version.")) text = project.Repository.GetChangedFileDiff(detail, commit); string title = detail; TextViewDocument doc = new TextViewDocument(project, text, title, "Compare.png", true); App.Instance.Content.OpenDocument(doc); } }
/// <summary> /// Set the header based on the currently selected commits. /// </summary> /// <param name="host">The type of host.</param> /// <param name="presenter">The presenter to use.</param> public override void Update(FunctionHost host, IFunctionPresenter presenter) { SimpleRepositoryCommit commit = GetSelectedCommit(); if (host == FunctionHost.Toolbar) { presenter.Header = VisualHelper.CreateIconHeader(null, "Empty.png"); presenter.ToolTip = "Open"; } else { presenter.Header = "Open"; presenter.Icon = VisualHelper.CreateIconHeader(null, "Empty.png"); } IsVisible = (App.Instance.SalesForceApp.CurrentProject != null && App.Instance.Content.ActiveDocument is CommitListDocument); IsEnabled = (commit != null); }