@@ -27,11 +27,12 @@ import { ITranslator } from '@jupyterlab/translation';
2727import {
2828 caretDownIcon ,
2929 folderIcon ,
30- runningIcon ,
31- TabBarSvg
30+ runningIcon
3231} from '@jupyterlab/ui-components' ;
3332
34- import { Menu , MenuBar , TabPanel } from '@lumino/widgets' ;
33+ import { Menu , MenuBar } from '@lumino/widgets' ;
34+
35+ import { NotebookTreeWidget , INotebookTree } from '@jupyter-notebook/tree' ;
3536
3637/**
3738 * The file browser factory.
@@ -94,9 +95,9 @@ const createNew: JupyterFrontEndPlugin<void> = {
9495} ;
9596
9697/**
97- * A plugin to add the file browser widget to an ILabShell
98+ * A plugin to add the file browser widget to an INotebookShell
9899 */
99- const browserWidget : JupyterFrontEndPlugin < void > = {
100+ const notebookTreeWidget : JupyterFrontEndPlugin < INotebookTree > = {
100101 id : '@jupyter-notebook/tree-extension:widget' ,
101102 requires : [
102103 IFileBrowserFactory ,
@@ -106,20 +107,16 @@ const browserWidget: JupyterFrontEndPlugin<void> = {
106107 ] ,
107108 optional : [ IRunningSessionManagers ] ,
108109 autoStart : true ,
110+ provides : INotebookTree ,
109111 activate : (
110112 app : JupyterFrontEnd ,
111113 factory : IFileBrowserFactory ,
112114 translator : ITranslator ,
113115 settingRegistry : ISettingRegistry ,
114116 toolbarRegistry : IToolbarWidgetRegistry ,
115117 manager : IRunningSessionManagers | null
116- ) : void => {
117- const tabPanel = new TabPanel ( {
118- tabPlacement : 'top' ,
119- tabsMovable : true ,
120- renderer : TabBarSvg . defaultRenderer
121- } ) ;
122- tabPanel . addClass ( 'jp-TreePanel' ) ;
118+ ) : INotebookTree => {
119+ const nbTreeWidget = new NotebookTreeWidget ( ) ;
123120
124121 const trans = translator . load ( 'notebook' ) ;
125122
@@ -129,8 +126,8 @@ const browserWidget: JupyterFrontEndPlugin<void> = {
129126 browser . node . setAttribute ( 'aria-label' , trans . __ ( 'File Browser Section' ) ) ;
130127 browser . title . icon = folderIcon ;
131128
132- tabPanel . addWidget ( browser ) ;
133- tabPanel . tabBar . addTab ( browser . title ) ;
129+ nbTreeWidget . addWidget ( browser ) ;
130+ nbTreeWidget . tabBar . addTab ( browser . title ) ;
134131
135132 // Toolbar
136133 toolbarRegistry . addFactory (
@@ -150,7 +147,7 @@ const browserWidget: JupyterFrontEndPlugin<void> = {
150147 toolbarRegistry ,
151148 settingRegistry ,
152149 FILE_BROWSER_FACTORY ,
153- browserWidget . id ,
150+ notebookTreeWidget . id ,
154151 translator
155152 )
156153 ) ;
@@ -160,8 +157,8 @@ const browserWidget: JupyterFrontEndPlugin<void> = {
160157 running . id = 'jp-running-sessions' ;
161158 running . title . label = trans . __ ( 'Running' ) ;
162159 running . title . icon = runningIcon ;
163- tabPanel . addWidget ( running ) ;
164- tabPanel . tabBar . addTab ( running . title ) ;
160+ nbTreeWidget . addWidget ( running ) ;
161+ nbTreeWidget . tabBar . addTab ( running . title ) ;
165162 }
166163
167164 // show checkboxes by default if there is no user setting override
@@ -177,12 +174,14 @@ const browserWidget: JupyterFrontEndPlugin<void> = {
177174 console . error ( reason . message ) ;
178175 } ) ;
179176
180- app . shell . add ( tabPanel , 'main' , { rank : 100 } ) ;
177+ app . shell . add ( nbTreeWidget , 'main' , { rank : 100 } ) ;
178+
179+ return nbTreeWidget ;
181180 }
182181} ;
183182
184183/**
185184 * Export the plugins as default.
186185 */
187- const plugins : JupyterFrontEndPlugin < any > [ ] = [ createNew , browserWidget ] ;
186+ const plugins : JupyterFrontEndPlugin < any > [ ] = [ createNew , notebookTreeWidget ] ;
188187export default plugins ;
0 commit comments