@tobejacob/myextension
Version:
The example extension demonstrates how to contribute a custom widget (i.e. a view or editor) to Eclipse Theia. Furthermore, the template contains an example unit test.
51 lines • 1.91 kB
TypeScript
import { MenuModelRegistry } from '@theia/core';
import { MyextensionWidget } from './myextension-widget';
import { AbstractViewContribution } from '@theia/core/lib/browser';
import { Command, CommandRegistry } from '@theia/core/lib/common/command';
export declare const MyextensionCommand: Command;
export declare class MyextensionContribution extends AbstractViewContribution<MyextensionWidget> {
/**
* `AbstractViewContribution` handles the creation and registering
* of the widget including commands, menus, and keybindings.
*
* We can pass `defaultWidgetOptions` which define widget properties such as
* its location `area` (`main`, `left`, `right`, `bottom`), `mode`, and `ref`.
*
*/
constructor();
/**
* Example command registration to open the widget from the menu, and quick-open.
* For a simpler use case, it is possible to simply call:
```ts
super.registerCommands(commands)
```
*
* For more flexibility, we can pass `OpenViewArguments` which define
* options on how to handle opening the widget:
*
```ts
toggle?: boolean
activate?: boolean;
reveal?: boolean;
```
*
* @param commands
*/
registerCommands(commands: CommandRegistry): void;
/**
* Example menu registration to contribute a menu item used to open the widget.
* Default location when extending the `AbstractViewContribution` is the `View` main-menu item.
*
* We can however define new menu path locations in the following way:
```ts
menus.registerMenuAction(CommonMenus.HELP, {
commandId: 'id',
label: 'label'
});
```
*
* @param menus
*/
registerMenus(menus: MenuModelRegistry): void;
}
//# sourceMappingURL=myextension-contribution.d.ts.map