@@ -6,6 +6,7 @@ FindOptions = require './find-options'
6
6
BufferSearch = require ' ./buffer-search'
7
7
getIconServices = require ' ./get-icon-services'
8
8
FindView = require ' ./find-view'
9
+ OpenFilesFindView = require ' ./open-files-find-view'
9
10
ProjectFindView = require ' ./project-find-view'
10
11
ResultsModel = require ' ./project/results-model'
11
12
ResultsPaneView = require ' ./project/results-pane'
@@ -49,26 +50,35 @@ module.exports =
49
50
else
50
51
@findModel .setEditor (null )
51
52
52
- @subscriptions .add atom .commands .add ' .find-and-replace, .project-find' , ' window:focus-next-pane' , ->
53
+ @subscriptions .add atom .commands .add ' .find-and-replace, .open-files-find, . project-find' , ' window:focus-next-pane' , ->
53
54
atom .views .getView (atom .workspace ).focus ()
54
55
56
+ @subscriptions .add atom .commands .add ' atom-workspace' , ' open-files-find:show' , =>
57
+ @ createViews ()
58
+ showPanel @openFilesFindPanel , => @openFilesFindView .focusFindElement ()
59
+
60
+ @subscriptions .add atom .commands .add ' atom-workspace' , ' open-files-find:toggle' , =>
61
+ @ createViews ()
62
+ togglePanel @openFilesFindPanel , => @openFilesFindView .focusFindElement ()
63
+
55
64
@subscriptions .add atom .commands .add ' atom-workspace' , ' project-find:show' , =>
56
65
@ createViews ()
57
- showPanel @projectFindPanel , @findPanel , => @projectFindView .focusFindElement ()
66
+ showPanel @projectFindPanel , => @projectFindView .focusFindElement ()
58
67
59
68
@subscriptions .add atom .commands .add ' atom-workspace' , ' project-find:toggle' , =>
60
69
@ createViews ()
61
- togglePanel @projectFindPanel , @findPanel , => @projectFindView .focusFindElement ()
70
+ togglePanel @projectFindPanel , => @projectFindView .focusFindElement ()
62
71
63
72
@subscriptions .add atom .commands .add ' atom-workspace' , ' project-find:show-in-current-directory' , ({target}) =>
64
73
@ createViews ()
65
74
@findPanel .hide ()
75
+ @openFilesFindPanel .hide ()
66
76
@projectFindPanel .show ()
67
77
@projectFindView .focusFindElement ()
68
78
@projectFindView .findInCurrentlySelectedDirectory (target)
69
79
70
80
@subscriptions .add atom .commands .add ' atom-workspace' , ' find-and-replace:use-selection-as-find-pattern' , =>
71
- return if @projectFindPanel ? .isVisible () or @findPanel ? .isVisible ()
81
+ return if @openFilesFindPanel ? . isVisible () or @ projectFindPanel? .isVisible () or @findPanel ? .isVisible ()
72
82
@ createViews ()
73
83
74
84
@subscriptions .add atom .commands .add ' atom-workspace' , ' find-and-replace:use-selection-as-replace-pattern' , =>
@@ -77,15 +87,15 @@ module.exports =
77
87
78
88
@subscriptions .add atom .commands .add ' atom-workspace' , ' find-and-replace:toggle' , =>
79
89
@ createViews ()
80
- togglePanel @findPanel , @projectFindPanel , => @findView .focusFindEditor ()
90
+ togglePanel @findPanel , => @findView .focusFindEditor ()
81
91
82
92
@subscriptions .add atom .commands .add ' atom-workspace' , ' find-and-replace:show' , =>
83
93
@ createViews ()
84
- showPanel @findPanel , @projectFindPanel , => @findView .focusFindEditor ()
94
+ showPanel @findPanel , => @findView .focusFindEditor ()
85
95
86
96
@subscriptions .add atom .commands .add ' atom-workspace' , ' find-and-replace:show-replace' , =>
87
97
@ createViews ()
88
- showPanel @findPanel , @projectFindPanel , => @findView .focusReplaceEditor ()
98
+ showPanel @findPanel , => @findView .focusReplaceEditor ()
89
99
90
100
@subscriptions .add atom .commands .add ' atom-workspace' , ' find-and-replace:clear-history' , =>
91
101
@findHistory .clear ()
@@ -96,6 +106,7 @@ module.exports =
96
106
isMiniEditor = target .tagName is ' ATOM-TEXT-EDITOR' and target .hasAttribute (' mini' )
97
107
unless isMiniEditor
98
108
@findPanel ? .hide ()
109
+ @openFilesFindPanel ? .hide ()
99
110
@projectFindPanel ? .hide ()
100
111
101
112
@subscriptions .add atom .commands .add ' atom-workspace' ,
@@ -111,13 +122,13 @@ module.exports =
111
122
@selectNextObjects .set (editor, selectNext)
112
123
selectNext
113
124
114
- showPanel = (panelToShow , panelToHide , postShowAction ) - >
115
- panelToHide . hide ()
125
+ showPanel = (panelToShow , postShowAction ) = >
126
+ @panels . map (p) => p . hide () unless p is panelToShow
116
127
panelToShow .show ()
117
128
postShowAction? ()
118
129
119
- togglePanel = (panelToToggle , panelToHide , postToggleAction ) - >
120
- panelToHide . hide ()
130
+ togglePanel = (panelToToggle , postToggleAction ) = >
131
+ @panels . map (p) => p . hide () unless p is panelToToggle
121
132
122
133
if panelToToggle .isVisible ()
123
134
panelToToggle .hide ()
@@ -187,13 +198,16 @@ module.exports =
187
198
options = {findBuffer, replaceBuffer, pathsBuffer, findHistoryCycler, replaceHistoryCycler, pathsHistoryCycler}
188
199
189
200
@findView = new FindView (@findModel , options)
190
-
201
+ @openFilesFindView = new OpenFilesFindView ( @resultsModel , options)
191
202
@projectFindView = new ProjectFindView (@resultsModel , options)
192
203
193
204
@findPanel = atom .workspace .addBottomPanel (item : @findView , visible : false , className : ' tool-panel panel-bottom' )
205
+ @openFilesFindPanel = atom .workspace .addBottomPanel (item : @openFilesFindView , visible : false , className : ' tool-panel panel-bottom' )
194
206
@projectFindPanel = atom .workspace .addBottomPanel (item : @projectFindView , visible : false , className : ' tool-panel panel-bottom' )
207
+ @panels = [@findPanel , @openFilesFindPanel , @projectFindPanel ]
195
208
196
209
@findView .setPanel (@findPanel )
210
+ @openFilesFindView .setPanel (@openFilesFindPanel )
197
211
@projectFindView .setPanel (@projectFindPanel )
198
212
199
213
# HACK: Soooo, we need to get the model to the pane view whenever it is
@@ -219,6 +233,11 @@ module.exports =
219
233
@findModel ? .destroy ()
220
234
@findModel = null
221
235
236
+ @openFilesFindPanel ? .destroy ()
237
+ @openFilesFindPanel = null
238
+ @openFilesFindView ? .destroy ()
239
+ @openFilesFindView = null
240
+
222
241
@projectFindPanel ? .destroy ()
223
242
@projectFindPanel = null
224
243
@projectFindView ? .destroy ()
0 commit comments