/* * Copyright (C) 2017 TypeFox and others. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 */ import { injectable, inject } from "inversify"; import { MessageService } from "@theia/core"; import { AbstractViewContribution } from '@theia/core/lib/browser'; import { FrontendApplication } from "@theia/core/lib/browser"; import { CatalogoWidget } from './catalogo-frontend-widget' import { CatalogoOpenHandler } from './catalogo-frontend-openhandler' import { CommandRegistry } from '@theia/core/lib/common/command'; export const EXTENSIONS_WIDGET_FACTORY_ID = 'catalogo'; @injectable() export class CatalogoContribution extends AbstractViewContribution { @inject(MessageService) protected readonly messageService: MessageService; @inject(CatalogoOpenHandler) protected readonly openHandler:CatalogoOpenHandler; constructor() { super({ widgetId: EXTENSIONS_WIDGET_FACTORY_ID, widgetName: 'Catalog', defaultWidgetOptions: { area: 'main' }, toggleCommandId: 'catalogoView:toggle' }); } registerCommands(commands: CommandRegistry): void { if (this.toggleCommand) { commands.registerCommand(this.toggleCommand, { isEnabled: () => true, isVisible: () => true, execute: (options) => { return this.openView({ toggle: true, activate: true, ...options }) } }); } } async initializeLayout(app: FrontendApplication): Promise { //@by Ademar metodo sobrescrito para evitar que abra o catalogo na abertura inicial do aplicação } async openView(args:any = {}): Promise { return this.openHandler.open(args); } }