mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-11-01 13:13:21 -07:00
OpenSubmodule Method
This commit is contained in:
parent
fec2b402e0
commit
033fbc6383
1 changed files with 22 additions and 17 deletions
|
@ -1538,6 +1538,27 @@ namespace SourceGit.ViewModels
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OpenSubmodule(string submodule)
|
||||||
|
{
|
||||||
|
var root = Path.GetFullPath(Path.Combine(_fullpath, submodule));
|
||||||
|
var gitDir = new Commands.QueryGitDir(root).Result();
|
||||||
|
var repo = Preference.AddRepository(root, gitDir);
|
||||||
|
|
||||||
|
var node = new RepositoryNode()
|
||||||
|
{
|
||||||
|
Id = repo.FullPath,
|
||||||
|
Name = Path.GetFileName(repo.FullPath),
|
||||||
|
Bookmark = 0,
|
||||||
|
IsRepository = true,
|
||||||
|
};
|
||||||
|
|
||||||
|
var launcher = App.GetTopLevel().DataContext as Launcher;
|
||||||
|
if (launcher != null)
|
||||||
|
{
|
||||||
|
launcher.OpenRepositoryInTab(node, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public ContextMenu CreateContextMenuForSubmodule(string submodule)
|
public ContextMenu CreateContextMenuForSubmodule(string submodule)
|
||||||
{
|
{
|
||||||
var open = new MenuItem();
|
var open = new MenuItem();
|
||||||
|
@ -1545,23 +1566,7 @@ namespace SourceGit.ViewModels
|
||||||
open.Icon = App.CreateMenuIcon("Icons.Folder.Open");
|
open.Icon = App.CreateMenuIcon("Icons.Folder.Open");
|
||||||
open.Click += (o, ev) =>
|
open.Click += (o, ev) =>
|
||||||
{
|
{
|
||||||
var root = Path.GetFullPath(Path.Combine(_fullpath, submodule));
|
OpenSubmodule(submodule);
|
||||||
var gitDir = new Commands.QueryGitDir(root).Result();
|
|
||||||
var repo = Preference.AddRepository(root, gitDir);
|
|
||||||
var node = new RepositoryNode()
|
|
||||||
{
|
|
||||||
Id = repo.FullPath,
|
|
||||||
Name = Path.GetFileName(repo.FullPath),
|
|
||||||
Bookmark = 0,
|
|
||||||
IsRepository = true,
|
|
||||||
};
|
|
||||||
|
|
||||||
var launcher = App.GetTopLevel().DataContext as Launcher;
|
|
||||||
if (launcher != null)
|
|
||||||
{
|
|
||||||
launcher.OpenRepositoryInTab(node, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
ev.Handled = true;
|
ev.Handled = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue