diff --git a/packages/markers/src/browser/problem/problem-container.ts b/packages/markers/src/browser/problem/problem-container.ts index f05b2a57f7537..d8ebf984f3757 100644 --- a/packages/markers/src/browser/problem/problem-container.ts +++ b/packages/markers/src/browser/problem/problem-container.ts @@ -9,16 +9,16 @@ import { interfaces, Container } from "inversify"; import { MarkerOptions } from '../marker-tree'; import { ProblemWidget } from './problem-widget'; import { ProblemTreeModel, ProblemTree } from './problem-tree-model'; -import { MARKER_CONTEXT_MENU } from './problem-contribution'; import { TreeWidget, TreeProps, defaultTreeProps, ITreeModel, createTreeContainer, TreeModel, Tree, ITree } from "@theia/core/lib/browser"; import { MarkerTreeServices } from '../marker-tree-model'; +import { PROBLEM_KIND } from './problem-marker'; -export const MARKER_TREE_PROPS = { +export const PROBLEM_TREE_PROPS = { ...defaultTreeProps, - contextMenuPath: MARKER_CONTEXT_MENU + contextMenuPath: PROBLEM_KIND }; -export const MARKER_OPTIONS = { +export const PROBLEM_OPTIONS = { kind: 'problem' }; @@ -38,8 +38,8 @@ export function createProblemTreeContainer(parent: interfaces.Container): Contai child.bind(MarkerTreeServices).toSelf(); - child.rebind(TreeProps).toConstantValue(MARKER_TREE_PROPS); - child.bind(MarkerOptions).toConstantValue(MARKER_OPTIONS); + child.rebind(TreeProps).toConstantValue(PROBLEM_TREE_PROPS); + child.bind(MarkerOptions).toConstantValue(PROBLEM_OPTIONS); return child; } diff --git a/packages/markers/src/browser/problem/problem-contribution.ts b/packages/markers/src/browser/problem/problem-contribution.ts index f51a32965ba6d..91bd1cecc0676 100644 --- a/packages/markers/src/browser/problem/problem-contribution.ts +++ b/packages/markers/src/browser/problem/problem-contribution.ts @@ -6,7 +6,6 @@ */ import { injectable, inject } from 'inversify'; -import { PROBLEM_WIDGET_FACTORY_ID } from './problem-widget'; import { MenuModelRegistry, Command, CommandContribution, MenuContribution, KeybindingContribution, KeybindingRegistry, @@ -14,12 +13,11 @@ import { } from '@theia/core/lib/common'; import { FrontendApplication } from '@theia/core/lib/browser'; import { WidgetManager } from '@theia/core/lib/browser/widget-manager'; - -export const MARKER_CONTEXT_MENU = 'marker-context-menu'; +import { PROBLEM_KIND } from './problem-marker'; export namespace ProblemCommands { export const OPEN: Command = { - id: 'markers:open', + id: 'problems:open', label: 'Open Problem View' }; } @@ -49,7 +47,7 @@ export class ProblemContribution implements CommandContribution, MenuContributio } protected async openProblemsView(): Promise { - const markerWidget = await this.widgetFactory.getOrCreateWidget(PROBLEM_WIDGET_FACTORY_ID); + const markerWidget = await this.widgetFactory.getOrCreateWidget(PROBLEM_KIND); if (!markerWidget.isAttached) { this.app.shell.addToMainArea(markerWidget); } diff --git a/packages/markers/src/browser/problem/problem-frontend-module.ts b/packages/markers/src/browser/problem/problem-frontend-module.ts index 0c24b754109e1..a6bfac754ccdd 100644 --- a/packages/markers/src/browser/problem/problem-frontend-module.ts +++ b/packages/markers/src/browser/problem/problem-frontend-module.ts @@ -6,11 +6,11 @@ */ import { ContainerModule } from 'inversify'; -import { ProblemWidget, PROBLEM_WIDGET_FACTORY_ID } from './problem-widget'; +import { ProblemWidget } from './problem-widget'; import { ProblemContribution } from './problem-contribution'; import { createProblemWidget } from './problem-container'; import { CommandContribution, MenuContribution, KeybindingContribution } from "@theia/core/lib/common"; -import { ProblemManager } from './problem-marker'; +import { ProblemManager, PROBLEM_KIND } from './problem-marker'; import { WidgetFactory } from '@theia/core/lib/browser/widget-manager'; import '../../../src/browser/style/index.css'; @@ -23,7 +23,7 @@ export default new ContainerModule(bind => { ); bind(WidgetFactory).toDynamicValue(context => ({ - id: PROBLEM_WIDGET_FACTORY_ID, + id: PROBLEM_KIND, createWidget: () => context.container.get(ProblemWidget) })); bind(ProblemContribution).toSelf().inSingletonScope(); diff --git a/packages/markers/src/browser/problem/problem-marker.ts b/packages/markers/src/browser/problem/problem-marker.ts index 71b88523b6fb8..6b98986665819 100644 --- a/packages/markers/src/browser/problem/problem-marker.ts +++ b/packages/markers/src/browser/problem/problem-marker.ts @@ -11,13 +11,15 @@ import { injectable, inject } from 'inversify'; import { StorageService } from '@theia/core/lib/browser/storage-service'; import { FileSystemWatcher } from '@theia/filesystem/lib/common'; +export const PROBLEM_KIND = 'problem'; + export interface ProblemMarker extends Marker { kind: 'problem'; } export namespace ProblemMarker { export function is(node: Marker): node is ProblemMarker { - return 'kind' in node && node.kind === 'problem'; + return 'kind' in node && node.kind === PROBLEM_KIND; } } @@ -25,7 +27,7 @@ export namespace ProblemMarker { export class ProblemManager extends MarkerManager { public getKind() { - return 'problem'; + return PROBLEM_KIND; } constructor( diff --git a/packages/markers/src/browser/problem/problem-widget.ts b/packages/markers/src/browser/problem/problem-widget.ts index 9aef43efb41ce..acb1edec82430 100644 --- a/packages/markers/src/browser/problem/problem-widget.ts +++ b/packages/markers/src/browser/problem/problem-widget.ts @@ -15,8 +15,6 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import { Message } from '@phosphor/messaging'; -export const PROBLEM_WIDGET_FACTORY_ID = 'problems'; - @injectable() export class ProblemWidget extends TreeWidget {