mirror of
https://github.com/Microsoft/vscode
synced 2024-09-13 21:55:38 +00:00
compositeBar: addComposite, removeComposite
This commit is contained in:
parent
08e2d7581e
commit
ff5c1edc63
|
@ -96,15 +96,7 @@ export class ActivitybarPart extends Part {
|
|||
if (location === 'sidebar') {
|
||||
this.compositeBar.addComposite(this.viewletService.getViewlet(SEARCH_VIEW_ID));
|
||||
} else {
|
||||
let promise: TPromise<any> = TPromise.as(null);
|
||||
const activeViewlet = this.viewletService.getActiveViewlet();
|
||||
if (activeViewlet && activeViewlet.getId() === SEARCH_VIEW_ID) {
|
||||
promise = this.viewletService.openViewlet(this.viewletService.getDefaultViewletId());
|
||||
}
|
||||
|
||||
promise.then(() => {
|
||||
this.compositeBar.removeComposite(SEARCH_VIEW_ID);
|
||||
});
|
||||
this.compositeBar.removeComposite(SEARCH_VIEW_ID);
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
|
|
@ -82,11 +82,21 @@ export class CompositeBar implements ICompositeBar {
|
|||
}
|
||||
|
||||
public addComposite(compositeData: { id: string; name: string }): void {
|
||||
// todo@isidor
|
||||
if (this.options.composites.filter(c => c.id === compositeData.id).length) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.options.composites.push(compositeData);
|
||||
this.pin(compositeData.id);
|
||||
}
|
||||
|
||||
public removeComposite(id: string): void {
|
||||
// todo@isidor
|
||||
if (this.options.composites.filter(c => c.id === id).length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.options.composites = this.options.composites.filter(c => c.id !== id);
|
||||
this.unpin(id);
|
||||
}
|
||||
|
||||
public activateComposite(id: string): void {
|
||||
|
|
|
@ -119,15 +119,7 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
|
|||
if (location === 'panel') {
|
||||
this.compositeBar.addComposite(this.getPanel(SEARCH_VIEW_ID));
|
||||
} else {
|
||||
let promise: TPromise<any> = TPromise.as(null);
|
||||
const activePanel = this.getActivePanel();
|
||||
if (activePanel && activePanel.getId() === SEARCH_VIEW_ID) {
|
||||
promise = this.openPanel(Registry.as<PanelRegistry>(PanelExtensions.Panels).getDefaultPanelId());
|
||||
}
|
||||
|
||||
promise.then(() => {
|
||||
this.compositeBar.removeComposite(SEARCH_VIEW_ID);
|
||||
});
|
||||
this.compositeBar.removeComposite(SEARCH_VIEW_ID);
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
|
Loading…
Reference in a new issue