提交 183a4d6a 编写于 作者: S Sandeep Somavarapu

Implementation finishing first cut

上级 7669524f
......@@ -5,7 +5,6 @@
import 'vs/css!./media/markers';
import nls = require('vs/nls');
import * as errors from 'vs/base/common/errors';
import * as Set from 'vs/base/common/set';
import URI from 'vs/base/common/uri';
......@@ -16,6 +15,10 @@ import builder = require('vs/base/browser/builder');
import {Action} from 'vs/base/common/actions';
import { IMarkerService } from 'vs/platform/markers/common/markers';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IEventService } from 'vs/platform/event/common/event';
import { EventType } from 'vs/workbench/common/events';
import { CommonKeybindings } from 'vs/base/common/keyCodes';
import {IKeyboardEvent} from 'vs/base/browser/keyboardEvent';
import { Panel } from 'vs/workbench/browser/panel';
import {IAction} from 'vs/base/common/actions';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
......@@ -41,7 +44,7 @@ export class MarkersPanel extends Panel {
private actions: IAction[];
private showFilterInputAction: IAction;
private showOnlyErrorsAction: IAction;
private toggleErrorsAction: IAction;
private collapseAllAction: IAction;
private messageBoxContainer: HTMLElement;
......@@ -54,6 +57,7 @@ export class MarkersPanel extends Panel {
@IMarkerService private markerService: IMarkerService,
@IWorkbenchEditorService private editorService: IWorkbenchEditorService,
@IContextViewService private contextViewService: IContextViewService,
@IEventService private eventService: IEventService,
@ITelemetryService telemetryService: ITelemetryService
) {
super(Constants.MARKERS_PANEL_ID, telemetryService);
......@@ -68,12 +72,12 @@ export class MarkersPanel extends Panel {
let container= dom.append(parent.getHTMLElement(), dom.emmet('.markers-panel-container'));
this.createMessageBox(container);
this.createActions();
this.createFilterInputBox(container);
this.createMessageBox(container);
this.createTree(container);
this.createActions();
this.toDispose.push(this.markerService.onMarkerChanged(this.onMarkerChanged.bind(this)));
this.createListeners();
this.render();
......@@ -91,13 +95,12 @@ export class MarkersPanel extends Panel {
public focus(): void {
if (this.markersModel.hasFilteredResources()) {
this.tree.DOMFocus();
this.tree.focusFirst();
}
}
public getActions(): IAction[] {
this.showOnlyErrorsAction.enabled= this.markersModel.hasResources();
this.toggleErrorsAction.enabled= this.markersModel.hasResources();
if (this.markersModel.hasFilteredResources()) {
this.showFilterInputAction.enabled= true;
this.collapseAllAction.enabled= true;
......@@ -114,10 +117,18 @@ export class MarkersPanel extends Panel {
}
private createFilterInputBox(parent: HTMLElement): void {
this.filterInputBoxContainer= dom.append(parent, dom.emmet('.filter-box-container'));
var filterBoxContainer= dom.append(parent, dom.emmet('.filter-box-container'));
this.filterInputBoxContainer= dom.append(filterBoxContainer, dom.emmet('.input-box-container'));
this.filterInputBox= new InputBox(this.filterInputBoxContainer, this.contextViewService, {
placeholder: Messages.MARKERS_PANEL_FILTER_PLACEHOLDER
});
this.toDispose.push(dom.addStandardDisposableListener(this.filterInputBox.inputElement, 'keyup', (e: IKeyboardEvent) => {
if (e.equals(CommonKeybindings.ESCAPE)) {
dom.removeClass(this.filterInputBoxContainer, 'visible');
e.preventDefault();
e.stopPropagation();
}
}));
this.toDispose.push(this.filterInputBox.onDidChange((filter:string) => {
this.markersModel.filter= filter;
this.refreshPanel();
......@@ -140,11 +151,11 @@ export class MarkersPanel extends Panel {
private createActions():void {
this.collapseAllAction= this.instantiationService.createInstance(CollapseAllAction, this.tree, true);
this.showOnlyErrorsAction= new Action('workbench.markers.panel.action.toggle.errors', nls.localize('toggle.errors', "Show only errors"), 'markers-panel-action-toggle-errors', true, this.toggleShowOnlyErrors.bind(this));
this.showFilterInputAction= new Action('workbench.markers.panel.action.filter', nls.localize('filter.markers', "Filter"), 'markers-panel-action-filter', true, this.toggleFilter.bind(this));
this.toggleErrorsAction= new Action('workbench.markers.panel.action.toggle.errors', Messages.MARKERS_PANEL_ACTION_TOOLTIP_ONLY_ERRORS, 'markers-panel-action-toggle-errors-on', true, this.toggleShowOnlyErrors.bind(this));
this.showFilterInputAction= new Action('workbench.markers.panel.action.filter', Messages.MARKERS_PANEL_ACTION_TOOLTIP_FILTER, 'markers-panel-action-filter', true, this.toggleFilter.bind(this));
this.actions= [
this.showFilterInputAction,
this.showOnlyErrorsAction,
this.toggleErrorsAction,
this.collapseAllAction
];
this.actions.forEach(a => {
......@@ -152,11 +163,22 @@ export class MarkersPanel extends Panel {
});
}
private createListeners(): void {
this.toDispose.push(this.markerService.onMarkerChanged(this.onMarkerChanged.bind(this)));
this.toDispose.push(this.eventService.addListener2(EventType.COMPOSITE_OPENED, this.onPanelOpened.bind(this)));
}
private onMarkerChanged(changedResources: URI[]) {
this.updateResources(changedResources);
this.refreshPanel();
}
private onPanelOpened():void {
if (this.markersModel.filter) {
dom.addClass(this.filterInputBoxContainer, 'visible');
}
}
private updateResources(resources: URI[]) {
resources.forEach((resource) => {
let markers= this.markerService.read({resource: resource}).slice(0);
......@@ -208,9 +230,9 @@ export class MarkersPanel extends Panel {
}
private toggleShowOnlyErrors(): any {
this.markersModel.showOnlyErrors= !this.markersModel.showOnlyErrors;
this.actions[1].label= this.markersModel.showOnlyErrors ? nls.localize('toggle.all', "Show all") : nls.localize('toggle.errors', "Show only errors");
this.actions[1].class= this.markersModel.showOnlyErrors ? 'markers-panel-action-toggle-all' : 'markers-panel-action-toggle-errors';
this.markersModel.filterErrors= !this.markersModel.filterErrors;
this.actions[1].label= this.markersModel.filterErrors ? Messages.MARKERS_PANEL_ACTION_TOOLTIP_ONLY_ERRORS_OFF : Messages.MARKERS_PANEL_ACTION_TOOLTIP_ONLY_ERRORS;
this.actions[1].class= this.markersModel.filterErrors ? 'markers-panel-action-toggle-errors-off' : 'markers-panel-action-toggle-errors-on';
this.refreshPanel(true);
}
......
......@@ -44,7 +44,7 @@ export function registerContributions(): void {
'vs/workbench/parts/markers/browser/MarkersPanel',
'MarkersPanel',
Constants.MARKERS_PANEL_ID,
Messages.MARKERS_PANEL_NO_PROBLEMS,
Messages.MARKERS_PANEL_TITLE_NO_PROBLEMS,
'markersPanel'
));
......
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="3 3 16 16" enable-background="new 3 3 16 16"><polygon fill="#e8e8e8" points="12.597,11.042 15.4,13.845 13.844,15.4 11.042,12.598 8.239,15.4 6.683,13.845 9.485,11.042 6.683,8.239 8.238,6.683 11.042,9.486 13.845,6.683 15.4,8.239"/></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="3 3 16 16" enable-background="new 3 3 16 16"><polygon fill="#424242" points="12.597,11.042 15.4,13.845 13.844,15.4 11.042,12.598 8.239,15.4 6.683,13.845 9.485,11.042 6.683,8.239 8.238,6.683 11.042,9.486 13.845,6.683 15.4,8.239"/></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><g fill="#262626"><circle cx="3.5" cy="7.5" r="2.5"/><circle cx="8.5" cy="7.5" r="2.5"/><circle cx="13.5" cy="7.5" r="2.5"/></g><g fill="#C5C5C5"><circle cx="3.5" cy="7.5" r="1.5"/><circle cx="8.5" cy="7.5" r="1.5"/><circle cx="13.5" cy="7.5" r="1.5"/></g></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><g fill="#F6F6F6"><circle cx="3.5" cy="7.5" r="2.5"/><circle cx="8.5" cy="7.5" r="2.5"/><circle cx="13.5" cy="7.5" r="2.5"/></g><g fill="#424242"><circle cx="3.5" cy="7.5" r="1.5"/><circle cx="8.5" cy="7.5" r="1.5"/><circle cx="13.5" cy="7.5" r="1.5"/></g></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" height="16" width="16"><circle cx="8" cy="8" r="6" fill="#1E1E1E"/><path d="M8 3C5.238 3 3 5.238 3 8s2.238 5 5 5 5-2.238 5-5-2.238-5-5-5zm3 7l-1 1-2-2-2 2-1-1 2-2.027L5 6l1-1 2 2 2-2 1 1-2 1.973L11 10z" fill="#5D5D5D"/><path fill="#252526" d="M11 6l-1-1-2 2-2-2-1 1 2 1.973L5 10l1 1 2-2 2 2 1-1-2-2.027z"/></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><style type="text/css">.icon-canvas-transparent{opacity:0;fill:#F6F6F6;} .icon-vs-out{fill:#F6F6F6;} .icon-vs-bg{fill:#424242;}</style><path class="icon-canvas-transparent" d="M16 16h-16v-16h16v16z" id="canvas"/><path class="icon-vs-out" d="M6 16v-5.955l-5.992-8.045h15.983l-5.991 8.045v5.955h-4z" id="outline"/><path class="icon-vs-bg" d="M14 3l-5 6.714v5.286h-2v-5.286l-5-6.714h12z" id="iconBg"/></svg>
\ No newline at end of file
......@@ -5,42 +5,32 @@
.markers-panel .markers-panel-container {
height: 100%;
width: 100%;
overflow: hidden;
position: relative;
margin: 0 10px;
}
.message-box-container {
padding: 0 20px 0 20px;
.markers-panel .markers-panel-container .message-box-container {
padding-left: 10px;
display: none;
}
.markers-panel .message-box-container.visible {
.markers-panel .markers-panel-container .message-box-container.visible {
display: block;
}
.markers-panel .markers-panel-container .filter-box-container {
position: absolute;
right: 10px;
top: -40px;
width: 250px;
z-index: 10;
border: 1px solid #EFEFF2;
border-radius: 3px;
-webkit-transition: top 200ms linear;
-o-transition: top 200ms linear;
-moz-transition: top 200ms linear;
-ms-transition: top 200ms linear;
transition: top 200ms linear;
display: flex;
justify-content: flex-end;
}
.vs-dark .markers-panel .markers-panel-container .filter-box-container {
.markers-panel .markers-panel-container .input-box-container {
width: 250px;
border: 1px solid #DDD;
border-radius: 3px;
border-color: #2D2D30;
display: none;
}
.markers-panel .markers-panel-container .filter-box-container.visible {
top: 0;
.markers-panel .markers-panel-container .input-box-container.visible {
display: inline-block;
}
.markers-panel .markers-panel-container .monaco-tree .monaco-tree-row .content .marker-stats {
......@@ -55,19 +45,19 @@
}
.markers-panel-action-filter {
background: url('ellipsis.svg') top center no-repeat;
background: url('filter.svg') top center no-repeat;
}
.hc-black .markers-panel-action-filter {
background: url('ellipsis-inverse.svg') top center no-repeat;
background: url('filter.svg') top center no-repeat;
}
.vs-dark .markers-panel-action-filter {
background: url('ellipsis-inverse.svg') top center no-repeat;
background: url('filter.svg') top center no-repeat;
}
.vs .markers-panel-action-filter {
background: url('ellipsis.svg') top center no-repeat;
background: url('filter.svg') top center no-repeat;
}
.markers-panel .icon {
......@@ -83,8 +73,8 @@
background: url('status-warning.svg') center center no-repeat;
}
.markers-panel-action-toggle-errors,
.markers-panel-action-toggle-all,
.markers-panel-action-toggle-errors-on,
.markers-panel-action-toggle-errors-off,
.markers-panel .icon.error {
background: url('status-error.svg') center center no-repeat;
}
......@@ -97,8 +87,8 @@
background: url('status-warning-inverse.svg') center center no-repeat;
}
.vs-dark .markers-panel-action-toggle-errors,
.vs-dark .markers-panel-action-toggle-all,
.vs-dark .markers-panel-action-toggle-errors-on,
.vs-dark .markers-panel-action-toggle-errors-off,
.vs-dark .markers-panel .icon.error {
background: url('status-error-inverse.svg') center center no-repeat;
}
......
......@@ -21,9 +21,8 @@ export class Marker {
}
export class MarkersModel {
private markersByResource: Map.SimpleMap<URI, IMarker[]>;
public showOnlyErrors:boolean= false;
public filterErrors:boolean= false;
public filter:string= '';
constructor(markers: IMarker[]= []) {
......@@ -82,7 +81,7 @@ export class MarkersModel {
}
private filterMarker(marker: IMarker):boolean {
if (this.showOnlyErrors && Severity.Error !== marker.severity) {
if (this.filterErrors && Severity.Error !== marker.severity) {
return false;
}
if (this.filter) {
......@@ -116,7 +115,16 @@ export class MarkersModel {
public getTitle(markerStatistics: MarkerStatistics):string {
let title= MarkersModel.getStatisticsLabel(markerStatistics);
return title ? title : Messages.MARKERS_PANEL_NO_PROBLEMS;
if (!title) {
return Messages.MARKERS_PANEL_TITLE_NO_PROBLEMS;
}
if (this.filter) {
return title + ' ' + Messages.MARKERS_PANEL_TITLE_SHOWING_FILTERED;
}
if (this.filterErrors) {
return title + ' ' + Messages.MARKERS_PANEL_TITLE_SHOWING_ONLY_ERRORS;
}
return title;
}
public getMessage():string {
......@@ -127,7 +135,7 @@ export class MarkersModel {
if (this.filter) {
return Messages.MARKERS_PANEL_NO_PROBLEMS_FILTERS;
}
if (this.showOnlyErrors) {
if (this.filterErrors) {
return Messages.MARKERS_PANEL_NO_ERRORS;
}
}
......
......@@ -9,10 +9,18 @@ import nls = require('vs/nls');
export default class Messages {
public static MARKERS_PANEL_TOGGLE_LABEL:string= nls.localize('markers.panel.toggle.label', "Toggle Problems");
public static MARKERS_PANEL_NO_PROBLEMS:string= nls.localize('markers.panel.no.problems', "No problems");
public static MARKERS_PANEL_TITLE_NO_PROBLEMS:string= nls.localize('markers.panel.title.no.problems', "No problems");
public static MARKERS_PANEL_TITLE_SHOWING_ONLY_ERRORS:string= nls.localize('markers.panel.title.showing.errors', "(Showing only Errors)");
public static MARKERS_PANEL_TITLE_SHOWING_FILTERED:string= nls.localize('markers.panel.title.showing.filtered', "(Showing Filtered)");
public static MARKERS_PANEL_NO_PROBLEMS_BUILT:string= nls.localize('markers.panel.no.problems.build', "This workspace is clear or not yet built");
public static MARKERS_PANEL_NO_PROBLEMS_FILTERS:string= nls.localize('markers.panel.no.problems.filters', "No results found with provided filter criteria");
public static MARKERS_PANEL_NO_ERRORS:string= nls.localize('markers.panel.no.errors', "This workspace has no errors");
public static MARKERS_PANEL_ACTION_TOOLTIP_ONLY_ERRORS:string= nls.localize('markers.panel.action.only.errors', "Show only errors");
public static MARKERS_PANEL_ACTION_TOOLTIP_ONLY_ERRORS_OFF:string= nls.localize('markers.panel.action.only.errors.off', "Show all");
public static MARKERS_PANEL_ACTION_TOOLTIP_FILTER:string= nls.localize('markers.panel.action.filter', "Filter...");
public static MARKERS_PANEL_FILTER_PLACEHOLDER:string= nls.localize('markers.panel.filter.placeholder', "Type to Filter");
public static MARKERS_PANEL_SINGLE_ERROR_LABEL:string= nls.localize('markers.panel.single.error.label', "1 Error");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册