/* * 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} from 'inversify'; import URI from '@theia/core/lib/common/uri'; import { OpenHandler, WidgetOpenHandler } from '@theia/core/lib/browser'; import { CatalogoWidget, WIDGET_ID, CatalogoWidgetOptions } from './catalogo-frontend-widget'; @injectable() export class CatalogoOpenHandler extends WidgetOpenHandler implements OpenHandler { readonly id = WIDGET_ID; readonly label = 'Catalogo'; canHandle(uri:URI):number{ if(uri.path.ext === '.connector'){ return Number.MAX_SAFE_INTEGER; } return 0; } protected createWidgetOptions(options: any): CatalogoWidgetOptions { return { longId: `${options.parentId}_${options.shortId}`, uri: options.fileNameUri, parentId: options.parentId, sequence: 0, shortId: options.shortId }; } }