7
7
} from '@jupyterlab/application' ;
8
8
9
9
import {
10
+ ICommandPalette ,
10
11
IToolbarWidgetRegistry ,
11
12
createToolbarFactory ,
12
13
setToolbar ,
@@ -45,7 +46,6 @@ import { Menu, MenuBar } from '@lumino/widgets';
45
46
import { NotebookTreeWidget , INotebookTree } from '@jupyter-notebook/tree' ;
46
47
47
48
import { FilesActionButtons } from './fileactions' ;
48
- import { IStateDB } from '@jupyterlab/statedb' ;
49
49
50
50
/**
51
51
* The file browser factory.
@@ -64,6 +64,7 @@ namespace CommandIDs {
64
64
// The command to activate the filebrowser widget in tree view.
65
65
export const activate = 'filebrowser:activate' ;
66
66
67
+ // Activate the file filter in the file browser
67
68
export const toggleFileFilter = 'filebrowser:toggle-file-filter' ;
68
69
}
69
70
@@ -185,6 +186,24 @@ const fileActions: JupyterFrontEndPlugin<void> = {
185
186
} ,
186
187
} ;
187
188
189
+ /**
190
+ * A plugin to add the file filter toggle command to the palette
191
+ */
192
+ const fileFilterCommand : JupyterFrontEndPlugin < void > = {
193
+ id : '@jupyter-notebook/tree-extension:file-filter-command' ,
194
+ description : 'A plugin to add file filter command to the palette.' ,
195
+ autoStart : true ,
196
+ optional : [ ICommandPalette ] ,
197
+ activate : ( app : JupyterFrontEnd , palette : ICommandPalette | null ) => {
198
+ if ( palette ) {
199
+ palette . addItem ( {
200
+ command : CommandIDs . toggleFileFilter ,
201
+ category : 'File Browser' ,
202
+ } ) ;
203
+ }
204
+ } ,
205
+ } ;
206
+
188
207
/**
189
208
* Plugin to load the default plugins that are loaded on all the Notebook pages
190
209
* (tree, edit, view, etc.) so they are visible in the settings editor.
@@ -278,7 +297,6 @@ const notebookTreeWidget: JupyterFrontEndPlugin<INotebookTree> = {
278
297
ISettingRegistry ,
279
298
IToolbarWidgetRegistry ,
280
299
IFileBrowserFactory ,
281
- IStateDB ,
282
300
] ,
283
301
optional : [
284
302
IRunningSessionManagers ,
@@ -294,7 +312,6 @@ const notebookTreeWidget: JupyterFrontEndPlugin<INotebookTree> = {
294
312
settingRegistry : ISettingRegistry ,
295
313
toolbarRegistry : IToolbarWidgetRegistry ,
296
314
factory : IFileBrowserFactory ,
297
- stateDB : IStateDB ,
298
315
manager : IRunningSessionManagers | null ,
299
316
settingEditorTracker : ISettingEditorTracker | null ,
300
317
jsonSettingEditorTracker : IJSONSettingEditorTracker | null
@@ -402,6 +419,7 @@ const notebookTreeWidget: JupyterFrontEndPlugin<INotebookTree> = {
402
419
const plugins : JupyterFrontEndPlugin < any > [ ] = [
403
420
createNew ,
404
421
fileActions ,
422
+ fileFilterCommand ,
405
423
loadPlugins ,
406
424
openFileBrowser ,
407
425
notebookTreeWidget ,
0 commit comments