提交 e734a013 编写于 作者: S Sandeep Somavarapu

Composite bar: Save state on change and do not save on shutdown

上级 1c0f3a3c
......@@ -326,7 +326,6 @@ export class ActivitybarPart extends Part {
public shutdown(): void {
const state = this.viewletService.getViewlets().filter(viewlet => this.hasRegisteredViews(viewlet)).map(viewlet => ({ id: viewlet.id, iconUrl: viewlet.iconUrl }));
this.storageService.store(ActivitybarPart.PLACEHOLDER_VIEWLETS, JSON.stringify(state), StorageScope.GLOBAL);
this.compositeBar.shutdown();
super.shutdown();
}
......
......@@ -196,8 +196,6 @@ export class CompositeBar extends Widget implements ICompositeBar {
public pin(compositeId: string, open?: boolean): void {
if (this.model.setPinned(compositeId, true)) {
this.updateCompositeSwitcher();
// Persist
this.saveCompositeItems();
if (open) {
this.options.openComposite(compositeId)
......@@ -210,8 +208,6 @@ export class CompositeBar extends Widget implements ICompositeBar {
if (this.model.setPinned(compositeId, false)) {
this.updateCompositeSwitcher();
// Persist
this.saveCompositeItems();
const defaultCompositeId = this.options.getDefaultCompositeId();
......@@ -254,11 +250,7 @@ export class CompositeBar extends Widget implements ICompositeBar {
public move(compositeId: string, toCompositeId: string): void {
if (this.model.move(compositeId, toCompositeId)) {
// timeout helps to prevent artifacts from showing up
setTimeout(() => {
this.updateCompositeSwitcher();
// Persist
this.saveCompositeItems();
}, 0);
setTimeout(() => this.updateCompositeSwitcher(), 0);
}
}
......@@ -399,6 +391,9 @@ export class CompositeBar extends Widget implements ICompositeBar {
this.compositeSwitcherBar.push(this.compositeOverflowAction, { label: false, icon: true });
}
// Persist
this.saveCompositeItems();
}
private getOverflowingComposites(): { id: string, name: string }[] {
......@@ -452,10 +447,6 @@ export class CompositeBar extends Widget implements ICompositeBar {
this.storedState = this.model.toJSON();
this.storageService.store(this.options.storageId, JSON.stringify(this.storedState), StorageScope.GLOBAL);
}
public shutdown(): void {
this.saveCompositeItems();
}
}
interface ISerializedCompositeBarItem {
......
......@@ -237,11 +237,6 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
return sizes;
}
public shutdown(): void {
this.compositeBar.shutdown();
super.shutdown();
}
private layoutCompositeBar(): void {
if (this.dimension) {
let availableWidth = this.dimension.width - 40; // take padding into account
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册