Skip to content

Commit

Permalink
[WIP] Fix eclipse-theia#4088: Add 'Upload Files...' menu entries
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Keromnes <jan.keromnes@typefox.io>
  • Loading branch information
jankeromnes committed Jan 25, 2019
1 parent 74a46e4 commit 12eeb92
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## v0.3.20
- [plugin] added `tasks.onDidEndTask` Plug-in API
- [cpp] fixed `CPP_CLANGD_COMMAND` and `CPP_CLANGD_ARGS` environment variables
- [core] added the menu item `Upload Files...` to easily import files into a workspace


## v0.3.19
Expand Down
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 @@ -178,6 +178,9 @@ export class FileNavigatorContribution extends AbstractViewContribution<FileNavi
registry.registerMenuAction(NavigatorContextMenu.NEW, {
commandId: WorkspaceCommands.NEW_FOLDER.id
});
registry.registerMenuAction(NavigatorContextMenu.NEW, {
commandId: WorkspaceCommands.UPLOAD_FILES.id
});
registry.registerMenuAction(NavigatorContextMenu.DIFF, {
commandId: WorkspaceCommands.FILE_COMPARE.id
});
Expand Down
18 changes: 18 additions & 0 deletions packages/workspace/src/browser/workspace-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ export namespace WorkspaceCommands {
category: FILE_CATEGORY,
label: 'New Folder'
};
export const UPLOAD_FILES: Command = {
id: 'file.uploadFiles',
category: FILE_CATEGORY,
label: 'Upload Files...'
};
export const FILE_OPEN_WITH = (opener: OpenHandler): Command => ({
id: `file.openWith.${opener.id}`
});
Expand Down Expand Up @@ -136,6 +141,9 @@ export class FileMenuContribution implements MenuContribution {
registry.registerMenuAction(CommonMenus.FILE_NEW, {
commandId: WorkspaceCommands.NEW_FOLDER.id
});
registry.registerMenuAction(CommonMenus.FILE_NEW, {
commandId: WorkspaceCommands.UPLOAD_FILES.id
});
}

}
Expand Down Expand Up @@ -204,6 +212,16 @@ export class WorkspaceCommandContribution implements CommandContribution {
}
})
}));
registry.registerCommand(WorkspaceCommands.UPLOAD_FILES, this.newWorkspaceRootUriAwareCommandHandler({
execute: uri => this.getDirectory(uri).then(parent => {
if (parent) {
// const parentUri = new URI(parent.uri);
// TODO native file picker or new custom Dialog?
// TODO call FileTreeModel.upload()
alert('Upload Files');
}
})
}));
registry.registerCommand(WorkspaceCommands.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,
Expand Down

0 comments on commit 12eeb92

Please sign in to comment.