diff --git a/CHANGELOG.md b/CHANGELOG.md index 18289c1ffb614..8e823c8293f3d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,11 +5,13 @@ - [Previous Changelogs](https://github.com/eclipse-theia/theia/tree/master/doc/changelogs/) ## v1.28.0 - Unreleased + - [plugin] added support for property `SourceControlInputBox#visible` [#11412](https://github.com/eclipse-theia/theia/pull/11412) - Contributed on behalf of STMicroelectronics [Breaking Changes:](#breaking_changes_1.28.0) - [core] `handleDefault`, `handleElectronDefault` method no longer called in `BrowserMainMenuFactory.registerMenu()`, `DynamicMenuWidget.buildSubMenus()` or `ElectronMainMenuFactory.fillSubmenus()`. Override the respective calling function rather than `handleDefault`. The argument to each of the three methods listed above is now `MenuNode` and not `CompositeMenuNode`, and the methods are truly recursive and called on entire menu tree. `ActionMenuNode.action` removed; access relevant field on `ActionMenuNode.command`, `.when` etc. [#11290](https://github.com/eclipse-theia/theia/pull/11290) +- [core] renamed `CommonCommands.NEW_FILE` to `CommonCommands.NEW_UNTITLED_FILE` [#11429](https://github.com/eclipse-theia/theia/pull/11429) - [plugin-ext] `CodeEditorWidgetUtil` moved to `packages/plugin-ext/src/main/browser/menus/vscode-theia-menu-mappings.ts`. `MenusContributionPointHandler` extensively refactored. See PR description for details. [#11290](https://github.com/eclipse-theia/theia/pull/11290) ## v1.27.0 - 6/30/2022 diff --git a/packages/core/src/browser/common-frontend-contribution.ts b/packages/core/src/browser/common-frontend-contribution.ts index 545d81433e93e..9aac0b62fabaa 100644 --- a/packages/core/src/browser/common-frontend-contribution.ts +++ b/packages/core/src/browser/common-frontend-contribution.ts @@ -272,10 +272,10 @@ export namespace CommonCommands { category: VIEW_CATEGORY, label: 'Show Menu Bar' }); - export const NEW_FILE = Command.toDefaultLocalizedCommand({ + export const NEW_UNTITLED_FILE = Command.toDefaultLocalizedCommand({ id: 'workbench.action.files.newUntitledFile', category: FILE_CATEGORY, - label: 'New File' + label: 'New Untitled File' }); export const SAVE = Command.toDefaultLocalizedCommand({ id: 'core.save', @@ -721,7 +721,8 @@ export class CommonFrontendContribution implements FrontendApplicationContributi registry.registerSubmenu(CommonMenus.VIEW_APPEARANCE_SUBMENU, nls.localizeByDefault('Appearance')); registry.registerMenuAction(CommonMenus.FILE_NEW, { - commandId: CommonCommands.NEW_FILE.id, + commandId: CommonCommands.NEW_UNTITLED_FILE.id, + label: nls.localizeByDefault('New File'), order: 'a' }); } @@ -963,7 +964,7 @@ export class CommonFrontendContribution implements FrontendApplicationContributi commandRegistry.registerCommand(CommonCommands.CONFIGURE_DISPLAY_LANGUAGE, { execute: () => this.configureDisplayLanguage() }); - commandRegistry.registerCommand(CommonCommands.NEW_FILE, { + commandRegistry.registerCommand(CommonCommands.NEW_UNTITLED_FILE, { execute: async () => { const untitledUri = this.untitledResourceResolver.createUntitledURI('', await this.workingDirProvider.getUserWorkingDir()); this.untitledResourceResolver.resolve(untitledUri); @@ -1104,7 +1105,7 @@ export class CommonFrontendContribution implements FrontendApplicationContributi when: 'activeEditorIsPinned' }, { - command: CommonCommands.NEW_FILE.id, + command: CommonCommands.NEW_UNTITLED_FILE.id, keybinding: this.isElectron() ? 'ctrlcmd+n' : 'alt+n', } ); diff --git a/packages/navigator/src/browser/navigator-contribution.ts b/packages/navigator/src/browser/navigator-contribution.ts index b054e5b4218ed..77994dcb87a74 100644 --- a/packages/navigator/src/browser/navigator-contribution.ts +++ b/packages/navigator/src/browser/navigator-contribution.ts @@ -115,6 +115,15 @@ export namespace FileNavigatorCommands { category: CommonCommands.FILE_CATEGORY, label: 'Open' }); + export const NEW_FILE_TOOLBAR: Command = { + id: `${WorkspaceCommands.NEW_FILE.id}.toolbar`, + iconClass: codicon('new-file') + }; + export const NEW_FOLDER_TOOLBAR: Command = { + id: `${WorkspaceCommands.NEW_FOLDER.id}.toolbar`, + iconClass: codicon('new-folder') + }; + /** * @deprecated since 1.21.0. Use WorkspaceCommands.COPY_RELATIVE_FILE_COMMAND instead. */ @@ -374,6 +383,17 @@ export class FileNavigatorContribution extends AbstractViewContribution false }); + + registry.registerCommand(FileNavigatorCommands.NEW_FILE_TOOLBAR, { + execute: (...args) => registry.executeCommand(WorkspaceCommands.NEW_FILE.id, ...args), + isEnabled: widget => this.withWidget(widget, () => this.workspaceService.opened), + isVisible: widget => this.withWidget(widget, () => this.workspaceService.opened) + }); + registry.registerCommand(FileNavigatorCommands.NEW_FOLDER_TOOLBAR, { + execute: (...args) => registry.executeCommand(WorkspaceCommands.NEW_FOLDER.id, ...args), + isEnabled: widget => this.withWidget(widget, () => this.workspaceService.opened), + isVisible: widget => this.withWidget(widget, () => this.workspaceService.opened) + }); } protected get editorWidgets(): NavigatableWidget[] { @@ -423,10 +443,6 @@ export class FileNavigatorContribution extends AbstractViewContribution { + toolbarRegistry.registerItem({ + id: FileNavigatorCommands.NEW_FILE_TOOLBAR.id, + command: FileNavigatorCommands.NEW_FILE_TOOLBAR.id, + tooltip: nls.localizeByDefault('New File'), + priority: 0, + }); + toolbarRegistry.registerItem({ + id: FileNavigatorCommands.NEW_FOLDER_TOOLBAR.id, + command: FileNavigatorCommands.NEW_FOLDER_TOOLBAR.id, + tooltip: nls.localizeByDefault('New Folder'), + priority: 1, + }); toolbarRegistry.registerItem({ id: FileNavigatorCommands.REFRESH_NAVIGATOR.id, command: FileNavigatorCommands.REFRESH_NAVIGATOR.id, tooltip: nls.localizeByDefault('Refresh Explorer'), - priority: 0, + priority: 2, }); toolbarRegistry.registerItem({ id: FileNavigatorCommands.COLLAPSE_ALL.id, command: FileNavigatorCommands.COLLAPSE_ALL.id, tooltip: nls.localizeByDefault('Collapse All'), - priority: 1, - }); - this.registerMoreToolbarItem({ - id: CommonCommands.NEW_FILE.id, - command: CommonCommands.NEW_FILE.id, - tooltip: CommonCommands.NEW_FILE.label, - group: NavigatorMoreToolbarGroups.NEW_OPEN, - }); - this.registerMoreToolbarItem({ - id: WorkspaceCommands.NEW_FOLDER.id, - command: WorkspaceCommands.NEW_FOLDER.id, - tooltip: WorkspaceCommands.NEW_FOLDER.label, - group: NavigatorMoreToolbarGroups.NEW_OPEN, + priority: 3, }); + + // More (...) toolbar items. this.registerMoreToolbarItem({ id: FileNavigatorCommands.TOGGLE_AUTO_REVEAL.id, command: FileNavigatorCommands.TOGGLE_AUTO_REVEAL.id, @@ -597,6 +615,7 @@ export class FileNavigatorContribution extends AbstractViewContribution