forked from mirrors/NBTExplorer
Add Open in Explorer to context menu
This commit is contained in:
parent
2d70d2af10
commit
a03537bb99
3 changed files with 28 additions and 5 deletions
|
@ -729,8 +729,8 @@ namespace NBTExplorer.Controllers
|
||||||
ToolStripMenuItem itemExpandTree = new ToolStripMenuItem("Expand &Tree", null, _contextExpandTree_Click);
|
ToolStripMenuItem itemExpandTree = new ToolStripMenuItem("Expand &Tree", null, _contextExpandTree_Click);
|
||||||
|
|
||||||
menu.Items.AddRange(new ToolStripItem[] {
|
menu.Items.AddRange(new ToolStripItem[] {
|
||||||
itemCollapse, new ToolStripSeparator(), itemExpandChildren, itemExpandTree,
|
itemCollapse, new ToolStripSeparator(), itemExpandChildren, itemExpandTree,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ToolStripMenuItem itemExpand = new ToolStripMenuItem("&Expand", null, _contextExpand_Click);
|
ToolStripMenuItem itemExpand = new ToolStripMenuItem("&Expand", null, _contextExpand_Click);
|
||||||
|
@ -751,6 +751,14 @@ namespace NBTExplorer.Controllers
|
||||||
menu.Items.Add(itemDn);
|
menu.Items.Add(itemDn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (node is DirectoryDataNode) {
|
||||||
|
if (menu.Items.Count > 0)
|
||||||
|
menu.Items.Add(new ToolStripSeparator());
|
||||||
|
|
||||||
|
ToolStripMenuItem itemOpenExplorer = new ToolStripMenuItem("Open in E&xplorer", null, _contextOpenInExplorer_Click);
|
||||||
|
menu.Items.Add(itemOpenExplorer);
|
||||||
|
}
|
||||||
|
|
||||||
return (menu.Items.Count > 0) ? menu : null;
|
return (menu.Items.Count > 0) ? menu : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -791,6 +799,20 @@ namespace NBTExplorer.Controllers
|
||||||
MoveSelectionDown();
|
MoveSelectionDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void _contextOpenInExplorer_Click (object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (_multiTree.SelectedNode != null && _multiTree.SelectedNode.Tag is DirectoryDataNode) {
|
||||||
|
DirectoryDataNode ddNode = _multiTree.SelectedNode.Tag as DirectoryDataNode;
|
||||||
|
try {
|
||||||
|
string path = (!Interop.IsWindows ? "file://" : "") + ddNode.NodeDirPath;
|
||||||
|
System.Diagnostics.Process.Start(path);
|
||||||
|
}
|
||||||
|
catch (Exception ex) {
|
||||||
|
MessageBox.Show(ex.Message, "Can't open directory", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#region Capability Checking
|
#region Capability Checking
|
||||||
|
|
||||||
#region Capability Predicates
|
#region Capability Predicates
|
||||||
|
|
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("2.6.1.0")]
|
[assembly: AssemblyVersion("2.6.2.0")]
|
||||||
[assembly: AssemblyFileVersion("2.6.1.0")]
|
[assembly: AssemblyFileVersion("2.6.2.0")]
|
||||||
|
|
|
@ -121,7 +121,8 @@ namespace NBTExplorer.Windows
|
||||||
if (_nodeTree.SelectedNode.Tag is DirectoryDataNode) {
|
if (_nodeTree.SelectedNode.Tag is DirectoryDataNode) {
|
||||||
DirectoryDataNode ddNode = _nodeTree.SelectedNode.Tag as DirectoryDataNode;
|
DirectoryDataNode ddNode = _nodeTree.SelectedNode.Tag as DirectoryDataNode;
|
||||||
try {
|
try {
|
||||||
System.Diagnostics.Process.Start(ddNode.NodeDirPath);
|
string path = (!Interop.IsWindows ? "file://" : "") + ddNode.NodeDirPath;
|
||||||
|
System.Diagnostics.Process.Start(path);
|
||||||
} catch (Win32Exception ex) {
|
} catch (Win32Exception ex) {
|
||||||
MessageBox.Show(ex.Message, "Can't open directory", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show(ex.Message, "Can't open directory", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue