Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[marker] renamed problem view specific symbols, use constants #546

Merged
merged 1 commit into from
Sep 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions packages/markers/src/browser/problem/problem-container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = <TreeProps>{
export const PROBLEM_TREE_PROPS = <TreeProps>{
...defaultTreeProps,
contextMenuPath: MARKER_CONTEXT_MENU
contextMenuPath: PROBLEM_KIND
};

export const MARKER_OPTIONS = <MarkerOptions>{
export const PROBLEM_OPTIONS = <MarkerOptions>{
kind: 'problem'
};

Expand All @@ -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;
}

Expand Down
8 changes: 3 additions & 5 deletions packages/markers/src/browser/problem/problem-contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,18 @@
*/

import { injectable, inject } from 'inversify';
import { PROBLEM_WIDGET_FACTORY_ID } from './problem-widget';
import {
MenuModelRegistry, Command, CommandContribution,
MenuContribution, KeybindingContribution, KeybindingRegistry,
KeyCode, Key, Modifier, CommandRegistry, MAIN_MENU_BAR
} 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'
};
}
Expand Down Expand Up @@ -49,7 +47,7 @@ export class ProblemContribution implements CommandContribution, MenuContributio
}

protected async openProblemsView(): Promise<void> {
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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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>(ProblemWidget)
}));
bind(ProblemContribution).toSelf().inSingletonScope();
Expand Down
6 changes: 4 additions & 2 deletions packages/markers/src/browser/problem/problem-marker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,23 @@ 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<Diagnostic> {
kind: 'problem';
}

export namespace ProblemMarker {
export function is(node: Marker<object>): node is ProblemMarker {
return 'kind' in node && node.kind === 'problem';
return 'kind' in node && node.kind === PROBLEM_KIND;
}
}

@injectable()
export class ProblemManager extends MarkerManager<Diagnostic> {

public getKind() {
return 'problem';
return PROBLEM_KIND;
}

constructor(
Expand Down
2 changes: 0 additions & 2 deletions packages/markers/src/browser/problem/problem-widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down