Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

♿️ Restore platform-centric menu names for showing in file manager #1311

Merged
merged 2 commits into from Apr 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 11 additions & 2 deletions lib/tree-view.coffee
Expand Up @@ -560,13 +560,22 @@ class TreeView
return unless filePath = @selectedEntry()?.getPath()

unless shell.showItemInFolder(filePath)
atom.notifications.addWarning("Unable to show #{filePath} in file manager")
atom.notifications.addWarning("Unable to show #{filePath} in #{@getFileManagerName()}")

showCurrentFileInFileManager: ->
return unless filePath = atom.workspace.getCenter().getActiveTextEditor()?.getPath()

unless shell.showItemInFolder(filePath)
atom.notifications.addWarning("Unable to show #{filePath} in file manager")
atom.notifications.addWarning("Unable to show #{filePath} in #{@getFileManagerName()}")

getFileManagerName: ->
switch process.platform
when 'darwin'
return 'Finder'
when 'win32'
return 'Explorer'
else
return 'File Manager'

openSelectedEntryInNewWindow: ->
if pathToOpen = @selectedEntry()?.getPath()
Expand Down
34 changes: 32 additions & 2 deletions menus/tree-view.cson
Expand Up @@ -39,7 +39,6 @@
{'label': 'Copy Full Path', 'command': 'tree-view:copy-full-path'}
{'label': 'Copy Project Path', 'command': 'tree-view:copy-project-path'}
{'label': 'Open in New Window', 'command': 'tree-view:open-in-new-window'}
{'label': 'Show in File Manager', 'command': 'tree-view:show-in-file-manager'}
]

'.tree-view .full-menu [is="tree-view-file"]': [
Expand Down Expand Up @@ -73,6 +72,18 @@
{'label': 'Open in New Window', 'command': 'tree-view:open-in-new-window'}
]

'.platform-darwin .tree-view .full-menu': [
{'label': 'Reveal in Finder', 'command': 'tree-view:show-in-file-manager'}
]

'.platform-win32 .tree-view .full-menu': [
{'label': 'Show in Explorer', 'command': 'tree-view:show-in-file-manager'}
]

'.platform-linux .tree-view .full-menu': [
{'label': 'Show in File Manager', 'command': 'tree-view:show-in-file-manager'}
]

'.tree-view .multi-select': [
{'label': 'Delete', 'command': 'tree-view:remove'}
{'label': 'Copy', 'command': 'tree-view:copy'}
Expand All @@ -87,9 +98,28 @@
'atom-pane[data-active-item-path] .tab.active': [
{'label': 'Rename', 'command': 'tree-view:rename'}
{'label': 'Reveal in Tree View', 'command': 'tree-view:reveal-active-file'}
]

'.platform-darwin atom-pane[data-active-item-path] .tab.active': [
{'label': 'Reveal In Finder', 'command': 'tree-view:show-current-file-in-file-manager'}
]

'.platform-win32 atom-pane[data-active-item-path] .tab.active': [
{'label': 'Show In Explorer', 'command': 'tree-view:show-current-file-in-file-manager'}
]

'.platform-linux atom-pane[data-active-item-path] .tab.active': [
{'label': 'Show in File Manager', 'command': 'tree-view:show-current-file-in-file-manager'}
]

'atom-text-editor:not([mini])': [
'.platform-darwin atom-text-editor:not([mini])': [
{'label': 'Reveal In Finder', 'command': 'tree-view:show-current-file-in-file-manager'}
]

'.platform-win32 atom-text-editor:not([mini])': [
{'label': 'Show In Explorer', 'command': 'tree-view:show-current-file-in-file-manager'}
]

'.platform-linux atom-text-editor:not([mini])': [
{'label': 'Show in File Manager', 'command': 'tree-view:show-current-file-in-file-manager'}
]