提交 5a53b4db 编写于 作者: S Sandeep Somavarapu

minimize changes

上级 5bb4f250
......@@ -12,7 +12,7 @@ import { IdGenerator } from 'vs/base/common/idGenerator';
import { IDisposable, toDisposable, MutableDisposable, DisposableStore } from 'vs/base/common/lifecycle';
import { isLinux, isWindows } from 'vs/base/common/platform';
import { localize } from 'vs/nls';
import { IMenu, IMenuActionOptions, MenuItemAction, SubmenuItemAction, Icon } from 'vs/platform/actions/common/actions';
import { ICommandAction, IMenu, IMenuActionOptions, MenuItemAction, SubmenuItemAction, Icon } from 'vs/platform/actions/common/actions';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { INotificationService } from 'vs/platform/notification/common/notification';
......@@ -171,7 +171,7 @@ export class MenuEntryActionViewItem extends ActionViewItem {
render(container: HTMLElement): void {
super.render(container);
this._updateItemClass(this._action);
this._updateItemClass(this._action.item);
let mouseOver = false;
......@@ -227,18 +227,18 @@ export class MenuEntryActionViewItem extends ActionViewItem {
if (this.options.icon) {
if (this._commandAction !== this._action) {
if (this._action.alt) {
this._updateItemClass(this._action.alt);
this._updateItemClass(this._action.alt.item);
}
} else if ((<MenuItemAction>this._action).alt) {
this._updateItemClass(this._action);
this._updateItemClass(this._action.item);
}
}
}
_updateItemClass(item: MenuItemAction): void {
_updateItemClass(item: ICommandAction): void {
this._itemClassDispose.value = undefined;
const icon = item.checked && (item.item.toggled as { icon?: Icon })?.icon ? (item.item.toggled as { icon: Icon }).icon : item.item.icon;
const icon = this._commandAction.checked && (item.toggled as { icon?: Icon })?.icon ? (item.toggled as { icon: Icon }).icon : item.icon;
if (ThemeIcon.isThemeIcon(icon)) {
// theme icons
......
......@@ -277,14 +277,14 @@ export class MenuItemAction extends ExecuteCommandAction {
@IContextKeyService contextKeyService: IContextKeyService,
@ICommandService commandService: ICommandService
) {
super(item.id, typeof item.title === 'string' ? item.title : item.title.value, commandService);
this.item = item;
typeof item.title === 'string' ? super(item.id, item.title, commandService) : super(item.id, item.title.value, commandService);
this._cssClass = undefined;
this._enabled = !this.item.precondition || contextKeyService.contextMatchesRules(this.item.precondition);
this._tooltip = this.item.tooltip ? typeof this.item.tooltip === 'string' ? this.item.tooltip : this.item.tooltip.value : undefined;
this._enabled = !item.precondition || contextKeyService.contextMatchesRules(item.precondition);
this._tooltip = item.tooltip ? typeof item.tooltip === 'string' ? item.tooltip : item.tooltip.value : undefined;
if (this.item.toggled) {
const toggled = ((this.item.toggled as { condition: ContextKeyExpression }).condition ? this.item.toggled : { condition: this.item.toggled }) as {
if (item.toggled) {
const toggled = ((item.toggled as { condition: ContextKeyExpression }).condition ? item.toggled : { condition: item.toggled }) as {
condition: ContextKeyExpression, icon?: Icon, tooltip?: string | ILocalizedString
};
this._checked = contextKeyService.contextMatchesRules(toggled.condition);
......@@ -295,6 +295,7 @@ export class MenuItemAction extends ExecuteCommandAction {
this._options = options || {};
this.item = item;
this.alt = alt ? new MenuItemAction(alt, undefined, this._options, contextKeyService, commandService) : undefined;
}
......
......@@ -591,7 +591,7 @@ export class CommandsHandler extends QuickOpenHandler implements IDisposable {
const aliasHighlights = alias ? wordFilter(searchValue, alias) : null;
if (labelHighlights || aliasHighlights) {
entries.push(this.instantiationService.createInstance(ActionCommandEntry, action.id, this.keybindingService.lookupKeybinding(action.id), label, alias, { label: labelHighlights, alias: aliasHighlights }, action, (id: string) => this.onBeforeRunCommand(id)));
entries.push(this.instantiationService.createInstance(ActionCommandEntry, action.item.id, this.keybindingService.lookupKeybinding(action.id), label, alias, { label: labelHighlights, alias: aliasHighlights }, action, (id: string) => this.onBeforeRunCommand(id)));
}
}
}
......
......@@ -207,7 +207,7 @@ export class RemoteWindowActiveIndicator extends Disposable implements IWorkbenc
}
items.push({
type: 'item',
id: action.id,
id: action.item.id,
label
});
}
......
......@@ -23,7 +23,7 @@ import { IResourceEditorInput } from 'vs/platform/editor/common/editor';
import { KeyboardMapperFactory } from 'vs/workbench/services/keybinding/electron-browser/nativeKeymapService';
import { ipcRenderer as ipc, webFrame, crashReporter, CrashReporterStartOptions, Event as IpcEvent } from 'electron';
import { IWorkspaceEditingService } from 'vs/workbench/services/workspaces/common/workspaceEditing';
import { IMenuService, MenuId, IMenu, MenuItemAction, SubmenuItemAction, MenuRegistry, ICommandAction } from 'vs/platform/actions/common/actions';
import { IMenuService, MenuId, IMenu, MenuItemAction, ICommandAction, SubmenuItemAction, MenuRegistry } from 'vs/platform/actions/common/actions';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { createAndFillInActionBarActions } from 'vs/platform/actions/browser/menuEntryActionViewItem';
import { RunOnceScheduler } from 'vs/base/common/async';
......@@ -511,7 +511,7 @@ export class NativeWindow extends Disposable {
// Command
if (action instanceof MenuItemAction) {
if (ignoredItems.indexOf(action.id) >= 0) {
if (ignoredItems.indexOf(action.item.id) >= 0) {
continue; // ignored
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册