提交 867a5edd 编写于 作者: I isidor

activitybar: add panels

上级 06046e08
...@@ -17,7 +17,7 @@ import {Registry} from 'vs/platform/platform'; ...@@ -17,7 +17,7 @@ import {Registry} from 'vs/platform/platform';
import {IViewlet} from 'vs/workbench/common/viewlet'; import {IViewlet} from 'vs/workbench/common/viewlet';
import {ViewletDescriptor, ViewletRegistry, Extensions as ViewletExtensions, Viewlet} from 'vs/workbench/browser/viewlet'; import {ViewletDescriptor, ViewletRegistry, Extensions as ViewletExtensions, Viewlet} from 'vs/workbench/browser/viewlet';
import {CompositeDescriptor, Composite} from 'vs/workbench/browser/composite'; import {CompositeDescriptor, Composite} from 'vs/workbench/browser/composite';
import {Panel} from 'vs/workbench/browser/panel'; import {Panel, PanelRegistry, Extensions as PanelExtensions} from 'vs/workbench/browser/panel';
import {Part} from 'vs/workbench/browser/part'; import {Part} from 'vs/workbench/browser/part';
import {ActivityAction, ActivityActionItem} from 'vs/workbench/browser/parts/activitybar/activityAction'; import {ActivityAction, ActivityActionItem} from 'vs/workbench/browser/parts/activitybar/activityAction';
import {IViewletService} from 'vs/workbench/services/viewlet/common/viewletService'; import {IViewletService} from 'vs/workbench/services/viewlet/common/viewletService';
...@@ -120,8 +120,8 @@ export class ActivitybarPart extends Part implements IActivityService { ...@@ -120,8 +120,8 @@ export class ActivitybarPart extends Part implements IActivityService {
// Build Viewlet Actions in correct order // Build Viewlet Actions in correct order
const activeViewlet = this.viewletService.getActiveViewlet(); const activeViewlet = this.viewletService.getActiveViewlet();
const activePanel = this.panelService.getActivePanel(); const activePanel = this.panelService.getActivePanel();
const registry = (<ViewletRegistry>Registry.as(ViewletExtensions.Viewlets)); const allViewlets = (<ViewletRegistry>Registry.as(ViewletExtensions.Viewlets)).getViewlets().sort((v1, v2) => v1.order - v2.order);
const allViewletActions = registry.getViewlets(); const allPanels = (<PanelRegistry>Registry.as(PanelExtensions.Panels)).getPanels().sort((p1, p2) => p1.order - p2.order);
const actionOptions = { label: true, icon: true }; const actionOptions = { label: true, icon: true };
const toAction = (composite: CompositeDescriptor<Viewlet | Panel>) => { const toAction = (composite: CompositeDescriptor<Viewlet | Panel>) => {
...@@ -145,11 +145,9 @@ export class ActivitybarPart extends Part implements IActivityService { ...@@ -145,11 +145,9 @@ export class ActivitybarPart extends Part implements IActivityService {
return action; return action;
}; };
// Add to viewlet switcher // Add both viewlet and panel actions to the switcher
this.compositeSwitcherBar.push(allViewletActions const allActions = allViewlets.concat(allPanels).map(toAction);
.sort((v1, v2) => v1.order - v2.order) this.compositeSwitcherBar.push(allActions, actionOptions);
.map(toAction)
, actionOptions);
} }
public dispose(): void { public dispose(): void {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册