Skip to content

Instantly share code, notes, and snippets.

@maciejChmuraCodete
Created September 1, 2021 07:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maciejChmuraCodete/092551d22f14f29abf88d9ab645a48bc to your computer and use it in GitHub Desktop.
Save maciejChmuraCodete/092551d22f14f29abf88d9ab645a48bc to your computer and use it in GitHub Desktop.
move debugger to bottom panel
import { injectable, inject } from "inversify";
import {
CommandContribution,
CommandRegistry,
MenuContribution,
MenuModelRegistry,
MessageService,
} from "@theia/core/lib/common";
import { CommonMenus } from "@theia/core/lib/browser";
import { ApplicationShell } from "@theia/core/lib/browser";
// import { postConstruct } from '@theia/core/shared/inversify';
import { Widget } from "@theia/core/src/browser/widgets";
export const HelloCommand = {
id: "Hello.command",
label: "Say Hello",
};
@injectable()
export class HelloCommandContribution implements CommandContribution {
constructor(
@inject(MessageService) private readonly messageService: MessageService
) {}
registerCommands(registry: CommandRegistry): void {
registry.registerCommand(HelloCommand, {
execute: () => this.messageService.info("Hello World!"),
});
}
}
@injectable()
export class HelloMenuContribution implements MenuContribution {
registerMenus(menus: MenuModelRegistry): void {
menus.registerMenuAction(CommonMenus.EDIT_FIND, {
commandId: HelloCommand.id,
label: HelloCommand.label,
});
// menus.unregisterMenuAction('1_file')
// menus.unregisterMenuAction('2_edit')
// menus.unregisterMenuAction('4_view')
// menus.unregisterMenuAction('9_help')
// menus.unregisterMenuAction('menubar')
}
}
// @injectable()
// export class CustomApplicationShell extends ApplicationShell {
// @postConstruct()
// protected init(): void {
// this.topPanel.hide(); // attempt to hide the top-panel.
// this.leftPanelHandler.container.close() // closes left panel
// this.rightPanelHandler.container.close() // closes outline view
// console.log(this.bottomPanel)
// this.bottomPanel.setHidden(false)
// const widgets = this.getWidgets('left');
// console.log(widgets)
// }
// }
@injectable()
export class CustomApplicationShell extends ApplicationShell {
async addWidget(
widget: Widget,
options: Readonly<ApplicationShell.WidgetOptions> = {}
): Promise<void> {
// your code here
}
}
/**
* Generated using theia-extension-generator
*/
import { HelloCommandContribution, HelloMenuContribution, CustomApplicationShell } from './hello-contribution';
import {
CommandContribution,
MenuContribution
} from "@theia/core/lib/common";
import { ApplicationShell } from '@theia/core/lib/browser';
import { ContainerModule } from '@theia/core/shared/inversify';
export default new ContainerModule((bind, unbind, isBound, rebind) => {
// add your contribution bindings here
bind(CommandContribution).to(HelloCommandContribution);
bind(MenuContribution).to(HelloMenuContribution);
bind(CustomApplicationShell).toSelf().inSingletonScope();
rebind(ApplicationShell).to(CustomApplicationShell).inSingletonScope();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment