mirror of
https://github.com/textmate/textmate.git
synced 2026-04-28 03:00:34 -04:00
Add “Show in Finder” context menu when no items are selected
When you control-click the empty part of the file browser and select “Show in Finder” a Finder window will open showing the currently selected folder. You can go about this other ways, but I find that this feature complements the already existing "New Folder" menu item in the no-items-selected context menu of the file browser. This patch is public domain.
This commit is contained in:
committed by
Allan Odgaard
parent
d7661fc7bb
commit
cca891d74c
@@ -553,8 +553,10 @@ static NSMutableSet* SymmetricDifference (NSMutableSet* aSet, NSMutableSet* anot
|
||||
|
||||
- (void)showSelectedEntriesInFinder:(id)sender
|
||||
{
|
||||
for(FSItem* item in self.selectedItems)
|
||||
[[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs:@[ item.url ]];
|
||||
NSArray* urls = self.selectedURLs;
|
||||
if(urls.count == 0 && [_url isFileURL])
|
||||
urls = @[ _url ];
|
||||
[[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs:urls];
|
||||
}
|
||||
|
||||
- (NSString*)parentForNewFolder
|
||||
@@ -687,6 +689,8 @@ static NSMutableSet* SymmetricDifference (NSMutableSet* aSet, NSMutableSet* anot
|
||||
{
|
||||
if([_url isFileURL])
|
||||
{
|
||||
[menu addItemWithTitle:@"Show in Finder" action:@selector(showSelectedEntriesInFinder:) keyEquivalent:@""];
|
||||
[menu addItem:[NSMenuItem separatorItem]];
|
||||
[menu addItemWithTitle:@"New Folder" action:@selector(newFolderInSelectedFolder:) keyEquivalent:@""];
|
||||
[menu addItemWithTitle:@"Add to Favorites" action:@selector(addSelectedEntriesToFavorites:) keyEquivalent:@""];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user