77} from '@jupyterlab/application' ;
88
99import {
10+ ICommandPalette ,
1011 IToolbarWidgetRegistry ,
1112 createToolbarFactory ,
1213 setToolbar ,
@@ -45,7 +46,6 @@ import { Menu, MenuBar } from '@lumino/widgets';
4546import { NotebookTreeWidget , INotebookTree } from '@jupyter-notebook/tree' ;
4647
4748import { FilesActionButtons } from './fileactions' ;
48- import { IStateDB } from '@jupyterlab/statedb' ;
4949
5050/**
5151 * The file browser factory.
@@ -64,6 +64,7 @@ namespace CommandIDs {
6464 // The command to activate the filebrowser widget in tree view.
6565 export const activate = 'filebrowser:activate' ;
6666
67+ // Activate the file filter in the file browser
6768 export const toggleFileFilter = 'filebrowser:toggle-file-filter' ;
6869}
6970
@@ -185,6 +186,24 @@ const fileActions: JupyterFrontEndPlugin<void> = {
185186 } ,
186187} ;
187188
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+
188207/**
189208 * Plugin to load the default plugins that are loaded on all the Notebook pages
190209 * (tree, edit, view, etc.) so they are visible in the settings editor.
@@ -278,7 +297,6 @@ const notebookTreeWidget: JupyterFrontEndPlugin<INotebookTree> = {
278297 ISettingRegistry ,
279298 IToolbarWidgetRegistry ,
280299 IFileBrowserFactory ,
281- IStateDB ,
282300 ] ,
283301 optional : [
284302 IRunningSessionManagers ,
@@ -294,7 +312,6 @@ const notebookTreeWidget: JupyterFrontEndPlugin<INotebookTree> = {
294312 settingRegistry : ISettingRegistry ,
295313 toolbarRegistry : IToolbarWidgetRegistry ,
296314 factory : IFileBrowserFactory ,
297- stateDB : IStateDB ,
298315 manager : IRunningSessionManagers | null ,
299316 settingEditorTracker : ISettingEditorTracker | null ,
300317 jsonSettingEditorTracker : IJSONSettingEditorTracker | null
@@ -402,6 +419,7 @@ const notebookTreeWidget: JupyterFrontEndPlugin<INotebookTree> = {
402419const plugins : JupyterFrontEndPlugin < any > [ ] = [
403420 createNew ,
404421 fileActions ,
422+ fileFilterCommand ,
405423 loadPlugins ,
406424 openFileBrowser ,
407425 notebookTreeWidget ,
0 commit comments