@@ -6,6 +6,7 @@ FindOptions = require './find-options'
6
6
BufferSearch = require ' ./buffer-search'
7
7
FileIcons = require ' ./file-icons'
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'
@@ -35,39 +36,48 @@ module.exports =
35
36
else
36
37
@findModel .setEditor (null )
37
38
38
- @subscriptions .add atom .commands .add ' .find-and-replace, .project-find' , ' window:focus-next-pane' , ->
39
+ @subscriptions .add atom .commands .add ' .find-and-replace, .open-files-find, . project-find' , ' window:focus-next-pane' , ->
39
40
atom .views .getView (atom .workspace ).focus ()
40
41
42
+ @subscriptions .add atom .commands .add ' atom-workspace' , ' open-files-find:show' , =>
43
+ @ createViews ()
44
+ showPanel @openFilesFindPanel , => @openFilesFindView .focusFindElement ()
45
+
46
+ @subscriptions .add atom .commands .add ' atom-workspace' , ' open-files-find:toggle' , =>
47
+ @ createViews ()
48
+ togglePanel @openFilesFindPanel , => @openFilesFindView .focusFindElement ()
49
+
41
50
@subscriptions .add atom .commands .add ' atom-workspace' , ' project-find:show' , =>
42
51
@ createViews ()
43
- showPanel @projectFindPanel , @findPanel , => @projectFindView .focusFindElement ()
52
+ showPanel @projectFindPanel , => @projectFindView .focusFindElement ()
44
53
45
54
@subscriptions .add atom .commands .add ' atom-workspace' , ' project-find:toggle' , =>
46
55
@ createViews ()
47
- togglePanel @projectFindPanel , @findPanel , => @projectFindView .focusFindElement ()
56
+ togglePanel @projectFindPanel , => @projectFindView .focusFindElement ()
48
57
49
58
@subscriptions .add atom .commands .add ' atom-workspace' , ' project-find:show-in-current-directory' , ({target}) =>
50
59
@ createViews ()
51
60
@findPanel .hide ()
61
+ @openFilesFindPanel .hide ()
52
62
@projectFindPanel .show ()
53
63
@projectFindView .focusFindElement ()
54
64
@projectFindView .findInCurrentlySelectedDirectory (target)
55
65
56
66
@subscriptions .add atom .commands .add ' atom-workspace' , ' find-and-replace:use-selection-as-find-pattern' , =>
57
- return if @projectFindPanel ? .isVisible () or @findPanel ? .isVisible ()
67
+ return if @openFilesFindPanel ? . isVisible () or @ projectFindPanel? .isVisible () or @findPanel ? .isVisible ()
58
68
@ createViews ()
59
69
60
70
@subscriptions .add atom .commands .add ' atom-workspace' , ' find-and-replace:toggle' , =>
61
71
@ createViews ()
62
- togglePanel @findPanel , @projectFindPanel , => @findView .focusFindEditor ()
72
+ togglePanel @findPanel , => @findView .focusFindEditor ()
63
73
64
74
@subscriptions .add atom .commands .add ' atom-workspace' , ' find-and-replace:show' , =>
65
75
@ createViews ()
66
- showPanel @findPanel , @projectFindPanel , => @findView .focusFindEditor ()
76
+ showPanel @findPanel , => @findView .focusFindEditor ()
67
77
68
78
@subscriptions .add atom .commands .add ' atom-workspace' , ' find-and-replace:show-replace' , =>
69
79
@ createViews ()
70
- showPanel @findPanel , @projectFindPanel , => @findView .focusReplaceEditor ()
80
+ showPanel @findPanel , => @findView .focusReplaceEditor ()
71
81
72
82
@subscriptions .add atom .commands .add ' atom-workspace' , ' find-and-replace:clear-history' , =>
73
83
@findHistory .clear ()
@@ -78,6 +88,7 @@ module.exports =
78
88
isMiniEditor = target .tagName is ' ATOM-TEXT-EDITOR' and target .hasAttribute (' mini' )
79
89
unless isMiniEditor
80
90
@findPanel ? .hide ()
91
+ @openFilesFindPanel ? .hide ()
81
92
@projectFindPanel ? .hide ()
82
93
83
94
@subscriptions .add atom .commands .add ' atom-workspace' ,
@@ -93,13 +104,13 @@ module.exports =
93
104
@selectNextObjects .set (editor, selectNext)
94
105
selectNext
95
106
96
- showPanel = (panelToShow , panelToHide , postShowAction ) - >
97
- panelToHide . hide ()
107
+ showPanel = (panelToShow , postShowAction ) = >
108
+ @panels . map (p) => p . hide () unless p is panelToShow
98
109
panelToShow .show ()
99
110
postShowAction? ()
100
111
101
- togglePanel = (panelToToggle , panelToHide , postToggleAction ) - >
102
- panelToHide . hide ()
112
+ togglePanel = (panelToToggle , postToggleAction ) = >
113
+ @panels . map (p) => p . hide () unless p is panelToToggle
103
114
104
115
if panelToToggle .isVisible ()
105
116
panelToToggle .hide ()
@@ -159,13 +170,16 @@ module.exports =
159
170
options = {findBuffer, replaceBuffer, pathsBuffer, findHistoryCycler, replaceHistoryCycler, pathsHistoryCycler}
160
171
161
172
@findView = new FindView (@findModel , options)
162
-
173
+ @openFilesFindView = new OpenFilesFindView ( @resultsModel , options)
163
174
@projectFindView = new ProjectFindView (@resultsModel , options)
164
175
165
176
@findPanel = atom .workspace .addBottomPanel (item : @findView , visible : false , className : ' tool-panel panel-bottom' )
177
+ @openFilesFindPanel = atom .workspace .addBottomPanel (item : @openFilesFindView , visible : false , className : ' tool-panel panel-bottom' )
166
178
@projectFindPanel = atom .workspace .addBottomPanel (item : @projectFindView , visible : false , className : ' tool-panel panel-bottom' )
179
+ @panels = [@findPanel , @openFilesFindPanel , @projectFindPanel ]
167
180
168
181
@findView .setPanel (@findPanel )
182
+ @openFilesFindView .setPanel (@openFilesFindPanel )
169
183
@projectFindView .setPanel (@projectFindPanel )
170
184
171
185
# HACK: Soooo, we need to get the model to the pane view whenever it is
@@ -191,6 +205,11 @@ module.exports =
191
205
@findModel ? .destroy ()
192
206
@findModel = null
193
207
208
+ @openFilesFindPanel ? .destroy ()
209
+ @openFilesFindPanel = null
210
+ @openFilesFindView ? .destroy ()
211
+ @openFilesFindView = null
212
+
194
213
@projectFindPanel ? .destroy ()
195
214
@projectFindPanel = null
196
215
@projectFindView ? .destroy ()
0 commit comments