Skip to content

Commit

Permalink
Removed File > Close Editor.
Browse files Browse the repository at this point in the history
Closes #660

Signed-off-by: Akos Kitta <[email protected]>
  • Loading branch information
Akos Kitta committed Aug 25, 2022
1 parent 9829c6b commit 4424214
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,8 @@ import { MonacoThemeServiceIsReady } from './utils/window';
import { Deferred } from '@theia/core/lib/common/promise-util';
import { StatusBarImpl } from './theia/core/status-bar';
import { StatusBarImpl as TheiaStatusBarImpl } from '@theia/core/lib/browser';
import { EditorMenuContribution } from './theia/editor/editor-file';
import { EditorMenuContribution as TheiaEditorMenuContribution } from '@theia/editor/lib/browser/editor-menu';

const registerArduinoThemes = () => {
const themes: MonacoThemeJson[] = [
Expand Down Expand Up @@ -640,6 +642,10 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
bind(WindowContribution).toSelf().inSingletonScope();
rebind(TheiaWindowContribution).toService(WindowContribution);

// To remove `File` > `Close Editor`.
bind(EditorMenuContribution).toSelf().inSingletonScope();
rebind(TheiaEditorMenuContribution).toService(EditorMenuContribution);

bind(ArduinoDaemon)
.toDynamicValue((context) =>
WebSocketConnectionProvider.createProxy(
Expand Down
12 changes: 12 additions & 0 deletions arduino-ide-extension/src/browser/theia/editor/editor-file.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { MenuModelRegistry } from '@theia/core';
import { CommonCommands } from '@theia/core/lib/browser';
import { injectable } from '@theia/core/shared/inversify';
import { EditorMenuContribution as TheiaEditorMenuContribution } from '@theia/editor/lib/browser/editor-menu';

@injectable()
export class EditorMenuContribution extends TheiaEditorMenuContribution {
override registerMenus(registry: MenuModelRegistry): void {
super.registerMenus(registry);
registry.unregisterMenuAction(CommonCommands.CLOSE_MAIN_TAB.id);
}
}

0 comments on commit 4424214

Please sign in to comment.