|
@@ -13,8 +13,7 @@ import {
|
|
InstanceTracker,
|
|
InstanceTracker,
|
|
IWindowResolver,
|
|
IWindowResolver,
|
|
MainAreaWidget,
|
|
MainAreaWidget,
|
|
- ToolbarButton,
|
|
|
|
- IInstanceTracker
|
|
|
|
|
|
+ ToolbarButton
|
|
} from '@jupyterlab/apputils';
|
|
} from '@jupyterlab/apputils';
|
|
|
|
|
|
import {
|
|
import {
|
|
@@ -253,7 +252,7 @@ function activateBrowser(
|
|
// responsible for their own restoration behavior, if any.
|
|
// responsible for their own restoration behavior, if any.
|
|
restorer.add(browser, namespace);
|
|
restorer.add(browser, namespace);
|
|
|
|
|
|
- addCommands(app, factory.tracker, browser, labShell, docManager);
|
|
|
|
|
|
+ addCommands(app, factory, labShell, docManager);
|
|
|
|
|
|
browser.title.iconClass = 'jp-FolderIcon jp-SideBar-tabIcon';
|
|
browser.title.iconClass = 'jp-FolderIcon jp-SideBar-tabIcon';
|
|
browser.title.caption = 'File Browser';
|
|
browser.title.caption = 'File Browser';
|
|
@@ -301,7 +300,8 @@ function activateBrowser(
|
|
const { path } = context;
|
|
const { path } = context;
|
|
if (context) {
|
|
if (context) {
|
|
commands.execute('filebrowser:activate', { path: path });
|
|
commands.execute('filebrowser:activate', { path: path });
|
|
- Private.navigateToPath(path, app, browser, factory.tracker)
|
|
|
|
|
|
+ factory.defaultBrowser;
|
|
|
|
+ Private.navigateToPath(path, factory)
|
|
.then(() => {
|
|
.then(() => {
|
|
docManager.findWidget(path).activate();
|
|
docManager.findWidget(path).activate();
|
|
})
|
|
})
|
|
@@ -351,13 +351,14 @@ function activateShareFile(
|
|
*/
|
|
*/
|
|
function addCommands(
|
|
function addCommands(
|
|
app: JupyterFrontEnd,
|
|
app: JupyterFrontEnd,
|
|
- tracker: InstanceTracker<FileBrowser>,
|
|
|
|
- browser: FileBrowser,
|
|
|
|
|
|
+ factory: IFileBrowserFactory,
|
|
labShell: ILabShell,
|
|
labShell: ILabShell,
|
|
docManager: IDocumentManager
|
|
docManager: IDocumentManager
|
|
): void {
|
|
): void {
|
|
const registry = app.docRegistry;
|
|
const registry = app.docRegistry;
|
|
const { commands } = app;
|
|
const { commands } = app;
|
|
|
|
+ const { defaultBrowser: browser } = factory;
|
|
|
|
+ const { tracker } = factory;
|
|
|
|
|
|
commands.addCommand(CommandIDs.del, {
|
|
commands.addCommand(CommandIDs.del, {
|
|
execute: () => {
|
|
execute: () => {
|
|
@@ -433,7 +434,7 @@ function addCommands(
|
|
commands.addCommand(CommandIDs.navigate, {
|
|
commands.addCommand(CommandIDs.navigate, {
|
|
execute: args => {
|
|
execute: args => {
|
|
const path = (args.path as string) || '';
|
|
const path = (args.path as string) || '';
|
|
- Private.navigateToPath(path, app, browser, tracker)
|
|
|
|
|
|
+ Private.navigateToPath(path, factory)
|
|
.then(() => {
|
|
.then(() => {
|
|
docManager.findWidget(path).activate();
|
|
docManager.findWidget(path).activate();
|
|
})
|
|
})
|
|
@@ -592,12 +593,7 @@ function addCommands(
|
|
commands.addCommand(CommandIDs.showBrowser, {
|
|
commands.addCommand(CommandIDs.showBrowser, {
|
|
execute: args => {
|
|
execute: args => {
|
|
const path = (args.path as string) || '';
|
|
const path = (args.path as string) || '';
|
|
- const browserForPath = Private.getBrowserForPath(
|
|
|
|
- path,
|
|
|
|
- app,
|
|
|
|
- browser,
|
|
|
|
- tracker
|
|
|
|
- );
|
|
|
|
|
|
+ const browserForPath = Private.getBrowserForPath(path, factory);
|
|
|
|
|
|
// Check for browser not found
|
|
// Check for browser not found
|
|
if (!browserForPath) {
|
|
if (!browserForPath) {
|
|
@@ -847,11 +843,11 @@ namespace Private {
|
|
*/
|
|
*/
|
|
export function getBrowserForPath(
|
|
export function getBrowserForPath(
|
|
path: string,
|
|
path: string,
|
|
- app: JupyterFrontEnd,
|
|
|
|
- browser: FileBrowser,
|
|
|
|
- tracker: IInstanceTracker<FileBrowser>
|
|
|
|
|
|
+ factory: IFileBrowserFactory
|
|
): FileBrowser {
|
|
): FileBrowser {
|
|
- const driveName = app.serviceManager.contents.driveName(path);
|
|
|
|
|
|
+ const { defaultBrowser: browser } = factory;
|
|
|
|
+ const { tracker } = factory;
|
|
|
|
+ const driveName = browser.model.manager.services.contents.driveName(path);
|
|
|
|
|
|
if (driveName) {
|
|
if (driveName) {
|
|
let browserForPath = tracker.find(
|
|
let browserForPath = tracker.find(
|
|
@@ -878,17 +874,10 @@ namespace Private {
|
|
*/
|
|
*/
|
|
export function navigateToPath(
|
|
export function navigateToPath(
|
|
path: string,
|
|
path: string,
|
|
- app: JupyterFrontEnd,
|
|
|
|
- browser: FileBrowser,
|
|
|
|
- tracker: IInstanceTracker<FileBrowser>
|
|
|
|
|
|
+ factory: IFileBrowserFactory
|
|
): Promise<any> {
|
|
): Promise<any> {
|
|
- const browserForPath = Private.getBrowserForPath(
|
|
|
|
- path,
|
|
|
|
- app,
|
|
|
|
- browser,
|
|
|
|
- tracker
|
|
|
|
- );
|
|
|
|
- const services = app.serviceManager;
|
|
|
|
|
|
+ const browserForPath = Private.getBrowserForPath(path, factory);
|
|
|
|
+ const { services } = factory.defaultBrowser.model.manager;
|
|
const localPath = services.contents.localPath(path);
|
|
const localPath = services.contents.localPath(path);
|
|
|
|
|
|
return services.ready
|
|
return services.ready
|