mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-30 16:50:30 -04:00
This reverts commit 5d44b6a6a7.
This commit is contained in:
@@ -35,11 +35,11 @@ import { peekViewBorder, peekViewTitleBackground, peekViewTitleForeground, peekV
|
||||
import { EmbeddedDiffEditorWidget } from 'vs/editor/browser/widget/embeddedCodeEditorWidget';
|
||||
import { IDiffEditorOptions } from 'vs/editor/common/config/editorOptions';
|
||||
import { Action, IAction, ActionRunner } from 'vs/base/common/actions';
|
||||
import { IActionBarOptions, ActionsOrientation, IActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { IActionBarOptions, ActionsOrientation, IActionItem } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { basename } from 'vs/base/common/resources';
|
||||
import { MenuId, IMenuService, IMenu, MenuItemAction, MenuRegistry } from 'vs/platform/actions/common/actions';
|
||||
import { fillInActionBarActions, ContextAwareMenuEntryActionViewItem } from 'vs/platform/actions/browser/menuEntryActionViewItem';
|
||||
import { MenuItemActionItem, fillInActionBarActions } from 'vs/platform/actions/browser/menuItemActionItem';
|
||||
import { IChange, IEditorModel, ScrollType, IEditorContribution, IDiffEditorModel } from 'vs/editor/common/editorCommon';
|
||||
import { OverviewRulerLane, ITextModel, IModelDecorationOptions } from 'vs/editor/common/model';
|
||||
import { sortedDiff, firstIndex } from 'vs/base/common/arrays';
|
||||
@@ -50,6 +50,21 @@ import { IContextMenuService } from 'vs/platform/contextview/browser/contextView
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { createStyleSheet } from 'vs/base/browser/dom';
|
||||
|
||||
// TODO@Joao
|
||||
// Need to subclass MenuItemActionItem in order to respect
|
||||
// the action context coming from any action bar, without breaking
|
||||
// existing users
|
||||
class DiffMenuItemActionItem extends MenuItemActionItem {
|
||||
|
||||
onClick(event: MouseEvent): void {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
this.actionRunner.run(this._commandAction, this._context)
|
||||
.then(undefined, err => this._notificationService.error(err));
|
||||
}
|
||||
}
|
||||
|
||||
class DiffActionRunner extends ActionRunner {
|
||||
|
||||
runAction(action: IAction, context: any): Promise<any> {
|
||||
@@ -274,17 +289,17 @@ class DirtyDiffWidget extends PeekViewWidget {
|
||||
|
||||
return {
|
||||
actionRunner,
|
||||
actionViewItemProvider: action => this.getActionViewItem(action),
|
||||
actionItemProvider: action => this.getActionItem(action),
|
||||
orientation: ActionsOrientation.HORIZONTAL_REVERSE
|
||||
};
|
||||
}
|
||||
|
||||
getActionViewItem(action: IAction): IActionViewItem | undefined {
|
||||
getActionItem(action: IAction): IActionItem | undefined {
|
||||
if (!(action instanceof MenuItemAction)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return new ContextAwareMenuEntryActionViewItem(action, this.keybindingService, this.notificationService, this.contextMenuService);
|
||||
return new DiffMenuItemActionItem(action, this.keybindingService, this.notificationService, this.contextMenuService);
|
||||
}
|
||||
|
||||
protected _fillBody(container: HTMLElement): void {
|
||||
@@ -367,7 +382,7 @@ export class ShowPreviousChangeAction extends EditorAction {
|
||||
id: 'editor.action.dirtydiff.previous',
|
||||
label: nls.localize('show previous change', "Show Previous Change"),
|
||||
alias: 'Show Previous Change',
|
||||
precondition: undefined,
|
||||
precondition: null,
|
||||
kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Shift | KeyMod.Alt | KeyCode.F3, weight: KeybindingWeight.EditorContrib }
|
||||
});
|
||||
}
|
||||
@@ -401,7 +416,7 @@ export class ShowNextChangeAction extends EditorAction {
|
||||
id: 'editor.action.dirtydiff.next',
|
||||
label: nls.localize('show next change', "Show Next Change"),
|
||||
alias: 'Show Next Change',
|
||||
precondition: undefined,
|
||||
precondition: null,
|
||||
kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Alt | KeyCode.F3, weight: KeybindingWeight.EditorContrib }
|
||||
});
|
||||
}
|
||||
@@ -454,7 +469,7 @@ export class MoveToPreviousChangeAction extends EditorAction {
|
||||
id: 'workbench.action.editor.previousChange',
|
||||
label: nls.localize('move to previous change', "Move to Previous Change"),
|
||||
alias: 'Move to Previous Change',
|
||||
precondition: undefined,
|
||||
precondition: null,
|
||||
kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Shift | KeyMod.Alt | KeyCode.F5, weight: KeybindingWeight.EditorContrib }
|
||||
});
|
||||
}
|
||||
@@ -496,7 +511,7 @@ export class MoveToNextChangeAction extends EditorAction {
|
||||
id: 'workbench.action.editor.nextChange',
|
||||
label: nls.localize('move to next change', "Move to Next Change"),
|
||||
alias: 'Move to Next Change',
|
||||
precondition: undefined,
|
||||
precondition: null,
|
||||
kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Alt | KeyCode.F5, weight: KeybindingWeight.EditorContrib }
|
||||
});
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IMenuService, MenuId, IMenu } from 'vs/platform/actions/common/actions';
|
||||
import { IAction } from 'vs/base/common/actions';
|
||||
import { fillInContextMenuActions, fillInActionBarActions } from 'vs/platform/actions/browser/menuEntryActionViewItem';
|
||||
import { fillInContextMenuActions, fillInActionBarActions } from 'vs/platform/actions/browser/menuItemActionItem';
|
||||
import { ISCMProvider, ISCMResource, ISCMResourceGroup } from 'vs/workbench/contrib/scm/common/scm';
|
||||
import { isSCMResource } from './scmUtil';
|
||||
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
||||
|
||||
@@ -24,10 +24,10 @@ import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { MenuItemAction, IMenuService, MenuId, IMenu } from 'vs/platform/actions/common/actions';
|
||||
import { IAction, Action, IActionViewItem, ActionRunner } from 'vs/base/common/actions';
|
||||
import { fillInContextMenuActions, ContextAwareMenuEntryActionViewItem, fillInActionBarActions } from 'vs/platform/actions/browser/menuEntryActionViewItem';
|
||||
import { IAction, Action, IActionItem, ActionRunner } from 'vs/base/common/actions';
|
||||
import { fillInContextMenuActions, ContextAwareMenuItemActionItem, fillInActionBarActions } from 'vs/platform/actions/browser/menuItemActionItem';
|
||||
import { SCMMenus } from './scmMenus';
|
||||
import { ActionBar, IActionViewItemProvider, ActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { ActionBar, IActionItemProvider, ActionItem } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { IThemeService, LIGHT } from 'vs/platform/theme/common/themeService';
|
||||
import { isSCMResource } from './scmUtil';
|
||||
import { attachBadgeStyler, attachInputBoxStyler } from 'vs/platform/theme/common/styler';
|
||||
@@ -94,7 +94,7 @@ class StatusBarAction extends Action {
|
||||
}
|
||||
}
|
||||
|
||||
class StatusBarActionViewItem extends ActionViewItem {
|
||||
class StatusBarActionItem extends ActionItem {
|
||||
|
||||
constructor(action: StatusBarAction) {
|
||||
super(null, action, {});
|
||||
@@ -160,7 +160,7 @@ class ProviderRenderer implements IListRenderer<ISCMRepository, RepositoryTempla
|
||||
const countContainer = append(provider, $('.count'));
|
||||
const count = new CountBadge(countContainer);
|
||||
const badgeStyler = attachBadgeStyler(count, this.themeService);
|
||||
const actionBar = new ActionBar(provider, { actionViewItemProvider: a => new StatusBarActionViewItem(a as StatusBarAction) });
|
||||
const actionBar = new ActionBar(provider, { actionItemProvider: a => new StatusBarActionItem(a as StatusBarAction) });
|
||||
const disposable = Disposable.None;
|
||||
const templateDisposable = combinedDisposable([actionBar, badgeStyler]);
|
||||
|
||||
@@ -366,7 +366,7 @@ class ResourceGroupRenderer implements IListRenderer<ISCMResourceGroup, Resource
|
||||
get templateId(): string { return ResourceGroupRenderer.TEMPLATE_ID; }
|
||||
|
||||
constructor(
|
||||
private actionViewItemProvider: IActionViewItemProvider,
|
||||
private actionItemProvider: IActionItemProvider,
|
||||
private themeService: IThemeService,
|
||||
private menus: SCMMenus
|
||||
) { }
|
||||
@@ -375,7 +375,7 @@ class ResourceGroupRenderer implements IListRenderer<ISCMResourceGroup, Resource
|
||||
const element = append(container, $('.resource-group'));
|
||||
const name = append(element, $('.name'));
|
||||
const actionsContainer = append(element, $('.actions'));
|
||||
const actionBar = new ActionBar(actionsContainer, { actionViewItemProvider: this.actionViewItemProvider });
|
||||
const actionBar = new ActionBar(actionsContainer, { actionItemProvider: this.actionItemProvider });
|
||||
const countContainer = append(element, $('.count'));
|
||||
const count = new CountBadge(countContainer);
|
||||
const styler = attachBadgeStyler(count, this.themeService);
|
||||
@@ -454,7 +454,7 @@ class ResourceRenderer implements IListRenderer<ISCMResource, ResourceTemplate>
|
||||
|
||||
constructor(
|
||||
private labels: ResourceLabels,
|
||||
private actionViewItemProvider: IActionViewItemProvider,
|
||||
private actionItemProvider: IActionItemProvider,
|
||||
private getSelectedResources: () => ISCMResource[],
|
||||
private themeService: IThemeService,
|
||||
private menus: SCMMenus
|
||||
@@ -466,7 +466,7 @@ class ResourceRenderer implements IListRenderer<ISCMResource, ResourceTemplate>
|
||||
const fileLabel = this.labels.create(name);
|
||||
const actionsContainer = append(fileLabel.element, $('.actions'));
|
||||
const actionBar = new ActionBar(actionsContainer, {
|
||||
actionViewItemProvider: this.actionViewItemProvider,
|
||||
actionItemProvider: this.actionItemProvider,
|
||||
actionRunner: new MultipleSelectionActionRunner(this.getSelectedResources)
|
||||
});
|
||||
|
||||
@@ -827,14 +827,14 @@ export class RepositoryPanel extends ViewletPanel {
|
||||
|
||||
const delegate = new ProviderListDelegate();
|
||||
|
||||
const actionViewItemProvider = (action: IAction) => this.getActionViewItem(action);
|
||||
const actionItemProvider = (action: IAction) => this.getActionItem(action);
|
||||
|
||||
this.listLabels = this.instantiationService.createInstance(ResourceLabels, { onDidChangeVisibility: this.onDidChangeBodyVisibility });
|
||||
this.disposables.push(this.listLabels);
|
||||
|
||||
const renderers = [
|
||||
new ResourceGroupRenderer(actionViewItemProvider, this.themeService, this.menus),
|
||||
new ResourceRenderer(this.listLabels, actionViewItemProvider, () => this.getSelectedResources(), this.themeService, this.menus)
|
||||
new ResourceGroupRenderer(actionItemProvider, this.themeService, this.menus),
|
||||
new ResourceRenderer(this.listLabels, actionItemProvider, () => this.getSelectedResources(), this.themeService, this.menus)
|
||||
];
|
||||
|
||||
this.list = this.instantiationService.createInstance(WorkbenchList, this.listContainer, delegate, renderers, {
|
||||
@@ -918,12 +918,12 @@ export class RepositoryPanel extends ViewletPanel {
|
||||
return this.menus.getTitleSecondaryActions();
|
||||
}
|
||||
|
||||
getActionViewItem(action: IAction): IActionViewItem | undefined {
|
||||
getActionItem(action: IAction): IActionItem | undefined {
|
||||
if (!(action instanceof MenuItemAction)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return new ContextAwareMenuEntryActionViewItem(action, this.keybindingService, this.notificationService, this.contextMenuService);
|
||||
return new ContextAwareMenuItemActionItem(action, this.keybindingService, this.notificationService, this.contextMenuService);
|
||||
}
|
||||
|
||||
getActionsContext(): any {
|
||||
@@ -1227,12 +1227,12 @@ export class SCMViewlet extends ViewContainerViewlet implements IViewModel {
|
||||
}
|
||||
}
|
||||
|
||||
getActionViewItem(action: IAction): IActionViewItem | undefined {
|
||||
getActionItem(action: IAction): IActionItem | undefined {
|
||||
if (!(action instanceof MenuItemAction)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return new ContextAwareMenuEntryActionViewItem(action, this.keybindingService, this.notificationService, this.contextMenuService);
|
||||
return new ContextAwareMenuItemActionItem(action, this.keybindingService, this.notificationService, this.contextMenuService);
|
||||
}
|
||||
|
||||
getActions(): IAction[] {
|
||||
|
||||
Reference in New Issue
Block a user