提交 20acc5ec 编写于 作者: S Sandeep Somavarapu

#43645 Prepare for activity groups contribution

上级 6c223050
......@@ -83,6 +83,14 @@ namespace schema {
};
}
function getViewLocation(value: string): ViewLocation {
switch (value) {
case 'explorer': return ViewLocation.Explorer;
case 'debug': return ViewLocation.Debug;
default: return ViewLocation.get(`workbench.view.extension.${value}`) || ViewLocation.Explorer;
}
}
ExtensionsRegistry.registerExtensionPoint<{ [loc: string]: schema.IUserFriendlyViewDescriptor[] }>('views', [], schema.viewsContribution)
.setHandler((extensions) => {
for (let extension of extensions) {
......@@ -93,12 +101,7 @@ ExtensionsRegistry.registerExtensionPoint<{ [loc: string]: schema.IUserFriendlyV
return;
}
const location = ViewLocation.getContributedViewLocation(entry.key);
if (!location) {
collector.warn(localize('locationId.invalid', "`{0}` is not a valid view location", entry.key));
return;
}
const location = getViewLocation(entry.key);
const registeredViews = ViewsRegistry.getViews(location);
const viewIds = [];
const viewDescriptors = coalesce(entry.value.map(item => {
......@@ -129,4 +132,4 @@ ExtensionsRegistry.registerExtensionPoint<{ [loc: string]: schema.IUserFriendlyV
ViewsRegistry.registerViews(viewDescriptors);
});
}
});
});
\ No newline at end of file
......@@ -544,7 +544,7 @@ export class ViewsViewlet extends PanelViewlet implements IViewsViewlet {
return false;
}
if (ViewLocation.getContributedViewLocation(this.location.id)) {
if (ViewLocation.get(this.location.id)) {
let visibleViewsCount = 0;
if (this.areExtensionsReady) {
visibleViewsCount = this.getViewDescriptorsFromRegistry().reduce((visibleViewsCount, v) => visibleViewsCount + (this.canBeVisible(v) ? 1 : 0), 0);
......
......@@ -17,24 +17,23 @@ import { ThemeIcon } from 'vs/platform/theme/common/themeService';
export class ViewLocation {
static readonly Explorer = new ViewLocation('workbench.view.explorer');
static readonly Debug = new ViewLocation('workbench.view.debug');
static readonly Extensions = new ViewLocation('workbench.view.extensions');
constructor(private _id: string) {
private static locations: Map<string, ViewLocation> = new Map<string, ViewLocation>();
static register(id: string): ViewLocation {
const viewLocation = new ViewLocation(id);
ViewLocation.locations.set(id, viewLocation);
return viewLocation;
}
get id(): string {
return this._id;
static get(value: string): ViewLocation {
return ViewLocation.locations.get(value);
}
static getContributedViewLocation(value: string): ViewLocation {
switch (value) {
case 'explorer': return ViewLocation.Explorer;
case 'debug': return ViewLocation.Debug;
}
return void 0;
}
static readonly Explorer: ViewLocation = ViewLocation.register('workbench.view.explorer');
static readonly Debug: ViewLocation = ViewLocation.register('workbench.view.debug');
static readonly Extensions: ViewLocation = ViewLocation.register('workbench.view.extensions');
private constructor(private _id: string) { }
get id(): string { return this._id; }
}
export interface IViewDescriptor {
......
......@@ -146,11 +146,7 @@ export class ViewPickerHandler extends QuickOpenHandler {
// Views
viewlets.forEach((viewlet, index) => {
const viewLocation: ViewLocation = viewlet.id === EXPLORER_VIEWLET_ID ? ViewLocation.Explorer
: viewlet.id === DEBUG_VIEWLET_ID ? ViewLocation.Debug
: viewlet.id === EXTENSIONS_VIEWLET_ID ? ViewLocation.Extensions
: null;
const viewLocation: ViewLocation = ViewLocation.get(viewlet.id);
if (viewLocation) {
const viewEntriesForViewlet: ViewEntry[] = getViewEntriesForViewlet(viewlet, viewLocation);
viewEntries.push(...viewEntriesForViewlet);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册