Skip to content

Commit

Permalink
test: WorkspaceCommands.Rename
Browse files Browse the repository at this point in the history
This commit contains changes used for testing.
  • Loading branch information
FernandoAscencio committed Mar 10, 2023
1 parent 370be95 commit 923cac4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/navigator/src/browser/navigator-contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,9 @@ export class FileNavigatorContribution extends AbstractViewContribution<FileNavi
registry.registerMenuAction(NavigatorContextMenu.MODIFICATION, {
commandId: WorkspaceCommands.FILE_RENAME.id
});
registry.registerMenuAction(NavigatorContextMenu.MODIFICATION, {
commandId: 'test.file.rename'
});
registry.registerMenuAction(NavigatorContextMenu.MODIFICATION, {
commandId: WorkspaceCommands.FILE_DELETE.id
});
Expand Down
8 changes: 8 additions & 0 deletions packages/workspace/src/browser/workspace-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,14 @@ export class WorkspaceCommandContribution implements CommandContribution {
}
}
}));
registry.registerCommand({ id: 'test.file.rename', label: 'Test: File Rename' }, this.newMultiUriAwareCommandHandler({
isEnabled: uris => uris.some(uri => !this.isWorkspaceRoot(uri)) && uris.length === 1,
isVisible: uris => uris.some(uri => !this.isWorkspaceRoot(uri)) && uris.length === 1,
execute: async uris => {
const result: FileStat | undefined = await registry.executeCommand(WorkspaceCommands.FILE_RENAME.id, uris);
this.messageService.info(`Result: type="${typeof result}" uri="${result?.resource.toString()}"`);
}
}));
registry.registerCommand(WorkspaceCommands.FILE_DUPLICATE, this.newMultiUriAwareCommandHandler(this.duplicateHandler));
registry.registerCommand(WorkspaceCommands.FILE_DELETE, this.newMultiUriAwareCommandHandler(this.deleteHandler));
registry.registerCommand(WorkspaceCommands.FILE_COMPARE, this.newMultiUriAwareCommandHandler(this.compareHandler));
Expand Down

0 comments on commit 923cac4

Please sign in to comment.