提交 1a165ea9 编写于 作者: S Sandeep Somavarapu

#30120 Let debug and extension views to be display toggled

上级 57583bff
......@@ -42,7 +42,7 @@ export class DebugViewlet extends ComposedViewsViewlet {
@IContextMenuService contextMenuService: IContextMenuService,
@IExtensionService extensionService: IExtensionService
) {
super(VIEWLET_ID, ViewLocation.Debug, `${VIEWLET_ID}.state`, telemetryService, storageService, instantiationService, themeService, contextService, contextKeyService, contextMenuService, extensionService);
super(VIEWLET_ID, ViewLocation.Debug, `${VIEWLET_ID}.state`, false, telemetryService, storageService, instantiationService, themeService, contextService, contextKeyService, contextMenuService, extensionService);
this.progressRunner = null;
......
......@@ -94,10 +94,10 @@ Registry.as<PanelRegistry>(PanelExtensions.Panels).registerPanel(new PanelDescri
Registry.as<PanelRegistry>(PanelExtensions.Panels).setDefaultPanelId(REPL_ID);
// Register default debug views
ViewsRegistry.registerViews([{ id: 'workbench.debug.variablesView', name: '', ctor: VariablesView, order: 10, size: 40, location: ViewLocation.Debug }]);
ViewsRegistry.registerViews([{ id: 'workbench.debug.watchExpressionsView', name: '', ctor: WatchExpressionsView, order: 20, size: 10, location: ViewLocation.Debug }]);
ViewsRegistry.registerViews([{ id: 'workbench.debug.callStackView', name: '', ctor: CallStackView, order: 30, size: 30, location: ViewLocation.Debug }]);
ViewsRegistry.registerViews([{ id: 'workbench.debug.breakPointsView', name: '', ctor: BreakpointsView, order: 40, size: 20, location: ViewLocation.Debug }]);
ViewsRegistry.registerViews([{ id: 'workbench.debug.variablesView', name: nls.localize('variables', "Variables"), ctor: VariablesView, order: 10, size: 40, location: ViewLocation.Debug, canToggleVisibility: true }]);
ViewsRegistry.registerViews([{ id: 'workbench.debug.watchExpressionsView', name: nls.localize('watch', "Watch"), ctor: WatchExpressionsView, order: 20, size: 10, location: ViewLocation.Debug, canToggleVisibility: true }]);
ViewsRegistry.registerViews([{ id: 'workbench.debug.callStackView', name: nls.localize('callStack', "Call Stack"), ctor: CallStackView, order: 30, size: 30, location: ViewLocation.Debug, canToggleVisibility: true }]);
ViewsRegistry.registerViews([{ id: 'workbench.debug.breakPointsView', name: nls.localize('breakpoints', "Breakpoints"), ctor: BreakpointsView, order: 40, size: 20, location: ViewLocation.Debug, canToggleVisibility: true }]);
// register action to open viewlet
const registry = Registry.as<IWorkbenchActionRegistry>(WorkbenchActionRegistryExtensions.WorkbenchActions);
......
......@@ -50,7 +50,7 @@ export class VariablesView extends CollapsibleView {
private settings: any;
constructor(
options: IViewletViewOptions,
private options: IViewletViewOptions,
@IContextMenuService contextMenuService: IContextMenuService,
@ITelemetryService private telemetryService: ITelemetryService,
@IDebugService private debugService: IDebugService,
......@@ -85,7 +85,7 @@ export class VariablesView extends CollapsibleView {
public renderHeader(container: HTMLElement): void {
const titleDiv = $('div.title').appendTo(container);
$('span').text(nls.localize('variables', "Variables")).appendTo(titleDiv);
$('span').text(this.options.name).appendTo(titleDiv);
super.renderHeader(container);
}
......@@ -159,7 +159,7 @@ export class WatchExpressionsView extends CollapsibleView {
private settings: any;
constructor(
options: IViewletViewOptions,
private options: IViewletViewOptions,
@IContextMenuService contextMenuService: IContextMenuService,
@IDebugService private debugService: IDebugService,
@IKeybindingService keybindingService: IKeybindingService,
......@@ -188,7 +188,7 @@ export class WatchExpressionsView extends CollapsibleView {
public renderHeader(container: HTMLElement): void {
const titleDiv = $('div.title').appendTo(container);
$('span').text(nls.localize('watch', "Watch")).appendTo(titleDiv);
$('span').text(this.options.name).appendTo(titleDiv);
super.renderHeader(container);
}
......@@ -258,7 +258,7 @@ export class CallStackView extends CollapsibleView {
private settings: any;
constructor(
options: IViewletViewOptions,
private options: IViewletViewOptions,
@IContextMenuService contextMenuService: IContextMenuService,
@ITelemetryService private telemetryService: ITelemetryService,
@IDebugService private debugService: IDebugService,
......@@ -300,7 +300,7 @@ export class CallStackView extends CollapsibleView {
public renderHeader(container: HTMLElement): void {
const title = $('div.debug-call-stack-title').appendTo(container);
$('span.title').text(nls.localize('callStack', "Call Stack")).appendTo(title);
$('span.title').text(this.options.name).appendTo(title);
this.pauseMessage = $('span.pause-message').appendTo(title);
this.pauseMessage.hide();
this.pauseMessageLabel = $('span.label').appendTo(this.pauseMessage);
......@@ -392,7 +392,7 @@ export class BreakpointsView extends CollapsibleView {
private settings: any;
constructor(
options: IViewletViewOptions,
private options: IViewletViewOptions,
@IContextMenuService contextMenuService: IContextMenuService,
@IDebugService private debugService: IDebugService,
@IKeybindingService keybindingService: IKeybindingService,
......@@ -415,7 +415,7 @@ export class BreakpointsView extends CollapsibleView {
public renderHeader(container: HTMLElement): void {
const titleDiv = $('div.title').appendTo(container);
$('span').text(nls.localize('breakpoints', "Breakpoints")).appendTo(titleDiv);
$('span').text(this.options.name).appendTo(titleDiv);
super.renderHeader(container);
}
......
......@@ -97,7 +97,7 @@ export class ExtensionsViewlet extends ComposedViewsViewlet implements IExtensio
@IContextMenuService contextMenuService: IContextMenuService,
@IExtensionService extensionService: IExtensionService
) {
super(VIEWLET_ID, ViewLocation.Extensions, `${VIEWLET_ID}.state`, telemetryService, storageService, instantiationService, themeService, contextService, contextKeyService, contextMenuService, extensionService);
super(VIEWLET_ID, ViewLocation.Extensions, `${VIEWLET_ID}.state`, true, telemetryService, storageService, instantiationService, themeService, contextService, contextKeyService, contextMenuService, extensionService);
this.registerViews();
this.searchDelayer = new ThrottledDelayer(500);
......@@ -167,7 +167,8 @@ export class ExtensionsViewlet extends ComposedViewsViewlet implements IExtensio
location: ViewLocation.Extensions,
ctor: RecommendedExtensionsView,
when: ContextKeyExpr.not('searchExtensions'),
size: 50
size: 50,
canToggleVisibility: true
};
}
......@@ -307,7 +308,13 @@ export class ExtensionsViewlet extends ComposedViewsViewlet implements IExtensio
this.searchRecommendedExtensionsContextKey.set(RecommendedExtensionsView.isRecommendedExtensionsQuery(value));
await this.updateViews();
await this.progress(TPromise.join(this.views.map(view => (<ExtensionsListView>view).show(value))));
}
protected async updateViews(): TPromise<void> {
const created = await super.updateViews();
if (created.length) {
await this.progress(TPromise.join(created.map(view => (<ExtensionsListView>view).show(this.searchBox.value))));
}
}
private count(): number {
......
......@@ -57,7 +57,7 @@ export class ExplorerViewlet extends ComposedViewsViewlet {
@IContextMenuService contextMenuService: IContextMenuService,
@IExtensionService extensionService: IExtensionService
) {
super(VIEWLET_ID, ViewLocation.Explorer, ExplorerViewlet.EXPLORER_VIEWS_STATE, telemetryService, storageService, instantiationService, themeService, contextService, contextKeyService, contextMenuService, extensionService);
super(VIEWLET_ID, ViewLocation.Explorer, ExplorerViewlet.EXPLORER_VIEWS_STATE, true, telemetryService, storageService, instantiationService, themeService, contextService, contextKeyService, contextMenuService, extensionService);
this.viewletState = new FileViewletState();
this.viewletVisibleContextKey = ExplorerViewletVisibleContext.bindTo(contextKeyService);
......
......@@ -325,6 +325,7 @@ export class ComposedViewsViewlet extends Viewlet {
id: string,
private location: ViewLocation,
private viewletStateStorageId: string,
private showHeaderInTitleWhenSingleView: boolean,
@ITelemetryService telemetryService: ITelemetryService,
@IStorageService protected storageService: IStorageService,
@IInstantiationService protected instantiationService: IInstantiationService,
......@@ -366,21 +367,21 @@ export class ComposedViewsViewlet extends Viewlet {
public getTitle(): string {
let title = Registry.as<ViewletRegistry>(Extensions.Viewlets).getViewlet(this.getId()).name;
if (this.hasSingleView() && this.splitView.getViews<IView>()[0]) {
if (this.showHeaderInTitleArea() && this.splitView.getViews<IView>()[0]) {
title += ': ' + this.splitView.getViews<IView>()[0].name;
}
return title;
}
public getActions(): IAction[] {
if (this.hasSingleView() && this.splitView.getViews<IView>()[0]) {
if (this.showHeaderInTitleArea() && this.splitView.getViews<IView>()[0]) {
return this.splitView.getViews<IView>()[0].getActions();
}
return [];
}
public getSecondaryActions(): IAction[] {
if (this.hasSingleView() && this.splitView.getViews<IView>()[0]) {
if (this.showHeaderInTitleArea() && this.splitView.getViews<IView>()[0]) {
return this.splitView.getViews<IView>()[0].getSecondaryActions();
}
return [];
......@@ -451,7 +452,7 @@ export class ComposedViewsViewlet extends Viewlet {
this.updateViews();
}
private onViewDescriptorsChanged(): TPromise<void> {
private onViewDescriptorsChanged(): TPromise<any> {
this.viewsContextKeys.clear();
for (const viewDescriptor of this.getViewDescriptorsFromRegistry()) {
if (viewDescriptor.when) {
......@@ -481,7 +482,7 @@ export class ComposedViewsViewlet extends Viewlet {
}
}
protected updateViews(): TPromise<void> {
protected updateViews(): TPromise<IView[]> {
if (this.splitView) {
const registeredViews = this.getViewDescriptorsFromRegistry();
......@@ -543,10 +544,11 @@ export class ComposedViewsViewlet extends Viewlet {
}
return TPromise.join(toCreate.map(view => view.create()))
.then(() => this.onViewsUpdated());
.then(() => this.onViewsUpdated())
.then(() => toCreate);
}
}
return TPromise.as(null);
return TPromise.as([]);
}
private attachViewStyler(widget: IThemable, options?: { noContrastBorder?: boolean }): IDisposable {
......@@ -580,7 +582,7 @@ export class ComposedViewsViewlet extends Viewlet {
return TPromise.as(null);
}
if (this.hasSingleView()) {
if (this.showHeaderInTitleArea()) {
if (this.splitView.getViews<IView>()[0]) {
this.splitView.getViews<IView>()[0].hideHeader();
if (!this.splitView.getViews<IView>()[0].isExpanded()) {
......@@ -597,10 +599,16 @@ export class ComposedViewsViewlet extends Viewlet {
this.updateTitleArea();
this.viewHeaderContextMenuListeners = dispose(this.viewHeaderContextMenuListeners);
for (const viewDescriptor of this.getVisibilityManageableViewDescriptors()) {
for (const viewDescriptor of this.getViewDescriptorsFromRegistry()) {
const view = this.getView(viewDescriptor.id);
if (view) {
this.viewHeaderContextMenuListeners.push(DOM.addDisposableListener(view.getHeaderElement(), DOM.EventType.CONTEXT_MENU, (e) => this.onContextMenu(new StandardMouseEvent(e), view)));
this.viewHeaderContextMenuListeners.push(DOM.addDisposableListener(view.getHeaderElement(), DOM.EventType.CONTEXT_MENU, e => {
e.stopPropagation();
e.preventDefault();
if (viewDescriptor.canToggleVisibility) {
this.onContextMenu(new StandardMouseEvent(e), view);
}
}));
}
}
......@@ -627,7 +635,10 @@ export class ComposedViewsViewlet extends Viewlet {
});
}
private hasSingleView(): boolean {
private showHeaderInTitleArea(): boolean {
if (!this.showHeaderInTitleWhenSingleView) {
return false;
}
if (this.splitView.getViews<IView>().length > 1) {
return false;
}
......@@ -693,7 +704,7 @@ export class ComposedViewsViewlet extends Viewlet {
}
protected get views(): IView[] {
return this.splitView.getViews<IView>();
return this.splitView ? this.splitView.getViews<IView>() : [];
}
protected getView(id: string): IView {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册