remove getActions*2 from view pane container

This commit is contained in:
Sandeep Somavarapu 2021-02-08 14:35:58 +01:00
parent 9dd25c4d19
commit 82f3379ac6
3 changed files with 8 additions and 44 deletions

View file

@ -15,7 +15,7 @@ import { Composite } from 'vs/workbench/browser/composite';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { ViewPaneContainer } from './parts/views/viewPaneContainer';
import { IPaneComposite } from 'vs/workbench/common/panecomposite';
import { IAction, IActionViewItem, Separator } from 'vs/base/common/actions';
import { IAction, IActionViewItem } from 'vs/base/common/actions';
export class PaneComposite extends Composite implements IPaneComposite {
@ -64,37 +64,15 @@ export class PaneComposite extends Composite implements IPaneComposite {
}
getContextMenuActions(): ReadonlyArray<IAction> {
const result = [];
result.push(...this.viewPaneContainer.getContextMenuActions2());
const otherActions = this.viewPaneContainer.getContextMenuActions();
if (otherActions.length) {
result.push(new Separator());
result.push(...otherActions);
}
return result;
return this.viewPaneContainer.getContextMenuActions();
}
getActions(): ReadonlyArray<IAction> {
const result = [];
result.push(...this.viewPaneContainer.getActions2());
result.push(...this.viewPaneContainer.getActions());
return result;
return this.viewPaneContainer.getActions();
}
getSecondaryActions(): ReadonlyArray<IAction> {
const menuActions = this.viewPaneContainer.getSecondaryActions2();
const viewPaneContainerActions = this.viewPaneContainer.getSecondaryActions();
if (menuActions.length && viewPaneContainerActions.length) {
return [
...menuActions,
new Separator(),
...viewPaneContainerActions
];
}
return menuActions.length ? menuActions : viewPaneContainerActions;
return this.viewPaneContainer.getSecondaryActions();
}
getActionViewItem(action: IAction): IActionViewItem | undefined {

View file

@ -564,19 +564,15 @@ export class ViewPaneContainer extends Component implements IViewPaneContainer {
let anchor: { x: number, y: number; } = { x: event.posx, y: event.posy };
this.contextMenuService.showContextMenu({
getAnchor: () => anchor,
getActions: () => [...this.getContextMenuActions2()]
getActions: () => [...this.getContextMenuActions()]
});
}
getContextMenuActions2(): ReadonlyArray<IAction> {
getContextMenuActions(): ReadonlyArray<IAction> {
return this.menuActions.getContextMenuActions();
}
getContextMenuActions(viewDescriptor?: IViewDescriptor): IAction[] {
return [];
}
getActions2(): IAction[] {
getActions(): IAction[] {
const result = [];
result.push(...this.menuActions.getPrimaryActions());
if (this.isViewMergedWithContainer()) {
@ -585,11 +581,7 @@ export class ViewPaneContainer extends Component implements IViewPaneContainer {
return result;
}
getActions(): IAction[] {
return [];
}
getSecondaryActions2(): IAction[] {
getSecondaryActions(): IAction[] {
const viewPaneActions = this.isViewMergedWithContainer() ? this.paneItems[0].pane.getSecondaryActions() : [];
let menuActions = this.menuActions.getSecondaryActions();
@ -619,10 +611,6 @@ export class ViewPaneContainer extends Component implements IViewPaneContainer {
return menuActions.length ? menuActions : viewPaneActions;
}
getSecondaryActions(): IAction[] {
return [];
}
getActionsContext(): unknown {
return undefined;
}

View file

@ -814,8 +814,6 @@ export interface IViewPaneContainer {
setVisible(visible: boolean): void;
isVisible(): boolean;
focus(): void;
getActions(): IAction[];
getSecondaryActions(): IAction[];
getActionViewItem(action: IAction): IActionViewItem | undefined;
getActionsContext(): unknown;
getView(viewId: string): IView | undefined;