Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

<a name="breaking_changes_1.28.0">[Breaking Changes:](#breaking_changes_1.28.0)</a>

- [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
Expand Down
11 changes: 6 additions & 5 deletions packages/core/src/browser/common-frontend-contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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'
});
}
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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',
}
);
Expand Down
55 changes: 37 additions & 18 deletions packages/navigator/src/browser/navigator-contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -374,6 +383,17 @@ export class FileNavigatorContribution extends AbstractViewContribution<FileNavi
},
isVisible: () => 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[] {
Expand Down Expand Up @@ -423,10 +443,6 @@ export class FileNavigatorContribution extends AbstractViewContribution<FileNavi
}
});

// registry.registerMenuAction([CONTEXT_MENU_PATH, CUT_MENU_GROUP], {
// commandId: Commands.FILE_CUT
// });

registry.registerMenuAction(NavigatorContextMenu.CLIPBOARD, {
commandId: CommonCommands.COPY.id,
order: 'a'
Expand Down Expand Up @@ -560,30 +576,32 @@ export class FileNavigatorContribution extends AbstractViewContribution<FileNavi
}

async registerToolbarItems(toolbarRegistry: TabBarToolbarRegistry): Promise<void> {
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,
Expand All @@ -597,6 +615,7 @@ export class FileNavigatorContribution extends AbstractViewContribution<FileNavi
group: NavigatorMoreToolbarGroups.WORKSPACE,
});

// Open Editors toolbar items.
toolbarRegistry.registerItem({
id: OpenEditorsCommands.SAVE_ALL_TABS_FROM_TOOLBAR.id,
command: OpenEditorsCommands.SAVE_ALL_TABS_FROM_TOOLBAR.id,
Expand Down
1 change: 0 additions & 1 deletion packages/workspace/src/browser/workspace-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ export namespace WorkspaceCommands {
category: WORKSPACE_CATEGORY,
label: 'Close Workspace'
});
/** @deprecated @since 1.24 Use CommonCommands.NEW_FILE instead. */
export const NEW_FILE = Command.toDefaultLocalizedCommand({
id: 'file.newFile',
category: FILE_CATEGORY,
Expand Down