提交 d6f0a591 编写于 作者: I isidor

panel and viewlet enablement rename

上级 5cccdbbc
...@@ -86,7 +86,7 @@ export class ActivitybarPart extends Part { ...@@ -86,7 +86,7 @@ export class ActivitybarPart extends Part {
// Deactivate viewlet action on close // Deactivate viewlet action on close
this.toUnbind.push(this.viewletService.onDidViewletClose(viewlet => this.compositeBar.deactivateComposite(viewlet.getId()))); this.toUnbind.push(this.viewletService.onDidViewletClose(viewlet => this.compositeBar.deactivateComposite(viewlet.getId())));
this.toUnbind.push(this.compositeBar.onDidContextMenu(e => this.showContextMenu(e))); this.toUnbind.push(this.compositeBar.onDidContextMenu(e => this.showContextMenu(e)));
this.toUnbind.push(this.viewletService.onDidViewletEnable(({ id, enabled }) => { this.toUnbind.push(this.viewletService.onDidViewletEnablementChange(({ id, enabled }) => {
if (enabled) { if (enabled) {
this.compositeBar.addComposite(this.viewletService.getViewlet(id)); this.compositeBar.addComposite(this.viewletService.getViewlet(id));
} else { } else {
......
...@@ -175,7 +175,7 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService { ...@@ -175,7 +175,7 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
.sort((v1, v2) => v1.order - v2.order); .sort((v1, v2) => v1.order - v2.order);
} }
public enablePanel(id: string, enabled: boolean): void { public setPanelEnablement(id: string, enabled: boolean): void {
const descriptor = Registry.as<PanelRegistry>(PanelExtensions.Panels).getPanels().filter(p => p.id === id).pop(); const descriptor = Registry.as<PanelRegistry>(PanelExtensions.Panels).getPanels().filter(p => p.id === id).pop();
if (descriptor && descriptor.enabled !== enabled) { if (descriptor && descriptor.enabled !== enabled) {
descriptor.enabled = enabled; descriptor.enabled = enabled;
......
...@@ -109,12 +109,12 @@ export class ReplaceService implements IReplaceService { ...@@ -109,12 +109,12 @@ export class ReplaceService implements IReplaceService {
const updateSearchViewLocation = () => { const updateSearchViewLocation = () => {
const config = configurationService.getValue<ISearchConfiguration>(); const config = configurationService.getValue<ISearchConfiguration>();
if (config.search.location === 'panel') { if (config.search.location === 'panel') {
viewletService.enableViewlet(VIEW_ID, false); viewletService.setViewletEnablement(VIEW_ID, false);
panelService.enablePanel(VIEW_ID, true); panelService.setPanelEnablement(VIEW_ID, true);
} }
if (config.search.location === 'sidebar') { if (config.search.location === 'sidebar') {
panelService.enablePanel(VIEW_ID, false); panelService.setPanelEnablement(VIEW_ID, false);
viewletService.enableViewlet(VIEW_ID, true); viewletService.setViewletEnablement(VIEW_ID, true);
} }
}; };
configurationService.onDidChangeConfiguration(e => { configurationService.onDidChangeConfiguration(e => {
......
...@@ -42,5 +42,5 @@ export interface IPanelService { ...@@ -42,5 +42,5 @@ export interface IPanelService {
* Enables or disables a panel. Disabled panels are completly hidden from UI. * Enables or disables a panel. Disabled panels are completly hidden from UI.
* By default all panels are enabled. * By default all panels are enabled.
*/ */
enablePanel(id: string, enabled: boolean): void; setPanelEnablement(id: string, enabled: boolean): void;
} }
...@@ -28,7 +28,7 @@ class TestViewletService implements IViewletService { ...@@ -28,7 +28,7 @@ class TestViewletService implements IViewletService {
onDidViewletOpen = this.onDidViewletOpenEmitter.event; onDidViewletOpen = this.onDidViewletOpenEmitter.event;
onDidViewletClose = this.onDidViewletCloseEmitter.event; onDidViewletClose = this.onDidViewletCloseEmitter.event;
onDidViewletEnable = this.onDidViewletEnableEmitter.event; onDidViewletEnablementChange = this.onDidViewletEnableEmitter.event;
public openViewlet(id: string, focus?: boolean): TPromise<IViewlet> { public openViewlet(id: string, focus?: boolean): TPromise<IViewlet> {
return TPromise.as(null); return TPromise.as(null);
...@@ -41,7 +41,7 @@ class TestViewletService implements IViewletService { ...@@ -41,7 +41,7 @@ class TestViewletService implements IViewletService {
public getActiveViewlet(): IViewlet { public getActiveViewlet(): IViewlet {
return activeViewlet; return activeViewlet;
} }
public enableViewlet(id: string, enabled: boolean): void { } public setViewletEnablement(id: string, enabled: boolean): void { }
public dispose() { public dispose() {
} }
...@@ -77,7 +77,7 @@ class TestPanelService implements IPanelService { ...@@ -77,7 +77,7 @@ class TestPanelService implements IPanelService {
return activeViewlet; return activeViewlet;
} }
public enablePanel(id: string, enabled: boolean): void { } public setPanelEnablement(id: string, enabled: boolean): void { }
public dispose() { public dispose() {
} }
......
...@@ -18,7 +18,7 @@ export interface IViewletService { ...@@ -18,7 +18,7 @@ export interface IViewletService {
onDidViewletOpen: Event<IViewlet>; onDidViewletOpen: Event<IViewlet>;
onDidViewletClose: Event<IViewlet>; onDidViewletClose: Event<IViewlet>;
onDidViewletEnable: Event<{ id: string, enabled: boolean }>; onDidViewletEnablementChange: Event<{ id: string, enabled: boolean }>;
/** /**
* Opens a viewlet with the given identifier and pass keyboard focus to it if specified. * Opens a viewlet with the given identifier and pass keyboard focus to it if specified.
...@@ -49,7 +49,7 @@ export interface IViewletService { ...@@ -49,7 +49,7 @@ export interface IViewletService {
* Enables or disables a viewlet. Disabled viewlets are completly hidden from UI. * Enables or disables a viewlet. Disabled viewlets are completly hidden from UI.
* By default all viewlets are enabled. * By default all viewlets are enabled.
*/ */
enableViewlet(id: string, enabled: boolean): void; setViewletEnablement(id: string, enabled: boolean): void;
/** /**
* *
......
...@@ -35,7 +35,7 @@ export class ViewletService implements IViewletService { ...@@ -35,7 +35,7 @@ export class ViewletService implements IViewletService {
public get onDidViewletOpen(): Event<IViewlet> { return this.sidebarPart.onDidViewletOpen; } public get onDidViewletOpen(): Event<IViewlet> { return this.sidebarPart.onDidViewletOpen; }
public get onDidViewletClose(): Event<IViewlet> { return this.sidebarPart.onDidViewletClose; } public get onDidViewletClose(): Event<IViewlet> { return this.sidebarPart.onDidViewletClose; }
public get onDidViewletEnable(): Event<{ id: string, enabled: boolean }> { return this._onDidViewletEnable.event; } public get onDidViewletEnablementChange(): Event<{ id: string, enabled: boolean }> { return this._onDidViewletEnable.event; }
constructor( constructor(
sidebarPart: SidebarPart, sidebarPart: SidebarPart,
...@@ -84,7 +84,7 @@ export class ViewletService implements IViewletService { ...@@ -84,7 +84,7 @@ export class ViewletService implements IViewletService {
}); });
} }
public enableViewlet(id: string, enabled: boolean): void { public setViewletEnablement(id: string, enabled: boolean): void {
const descriptor = this.getBuiltInViewlets().filter(desc => desc.id === id).pop(); const descriptor = this.getBuiltInViewlets().filter(desc => desc.id === id).pop();
if (descriptor && descriptor.enabled !== enabled) { if (descriptor && descriptor.enabled !== enabled) {
descriptor.enabled = enabled; descriptor.enabled = enabled;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册