mirror of
https://github.com/Microsoft/vscode
synced 2024-08-28 05:19:39 +00:00
rename
This commit is contained in:
parent
61b9a88e52
commit
759fec1680
|
@ -8,7 +8,7 @@ import { forEach } from 'vs/base/common/collections';
|
|||
import { IJSONSchema } from 'vs/base/common/jsonSchema';
|
||||
import { ExtensionMessageCollector, ExtensionsRegistry, IExtensionPoint } from 'vs/workbench/services/extensions/common/extensionsRegistry';
|
||||
import { ViewContainer, ViewsRegistry, ICustomViewDescriptor, IViewContainersRegistry, Extensions as ViewContainerExtensions } from 'vs/workbench/common/views';
|
||||
import { CustomTreeViewPanel, CustomTreeViewer } from 'vs/workbench/browser/parts/views/customView';
|
||||
import { CustomTreeViewPanel, CustomTreeView } from 'vs/workbench/browser/parts/views/customView';
|
||||
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { coalesce, } from 'vs/base/common/arrays';
|
||||
import { viewsContainersExtensionPoint } from 'vs/workbench/api/browser/viewsContainersExtensionPoint';
|
||||
|
@ -131,7 +131,7 @@ class ViewsContainersExtensionHandler implements IWorkbenchContribution {
|
|||
when: ContextKeyExpr.deserialize(item.when),
|
||||
canToggleVisibility: true,
|
||||
collapsed: this.showCollapsed(container),
|
||||
treeViewer: this.instantiationService.createInstance(CustomTreeViewer, item.id, container),
|
||||
treeView: this.instantiationService.createInstance(CustomTreeView, item.id, container),
|
||||
order: extension.description.id === container.extensionId ? index + 1 : void 0
|
||||
};
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { ExtHostContext, MainThreadTreeViewsShape, ExtHostTreeViewsShape, MainContext, IExtHostContext } from '../node/extHost.protocol';
|
||||
import { ITreeViewDataProvider, ITreeItem, IViewsService, ITreeViewer, ViewsRegistry, ICustomViewDescriptor, IRevealOptions } from 'vs/workbench/common/views';
|
||||
import { ITreeViewDataProvider, ITreeItem, IViewsService, ITreeView, ViewsRegistry, ICustomViewDescriptor, IRevealOptions } from 'vs/workbench/common/views';
|
||||
import { extHostNamedCustomer } from 'vs/workbench/api/electron-browser/extHostCustomers';
|
||||
import { distinct } from 'vs/base/common/arrays';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
|
@ -29,7 +29,7 @@ export class MainThreadTreeViews extends Disposable implements MainThreadTreeVie
|
|||
$registerTreeViewDataProvider(treeViewId: string, options: { showCollapseAll: boolean }): void {
|
||||
const dataProvider = new TreeViewDataProvider(treeViewId, this._proxy, this.notificationService);
|
||||
this._dataProviders.set(treeViewId, dataProvider);
|
||||
const viewer = this.getTreeViewer(treeViewId);
|
||||
const viewer = this.getTreeView(treeViewId);
|
||||
if (viewer) {
|
||||
viewer.dataProvider = dataProvider;
|
||||
viewer.showCollapseAllAction = !!options.showCollapseAll;
|
||||
|
@ -43,13 +43,13 @@ export class MainThreadTreeViews extends Disposable implements MainThreadTreeVie
|
|||
$reveal(treeViewId: string, item: ITreeItem, parentChain: ITreeItem[], options: IRevealOptions): Thenable<void> {
|
||||
return this.viewsService.openView(treeViewId, options.focus)
|
||||
.then(() => {
|
||||
const viewer = this.getTreeViewer(treeViewId);
|
||||
const viewer = this.getTreeView(treeViewId);
|
||||
return this.reveal(viewer, this._dataProviders.get(treeViewId), item, parentChain, options);
|
||||
});
|
||||
}
|
||||
|
||||
$refresh(treeViewId: string, itemsToRefreshByHandle: { [treeItemHandle: string]: ITreeItem }): Thenable<void> {
|
||||
const viewer = this.getTreeViewer(treeViewId);
|
||||
const viewer = this.getTreeView(treeViewId);
|
||||
const dataProvider = this._dataProviders.get(treeViewId);
|
||||
if (viewer && dataProvider) {
|
||||
const itemsToRefresh = dataProvider.getItemsToRefresh(itemsToRefreshByHandle);
|
||||
|
@ -58,7 +58,7 @@ export class MainThreadTreeViews extends Disposable implements MainThreadTreeVie
|
|||
return null;
|
||||
}
|
||||
|
||||
private async reveal(treeViewer: ITreeViewer, dataProvider: TreeViewDataProvider, item: ITreeItem, parentChain: ITreeItem[], options: IRevealOptions): Promise<void> {
|
||||
private async reveal(treeView: ITreeView, dataProvider: TreeViewDataProvider, item: ITreeItem, parentChain: ITreeItem[], options: IRevealOptions): Promise<void> {
|
||||
options = options ? options : { select: false, focus: false };
|
||||
const select = isUndefinedOrNull(options.select) ? false : options.select;
|
||||
const focus = isUndefinedOrNull(options.focus) ? false : options.focus;
|
||||
|
@ -66,23 +66,23 @@ export class MainThreadTreeViews extends Disposable implements MainThreadTreeVie
|
|||
|
||||
if (dataProvider.isEmpty()) {
|
||||
// Refresh if empty
|
||||
await treeViewer.refresh();
|
||||
await treeView.refresh();
|
||||
}
|
||||
for (const parent of parentChain) {
|
||||
await treeViewer.expand(parent);
|
||||
await treeView.expand(parent);
|
||||
}
|
||||
item = dataProvider.getItem(item.handle);
|
||||
if (item) {
|
||||
await treeViewer.reveal(item);
|
||||
await treeView.reveal(item);
|
||||
if (select) {
|
||||
treeViewer.setSelection([item]);
|
||||
treeView.setSelection([item]);
|
||||
}
|
||||
if (focus) {
|
||||
treeViewer.setFocus(item);
|
||||
treeView.setFocus(item);
|
||||
}
|
||||
let itemsToExpand = [item];
|
||||
for (; itemsToExpand.length > 0 && expand > 0; expand--) {
|
||||
await treeViewer.expand(itemsToExpand);
|
||||
await treeView.expand(itemsToExpand);
|
||||
itemsToExpand = itemsToExpand.reduce((result, item) => {
|
||||
item = dataProvider.getItem(item.handle);
|
||||
if (item && item.children && item.children.length) {
|
||||
|
@ -94,23 +94,23 @@ export class MainThreadTreeViews extends Disposable implements MainThreadTreeVie
|
|||
}
|
||||
}
|
||||
|
||||
private registerListeners(treeViewId: string, treeViewer: ITreeViewer): void {
|
||||
this._register(treeViewer.onDidExpandItem(item => this._proxy.$setExpanded(treeViewId, item.handle, true)));
|
||||
this._register(treeViewer.onDidCollapseItem(item => this._proxy.$setExpanded(treeViewId, item.handle, false)));
|
||||
this._register(treeViewer.onDidChangeSelection(items => this._proxy.$setSelection(treeViewId, items.map(({ handle }) => handle))));
|
||||
this._register(treeViewer.onDidChangeVisibility(isVisible => this._proxy.$setVisible(treeViewId, isVisible)));
|
||||
private registerListeners(treeViewId: string, treeView: ITreeView): void {
|
||||
this._register(treeView.onDidExpandItem(item => this._proxy.$setExpanded(treeViewId, item.handle, true)));
|
||||
this._register(treeView.onDidCollapseItem(item => this._proxy.$setExpanded(treeViewId, item.handle, false)));
|
||||
this._register(treeView.onDidChangeSelection(items => this._proxy.$setSelection(treeViewId, items.map(({ handle }) => handle))));
|
||||
this._register(treeView.onDidChangeVisibility(isVisible => this._proxy.$setVisible(treeViewId, isVisible)));
|
||||
}
|
||||
|
||||
private getTreeViewer(treeViewId: string): ITreeViewer {
|
||||
private getTreeView(treeViewId: string): ITreeView {
|
||||
const viewDescriptor: ICustomViewDescriptor = <ICustomViewDescriptor>ViewsRegistry.getView(treeViewId);
|
||||
return viewDescriptor ? viewDescriptor.treeViewer : null;
|
||||
return viewDescriptor ? viewDescriptor.treeView : null;
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
this._dataProviders.forEach((dataProvider, treeViewId) => {
|
||||
const treeViewer = this.getTreeViewer(treeViewId);
|
||||
if (treeViewer) {
|
||||
treeViewer.dataProvider = null;
|
||||
const treeView = this.getTreeView(treeViewId);
|
||||
if (treeView) {
|
||||
treeView.dataProvider = null;
|
||||
}
|
||||
});
|
||||
this._dataProviders.clear();
|
||||
|
|
|
@ -74,7 +74,7 @@ export class ExtHostTreeViews implements ExtHostTreeViewsShape {
|
|||
checkProposedApiEnabled(extension);
|
||||
}
|
||||
|
||||
const treeView = this.createExtHostTreeViewer(viewId, options, extension);
|
||||
const treeView = this.createExtHostTreeView(viewId, options, extension);
|
||||
return {
|
||||
get onDidCollapseElement() { return treeView.onDidCollapseElement; },
|
||||
get onDidExpandElement() { return treeView.onDidExpandElement; },
|
||||
|
@ -124,7 +124,7 @@ export class ExtHostTreeViews implements ExtHostTreeViewsShape {
|
|||
treeView.setVisible(isVisible);
|
||||
}
|
||||
|
||||
private createExtHostTreeViewer<T>(id: string, options: vscode.TreeViewOptions<T>, extension: IExtensionDescription): ExtHostTreeView<T> {
|
||||
private createExtHostTreeView<T>(id: string, options: vscode.TreeViewOptions<T>, extension: IExtensionDescription): ExtHostTreeView<T> {
|
||||
const treeView = new ExtHostTreeView<T>(id, options, this._proxy, this.commands.converter, this.logService, extension);
|
||||
this.treeViews.set(id, treeView);
|
||||
return treeView;
|
||||
|
|
|
@ -13,7 +13,7 @@ import { IContextMenuService } from 'vs/platform/contextview/browser/contextView
|
|||
import { IMenuService, MenuId, MenuItemAction } from 'vs/platform/actions/common/actions';
|
||||
import { ContextAwareMenuItemActionItem, fillInActionBarActions, fillInContextMenuActions } from 'vs/platform/actions/browser/menuItemActionItem';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IViewsService, ITreeViewer, ITreeItem, TreeItemCollapsibleState, ITreeViewDataProvider, TreeViewItemHandleArg, ICustomViewDescriptor, ViewsRegistry, ViewContainer, ITreeItemLabel } from 'vs/workbench/common/views';
|
||||
import { IViewsService, ITreeView, ITreeItem, TreeItemCollapsibleState, ITreeViewDataProvider, TreeViewItemHandleArg, ICustomViewDescriptor, ViewsRegistry, ViewContainer, ITreeItemLabel } from 'vs/workbench/common/views';
|
||||
import { IViewletViewOptions, FileIconThemableWorkbenchTree } from 'vs/workbench/browser/parts/views/viewsViewlet';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
|
@ -39,7 +39,7 @@ import { editorFindMatchHighlight, editorFindMatchHighlightBorder } from 'vs/pla
|
|||
|
||||
export class CustomTreeViewPanel extends ViewletPanel {
|
||||
|
||||
private treeViewer: ITreeViewer;
|
||||
private treeView: ITreeView;
|
||||
|
||||
constructor(
|
||||
options: IViewletViewOptions,
|
||||
|
@ -50,10 +50,10 @@ export class CustomTreeViewPanel extends ViewletPanel {
|
|||
@IViewsService viewsService: IViewsService,
|
||||
) {
|
||||
super({ ...(options as IViewletPanelOptions), ariaHeaderLabel: options.title }, keybindingService, contextMenuService, configurationService);
|
||||
const { treeViewer } = (<ICustomViewDescriptor>ViewsRegistry.getView(options.id));
|
||||
this.treeViewer = treeViewer;
|
||||
this.treeViewer.onDidChangeActions(() => this.updateActions(), this, this.disposables);
|
||||
this.disposables.push(toDisposable(() => this.treeViewer.setVisibility(false)));
|
||||
const { treeView } = (<ICustomViewDescriptor>ViewsRegistry.getView(options.id));
|
||||
this.treeView = treeView;
|
||||
this.treeView.onDidChangeActions(() => this.updateActions(), this, this.disposables);
|
||||
this.disposables.push(toDisposable(() => this.treeView.setVisibility(false)));
|
||||
this.updateTreeVisibility();
|
||||
}
|
||||
|
||||
|
@ -64,28 +64,28 @@ export class CustomTreeViewPanel extends ViewletPanel {
|
|||
|
||||
focus(): void {
|
||||
super.focus();
|
||||
this.treeViewer.focus();
|
||||
this.treeView.focus();
|
||||
}
|
||||
|
||||
renderBody(container: HTMLElement): void {
|
||||
this.treeViewer.show(container);
|
||||
this.treeView.show(container);
|
||||
}
|
||||
|
||||
setExpanded(expanded: boolean): void {
|
||||
this.treeViewer.setVisibility(this.isVisible() && expanded);
|
||||
this.treeView.setVisibility(this.isVisible() && expanded);
|
||||
super.setExpanded(expanded);
|
||||
}
|
||||
|
||||
layoutBody(size: number): void {
|
||||
this.treeViewer.layout(size);
|
||||
this.treeView.layout(size);
|
||||
}
|
||||
|
||||
getActions(): IAction[] {
|
||||
return [...this.treeViewer.getPrimaryActions()];
|
||||
return [...this.treeView.getPrimaryActions()];
|
||||
}
|
||||
|
||||
getSecondaryActions(): IAction[] {
|
||||
return [...this.treeViewer.getSecondaryActions()];
|
||||
return [...this.treeView.getSecondaryActions()];
|
||||
}
|
||||
|
||||
getActionItem(action: IAction): IActionItem {
|
||||
|
@ -93,11 +93,11 @@ export class CustomTreeViewPanel extends ViewletPanel {
|
|||
}
|
||||
|
||||
getOptimalWidth(): number {
|
||||
return this.treeViewer.getOptimalWidth();
|
||||
return this.treeView.getOptimalWidth();
|
||||
}
|
||||
|
||||
private updateTreeVisibility(): void {
|
||||
this.treeViewer.setVisibility(this.isVisible() && this.isExpanded());
|
||||
this.treeView.setVisibility(this.isVisible() && this.isExpanded());
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
|
@ -172,7 +172,7 @@ class Root implements ITreeItem {
|
|||
|
||||
const noDataProviderMessage = localize('no-dataprovider', "There is no data provider registered that can provide view data.");
|
||||
|
||||
export class CustomTreeViewer extends Disposable implements ITreeViewer {
|
||||
export class CustomTreeView extends Disposable implements ITreeView {
|
||||
|
||||
private isVisible: boolean = false;
|
||||
private activated: boolean = false;
|
||||
|
@ -469,7 +469,7 @@ export class CustomTreeViewer extends Disposable implements ITreeViewer {
|
|||
class TreeDataSource implements IDataSource {
|
||||
|
||||
constructor(
|
||||
private treeView: ITreeViewer,
|
||||
private treeView: ITreeView,
|
||||
private container: ViewContainer,
|
||||
@IProgressService2 private progressService: IProgressService2
|
||||
) {
|
||||
|
|
|
@ -235,7 +235,7 @@ export interface IViewsService {
|
|||
|
||||
// Custom views
|
||||
|
||||
export interface ITreeViewer extends IDisposable {
|
||||
export interface ITreeView extends IDisposable {
|
||||
|
||||
dataProvider: ITreeViewDataProvider;
|
||||
|
||||
|
@ -290,7 +290,7 @@ export interface IRevealOptions {
|
|||
|
||||
export interface ICustomViewDescriptor extends IViewDescriptor {
|
||||
|
||||
readonly treeViewer: ITreeViewer;
|
||||
readonly treeView: ITreeView;
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue