mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-20 19:55:00 +00:00
refactor: rewrite external editor supports
* supported editors can be different on different platforms. * display founded editors only
This commit is contained in:
parent
bcb83af576
commit
111bf2966a
20 changed files with 417 additions and 220 deletions
|
@ -7,8 +7,6 @@ using Avalonia.Controls.Primitives;
|
|||
using Avalonia.Input;
|
||||
using Avalonia.Interactivity;
|
||||
|
||||
using SourceGit.ViewModels;
|
||||
|
||||
namespace SourceGit.Views
|
||||
{
|
||||
public class RepositorySubView : Border
|
||||
|
@ -63,6 +61,19 @@ namespace SourceGit.Views
|
|||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void OnOpenWithExternalEditor(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (sender is Button button && DataContext is ViewModels.Repository repo)
|
||||
{
|
||||
var menu = repo.CreateContextMenuForExternalEditors();
|
||||
if (menu != null)
|
||||
{
|
||||
menu.Open(button);
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnLocalBranchTreeLostFocus(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (sender is TreeView tree)
|
||||
|
@ -275,7 +286,7 @@ namespace SourceGit.Views
|
|||
|
||||
private void OnDoubleTappedLocalBranchNode(object sender, TappedEventArgs e)
|
||||
{
|
||||
if (!PopupHost.CanCreatePopup())
|
||||
if (!ViewModels.PopupHost.CanCreatePopup())
|
||||
return;
|
||||
|
||||
if (sender is Grid grid && DataContext is ViewModels.Repository repo)
|
||||
|
@ -287,7 +298,7 @@ namespace SourceGit.Views
|
|||
if (branch.IsCurrent)
|
||||
return;
|
||||
|
||||
PopupHost.ShowAndStartPopup(new ViewModels.Checkout(repo, branch.Name));
|
||||
ViewModels.PopupHost.ShowAndStartPopup(new ViewModels.Checkout(repo, branch.Name));
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue