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

minimize changes

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