Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add force refresh button in navigator #5940

Merged
merged 1 commit into from
Aug 14, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion packages/navigator/src/browser/navigator-contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ export namespace FileNavigatorCommands {
id: 'navigator.toggle.hidden.files',
label: 'Toggle Hidden Files'
};
export const REFRESH_NAVIGATOR: Command = {
id: 'navigator.refresh',
vince-fugnitto marked this conversation as resolved.
Show resolved Hide resolved
category: 'File',
label: 'Refresh in Explorer',
iconClass: 'refresh'
};
export const COLLAPSE_ALL: Command = {
id: 'navigator.collapse.all',
category: 'File',
Expand Down Expand Up @@ -161,6 +167,11 @@ export class FileNavigatorContribution extends AbstractViewContribution<FileNavi
isEnabled: widget => this.withWidget(widget, () => this.workspaceService.opened),
isVisible: widget => this.withWidget(widget, () => this.workspaceService.opened)
});
registry.registerCommand(FileNavigatorCommands.REFRESH_NAVIGATOR, {
execute: widget => this.withWidget(widget, () => this.refreshWorkspace()),
isEnabled: widget => this.withWidget(widget, () => this.workspaceService.opened),
isVisible: widget => this.withWidget(widget, () => this.workspaceService.opened)
});
registry.registerCommand(FileNavigatorCommands.ADD_ROOT_FOLDER, {
execute: (...args) => registry.executeCommand(WorkspaceCommands.ADD_FOLDER.id, ...args),
isEnabled: (...args) => registry.isEnabled(WorkspaceCommands.ADD_FOLDER.id, ...args),
Expand Down Expand Up @@ -317,11 +328,17 @@ export class FileNavigatorContribution extends AbstractViewContribution<FileNavi
}

async registerToolbarItems(toolbarRegistry: TabBarToolbarRegistry): Promise<void> {
toolbarRegistry.registerItem({
id: FileNavigatorCommands.REFRESH_NAVIGATOR.id,
command: FileNavigatorCommands.REFRESH_NAVIGATOR.id,
tooltip: 'Refresh Explorer',
priority: 0,
vince-fugnitto marked this conversation as resolved.
Show resolved Hide resolved
});
toolbarRegistry.registerItem({
id: FileNavigatorCommands.COLLAPSE_ALL.id,
command: FileNavigatorCommands.COLLAPSE_ALL.id,
tooltip: 'Collapse All',
priority: 0,
priority: 1,
});
}

Expand Down Expand Up @@ -373,6 +390,14 @@ export class FileNavigatorContribution extends AbstractViewContribution<FileNavi
}
}

/**
* force refresh workspace in navigator
*/
async refreshWorkspace(): Promise<void> {
const { model } = await this.widget;
await model.refresh();
}

private readonly toDisposeAddRemoveFolderActions = new DisposableCollection();
private updateAddRemoveFolderActions(registry: MenuModelRegistry): void {
this.toDisposeAddRemoveFolderActions.dispose();
Expand Down