提交 c84fa206 编写于 作者: M Martin Aeschlimann

add preferences icons

上级 44af5d2a
......@@ -11,7 +11,7 @@ import { ResolvedKeybinding } from 'vs/base/common/keyCodes';
import { Disposable, DisposableStore } from 'vs/base/common/lifecycle';
import { AnchorAlignment } from 'vs/base/browser/ui/contextview/contextview';
import { withNullAsUndefined } from 'vs/base/common/types';
import { Codicon, registerIcon } from 'vs/base/common/codicons';
import { Codicon, CSSIcon, registerIcon } from 'vs/base/common/codicons';
import { EventMultiplexer } from 'vs/base/common/event';
import { DropdownMenuActionViewItem } from 'vs/base/browser/ui/dropdown/dropdownActionViewItem';
import { IContextMenuProvider } from 'vs/base/browser/contextmenu';
......@@ -27,6 +27,7 @@ export interface IToolBarOptions {
toggleMenuTitle?: string;
anchorAlignmentProvider?: () => AnchorAlignment;
renderDropdownAsChildElement?: boolean;
moreIcon?: CSSIcon;
}
/**
......@@ -72,7 +73,7 @@ export class ToolBar extends Disposable {
actionViewItemProvider: this.options.actionViewItemProvider,
actionRunner: this.actionRunner,
keybindingProvider: this.options.getKeyBinding,
classNames: toolBarMoreIcon.classNamesArray,
classNames: (options.moreIcon ?? toolBarMoreIcon).classNames,
anchorAlignmentProvider: this.options.anchorAlignmentProvider,
menuAsChild: !!this.options.renderDropdownAsChildElement
}
......
......@@ -43,11 +43,11 @@ import { InputBox, MessageType } from 'vs/base/browser/ui/inputbox/inputBox';
import { Emitter, Event } from 'vs/base/common/event';
import { MenuRegistry, MenuId, isIMenuItem } from 'vs/platform/actions/common/actions';
import { IListAccessibilityProvider } from 'vs/base/browser/ui/list/listWidget';
import { preferencesEditIcon } from 'vs/workbench/contrib/preferences/browser/preferencesWidgets';
import { Color, RGBA } from 'vs/base/common/color';
import { WORKBENCH_BACKGROUND } from 'vs/workbench/common/theme';
import { IBaseActionViewItemOptions } from 'vs/base/browser/ui/actionbar/actionViewItems';
import { IKeybindingsEditorPane } from 'vs/workbench/services/preferences/common/preferences';
import { keybindingsRecordKeysIcon, keybindingsSortIcon, keybindingsAddIcon, preferencesClearInputIcon, keybindingsEditIcon } from 'vs/workbench/contrib/preferences/browser/preferencesIcons';
const $ = DOM.$;
......@@ -135,12 +135,12 @@ export class KeybindingsEditor extends EditorPane implements IKeybindingsEditorP
const recordKeysActionKeybinding = this.keybindingsService.lookupKeybinding(KEYBINDINGS_EDITOR_COMMAND_RECORD_SEARCH_KEYS);
const recordKeysActionLabel = localize('recordKeysLabel', "Record Keys");
this.recordKeysAction = new Action(KEYBINDINGS_EDITOR_COMMAND_RECORD_SEARCH_KEYS, recordKeysActionKeybinding ? localize('recordKeysLabelWithKeybinding', "{0} ({1})", recordKeysActionLabel, recordKeysActionKeybinding.getLabel()) : recordKeysActionLabel, 'codicon-record-keys');
this.recordKeysAction = new Action(KEYBINDINGS_EDITOR_COMMAND_RECORD_SEARCH_KEYS, recordKeysActionKeybinding ? localize('recordKeysLabelWithKeybinding', "{0} ({1})", recordKeysActionLabel, recordKeysActionKeybinding.getLabel()) : recordKeysActionLabel, ThemeIcon.asClassName(keybindingsRecordKeysIcon));
this.recordKeysAction.checked = false;
const sortByPrecedenceActionKeybinding = this.keybindingsService.lookupKeybinding(KEYBINDINGS_EDITOR_COMMAND_SORTBY_PRECEDENCE);
const sortByPrecedenceActionLabel = localize('sortByPrecedeneLabel', "Sort by Precedence");
this.sortByPrecedenceAction = new Action('keybindings.editor.sortByPrecedence', sortByPrecedenceActionKeybinding ? localize('sortByPrecedeneLabelWithKeybinding', "{0} ({1})", sortByPrecedenceActionLabel, sortByPrecedenceActionKeybinding.getLabel()) : sortByPrecedenceActionLabel, 'codicon-sort-precedence');
this.sortByPrecedenceAction = new Action('keybindings.editor.sortByPrecedence', sortByPrecedenceActionKeybinding ? localize('sortByPrecedeneLabelWithKeybinding', "{0} ({1})", sortByPrecedenceActionLabel, sortByPrecedenceActionKeybinding.getLabel()) : sortByPrecedenceActionLabel, ThemeIcon.asClassName(keybindingsSortIcon));
this.sortByPrecedenceAction.checked = false;
}
......@@ -345,7 +345,7 @@ export class KeybindingsEditor extends EditorPane implements IKeybindingsEditorP
const fullTextSearchPlaceholder = localize('SearchKeybindings.FullTextSearchPlaceholder', "Type to search in keybindings");
const keybindingsSearchPlaceholder = localize('SearchKeybindings.KeybindingsSearchPlaceholder', "Recording Keys. Press Escape to exit");
const clearInputAction = new Action(KEYBINDINGS_EDITOR_COMMAND_CLEAR_SEARCH_RESULTS, localize('clearInput', "Clear Keybindings Search Input"), 'codicon-clear-all', false, () => { this.clearSearchResults(); return Promise.resolve(null); });
const clearInputAction = new Action(KEYBINDINGS_EDITOR_COMMAND_CLEAR_SEARCH_RESULTS, localize('clearInput', "Clear Keybindings Search Input"), ThemeIcon.asClassName(preferencesClearInputIcon), false, () => { this.clearSearchResults(); return Promise.resolve(null); });
const searchContainer = DOM.append(this.headerContainer, $('.search-container'));
this.searchWidget = this._register(this.instantiationService.createInstance(KeybindingsSearchWidget, searchContainer, <KeybindingsSearchOptions>{
......@@ -926,7 +926,7 @@ class ActionsColumn extends Column {
private createEditAction(keybindingItemEntry: IKeybindingItemEntry): IAction {
const keybinding = this.keybindingsService.lookupKeybinding(KEYBINDINGS_EDITOR_COMMAND_DEFINE);
return <IAction>{
class: ThemeIcon.asClassName(preferencesEditIcon),
class: ThemeIcon.asClassName(keybindingsEditIcon),
enabled: true,
id: 'editKeybinding',
tooltip: keybinding ? localize('editKeybindingLabelWithKey', "Change Keybinding {0}", `(${keybinding.getLabel()})`) : localize('editKeybindingLabel', "Change Keybinding"),
......@@ -937,7 +937,7 @@ class ActionsColumn extends Column {
private createAddAction(keybindingItemEntry: IKeybindingItemEntry): IAction {
const keybinding = this.keybindingsService.lookupKeybinding(KEYBINDINGS_EDITOR_COMMAND_DEFINE);
return <IAction>{
class: 'codicon-add',
class: ThemeIcon.asClassName(keybindingsAddIcon),
enabled: true,
id: 'addKeybinding',
tooltip: keybinding ? localize('addKeybindingLabelWithKey', "Add Keybinding {0}", `(${keybinding.getLabel()})`) : localize('addKeybindingLabel', "Add Keybinding"),
......
......@@ -194,22 +194,6 @@
justify-content: center;
}
.monaco-editor .settings-group-title-widget .title-container.collapsed .codicon::before {
transform: rotate(-90deg);
}
.monaco-editor .codicon-edit {
transform: rotate(-90deg);
width:16px;
height: 16px;
cursor: pointer;
}
.monaco-editor .codicon-edit.hidden {
display: none;
visibility: hidden;
}
.monaco-editor .dim-configuration {
color: #b1b1b1;
}
......@@ -40,7 +40,7 @@ import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
import { IPreferencesService } from 'vs/workbench/services/preferences/common/preferences';
import { DefaultPreferencesEditorInput, KeybindingsEditorInput, PreferencesEditorInput, SettingsEditor2Input } from 'vs/workbench/services/preferences/common/preferencesEditorInput';
import { Codicon } from 'vs/base/common/codicons';
import { preferencesOpenSettingsIcon } from 'vs/workbench/contrib/preferences/browser/preferencesIcons';
const SETTINGS_EDITOR_COMMAND_SEARCH = 'settings.action.search';
......@@ -278,7 +278,7 @@ class PreferencesActionsContribution extends Disposable implements IWorkbenchCon
super({
id: '_workbench.openUserSettingsEditor',
title: OPEN_SETTINGS2_ACTION_TITLE,
icon: Codicon.goToFile,
icon: preferencesOpenSettingsIcon,
menu: [{
id: MenuId.EditorTitle,
when: ResourceContextKey.Resource.isEqualTo(that.environmentService.settingsResource.toString()),
......@@ -296,7 +296,7 @@ class PreferencesActionsContribution extends Disposable implements IWorkbenchCon
super({
id: SETTINGS_EDITOR_COMMAND_SWITCH_TO_JSON,
title: { value: nls.localize('openSettingsJson', "Open Settings (JSON)"), original: 'Open Settings (JSON)' },
icon: Codicon.goToFile,
icon: preferencesOpenSettingsIcon,
menu: [{
id: MenuId.EditorTitle,
when: ContextKeyExpr.and(CONTEXT_SETTINGS_EDITOR, CONTEXT_SETTINGS_JSON_EDITOR.toNegated()),
......@@ -816,7 +816,7 @@ class PreferencesActionsContribution extends Disposable implements IWorkbenchCon
id: 'workbench.action.openGlobalKeybindings',
title: { value: nls.localize('openGlobalKeybindings', "Open Keyboard Shortcuts"), original: 'Open Keyboard Shortcuts' },
category,
icon: Codicon.goToFile,
icon: preferencesOpenSettingsIcon,
keybinding: {
when: null,
weight: KeybindingWeight.WorkbenchContrib,
......@@ -873,7 +873,7 @@ class PreferencesActionsContribution extends Disposable implements IWorkbenchCon
id: 'workbench.action.openGlobalKeybindingsFile',
title: { value: nls.localize('openGlobalKeybindingsFile', "Open Keyboard Shortcuts (JSON)"), original: 'Open Keyboard Shortcuts (JSON)' },
category,
icon: Codicon.goToFile,
icon: preferencesOpenSettingsIcon,
menu: [
{ id: MenuId.CommandPalette },
{
......@@ -1124,7 +1124,7 @@ class PreferencesActionsContribution extends Disposable implements IWorkbenchCon
command: {
id: commandId,
title: OPEN_SETTINGS2_ACTION_TITLE,
icon: Codicon.goToFile
icon: preferencesOpenSettingsIcon
},
when: ContextKeyExpr.and(ResourceContextKey.Resource.isEqualTo(this.preferencesService.workspaceSettingsResource!.toString()), WorkbenchStateContext.isEqualTo('workspace')),
group: 'navigation',
......@@ -1149,7 +1149,7 @@ class PreferencesActionsContribution extends Disposable implements IWorkbenchCon
command: {
id: commandId,
title: OPEN_SETTINGS2_ACTION_TITLE,
icon: Codicon.goToFile
icon: preferencesOpenSettingsIcon
},
when: ContextKeyExpr.and(ResourceContextKey.Resource.isEqualTo(this.preferencesService.getFolderSettingsResource(folder.uri)!.toString())),
group: 'navigation',
......
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Codicon } from 'vs/base/common/codicons';
import { localize } from 'vs/nls';
import { registerIcon } from 'vs/platform/theme/common/iconRegistry';
export const settingsGroupExpandedIcon = registerIcon('settings-group-expanded', Codicon.chevronDown, localize('settingsGroupExpandedIcon', 'Icon for an expanded section in the split JSON settings editor.'));
export const settingsGroupCollapsedIcon = registerIcon('settings-group-collapsed', Codicon.chevronRight, localize('settingsGroupCollapsedIcon', 'Icon for an collapsed section in the split JSON settings editor.'));
export const settingsScopeDropDownIcon = registerIcon('settings-folder-dropdown', Codicon.triangleDown, localize('settingsScopeDropDownIcon', 'Icon for the folder dropdown button in the split JSON settings editor.'));
export const settingsMoreActionIcon = registerIcon('settings-more-action', Codicon.gear, localize('settingsMoreActionIcon', 'Icon for the \'more actions\' action in the settings UI.'));
export const keybindingsRecordKeysIcon = registerIcon('keybindings-record-keys', Codicon.recordKeys, localize('keybindingsRecordKeysIcon', 'Icon for the \'record keys\' action in the keybinding UI.'));
export const keybindingsSortIcon = registerIcon('keybindings-sort', Codicon.sortPrecedence, localize('keybindingsSortIcon', 'Icon for the \'sort by precedence\' toggle in the keybinding UI.'));
export const keybindingsEditIcon = registerIcon('keybindings-edit', Codicon.edit, localize('keybindingsEditIcon', 'Icon for the edit action in the keybinding UI.'));
export const keybindingsAddIcon = registerIcon('keybindings-add', Codicon.add, localize('keybindingsAddIcon', 'Icon for the add action in the keybinding UI.'));
export const settingsEditIcon = registerIcon('settings-edit', Codicon.edit, localize('settingsEditIcon', 'Icon for the edit action in the settings UI.'));
export const settingsAddIcon = registerIcon('settings-add', Codicon.add, localize('settingsAddIcon', 'Icon for the add action in the settings UI.'));
export const settingsRemoveIcon = registerIcon('settings-remove', Codicon.close, localize('settingsRemoveIcon', 'Icon for the remove action in the settings UI.'));
export const settingsDiscardIcon = registerIcon('settings-discard', Codicon.discard, localize('preferencesDiscardIcon', 'Icon for the discard action in the settings UI.'));
export const preferencesClearInputIcon = registerIcon('preferences-clear-input', Codicon.clearAll, localize('preferencesClearInput', 'Icon for clear input in the settings and keybinding UI.'));
export const preferencesOpenSettingsIcon = registerIcon('preferences-open-settings', Codicon.goToFile, localize('preferencesOpenSettings', 'Icon for open settings commands.'));
......@@ -25,7 +25,7 @@ import { Registry } from 'vs/platform/registry/common/platform';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace';
import { RangeHighlightDecorations } from 'vs/workbench/browser/parts/editor/rangeDecorations';
import { DefaultSettingsHeaderWidget, EditPreferenceWidget, SettingsGroupTitleWidget, SettingsHeaderWidget, preferencesEditIcon } from 'vs/workbench/contrib/preferences/browser/preferencesWidgets';
import { DefaultSettingsHeaderWidget, EditPreferenceWidget, SettingsGroupTitleWidget, SettingsHeaderWidget } from 'vs/workbench/contrib/preferences/browser/preferencesWidgets';
import { IFilterResult, IPreferencesEditorModel, IPreferencesService, ISetting, ISettingsEditorModel, ISettingsGroup } from 'vs/workbench/services/preferences/common/preferences';
import { DefaultSettingsEditorModel, SettingsEditorModel, WorkspaceConfigurationEditorModel } from 'vs/workbench/services/preferences/common/preferencesModels';
import { IMarkerService, IMarkerData, MarkerSeverity, MarkerTag } from 'vs/platform/markers/common/markers';
......@@ -33,6 +33,7 @@ import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/
import { EditorOption } from 'vs/editor/common/config/editorOptions';
import { FindDecorations } from 'vs/editor/contrib/find/findDecorations';
import { ThemeIcon } from 'vs/platform/theme/common/themeService';
import { settingsEditIcon } from 'vs/workbench/contrib/preferences/browser/preferencesIcons';
export interface IPreferencesRenderer<T> extends IDisposable {
readonly preferencesModel: IPreferencesEditorModel<T>;
......@@ -738,7 +739,7 @@ class EditSettingRenderer extends Disposable {
const decorations = this.editor.getLineDecorations(line);
if (decorations) {
for (const { options } of decorations) {
if (options.glyphMarginClassName && options.glyphMarginClassName.indexOf(ThemeIcon.asClassName(preferencesEditIcon)) === -1) {
if (options.glyphMarginClassName && options.glyphMarginClassName.indexOf(ThemeIcon.asClassName(settingsEditIcon)) === -1) {
return false;
}
}
......
......@@ -35,9 +35,8 @@ import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/
import { ISettingsGroup, IPreferencesService } from 'vs/workbench/services/preferences/common/preferences';
import { EditorOption } from 'vs/editor/common/config/editorOptions';
import { isEqual } from 'vs/base/common/resources';
import { Codicon } from 'vs/base/common/codicons';
import { registerIcon } from 'vs/platform/theme/common/iconRegistry';
import { BaseActionViewItem } from 'vs/base/browser/ui/actionbar/actionViewItems';
import { settingsEditIcon, settingsGroupCollapsedIcon, settingsGroupExpandedIcon, settingsScopeDropDownIcon } from 'vs/workbench/contrib/preferences/browser/preferencesIcons';
export class SettingsHeaderWidget extends Widget implements IViewZone {
......@@ -172,13 +171,23 @@ export class SettingsGroupTitleWidget extends Widget implements IViewZone {
this._register(focusTracker.onDidFocus(() => this.toggleFocus(true)));
this._register(focusTracker.onDidBlur(() => this.toggleFocus(false)));
this.icon = DOM.append(this.titleContainer, DOM.$('.codicon.codicon-chevron-down'));
this.icon = DOM.append(this.titleContainer, DOM.$(''));
this.title = DOM.append(this.titleContainer, DOM.$('.title'));
this.title.textContent = this.settingsGroup.title + ` (${this.settingsGroup.sections.reduce((count, section) => count + section.settings.length, 0)})`;
this.updateTwisty(false);
this.layout();
}
private getTwistyIcon(isCollapsed: boolean): ThemeIcon {
return isCollapsed ? settingsGroupCollapsedIcon : settingsGroupExpandedIcon;
}
private updateTwisty(collapse: boolean) {
this.icon.classList.remove(...ThemeIcon.asClassNameArray(this.getTwistyIcon(!collapse)));
this.icon.classList.add(...ThemeIcon.asClassNameArray(this.getTwistyIcon(collapse)));
}
render() {
if (!this.settingsGroup.range) {
// #61352
......@@ -194,6 +203,7 @@ export class SettingsGroupTitleWidget extends Widget implements IViewZone {
toggleCollapse(collapse: boolean) {
this.titleContainer.classList.toggle('collapsed', collapse);
this.updateTwisty(collapse);
}
toggleFocus(focus: boolean): void {
......@@ -258,6 +268,7 @@ export class SettingsGroupTitleWidget extends Widget implements IViewZone {
private collapse(collapse: boolean) {
if (collapse !== this.isCollapsed()) {
this.titleContainer.classList.toggle('collapsed', collapse);
this.updateTwisty(collapse);
this._onToggled.fire(collapse);
}
}
......@@ -346,7 +357,7 @@ export class FolderSettingsActionViewItem extends BaseActionViewItem {
this.container = container;
this.labelElement = DOM.$('.action-title');
this.detailsElement = DOM.$('.action-details');
this.dropDownElement = DOM.$('.dropdown-icon.codicon.codicon-triangle-down.hide');
this.dropDownElement = DOM.$('.dropdown-icon.hide' + ThemeIcon.asCSSSelector(settingsScopeDropDownIcon));
this.anchorElement = DOM.$('a.action-label.folder-settings', {
role: 'button',
'aria-haspopup': 'true',
......@@ -747,8 +758,6 @@ export class SearchWidget extends Widget {
}
}
export const preferencesEditIcon = registerIcon('preferences-edit', Codicon.edit, localize('preferencesEditIcon', 'Icon for the edit action in preferences.'));
export class EditPreferenceWidget<T> extends Disposable {
private _line: number = -1;
......@@ -786,7 +795,7 @@ export class EditPreferenceWidget<T> extends Disposable {
this._line = line;
newDecoration.push({
options: {
glyphMarginClassName: ThemeIcon.asClassName(preferencesEditIcon),
glyphMarginClassName: ThemeIcon.asClassName(settingsEditIcon),
glyphMarginHoverMessage: new MarkdownString().appendText(hoverMessage),
stickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,
},
......
......@@ -35,7 +35,7 @@ import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storag
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { badgeBackground, badgeForeground, contrastBorder, editorForeground } from 'vs/platform/theme/common/colorRegistry';
import { attachButtonStyler, attachStylerCallback } from 'vs/platform/theme/common/styler';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { IThemeService, ThemeIcon } from 'vs/platform/theme/common/themeService';
import { IUserDataAutoSyncEnablementService, IUserDataSyncService, SyncStatus } from 'vs/platform/userDataSync/common/userDataSync';
import { EditorPane } from 'vs/workbench/browser/parts/editor/editorPane';
import { IEditorMemento, IEditorOpenContext, IEditorPane } from 'vs/workbench/common/editor';
......@@ -52,6 +52,7 @@ import { IPreferencesService, ISearchResult, ISettingsEditorModel, ISettingsEdit
import { SettingsEditor2Input } from 'vs/workbench/services/preferences/common/preferencesEditorInput';
import { Settings2EditorModel } from 'vs/workbench/services/preferences/common/preferencesModels';
import { IUserDataSyncWorkbenchService } from 'vs/workbench/services/userDataSync/common/userDataSync';
import { preferencesClearInputIcon } from 'vs/workbench/contrib/preferences/browser/preferencesIcons';
export const enum SettingsFocusContext {
Search,
......@@ -435,7 +436,7 @@ export class SettingsEditor2 extends EditorPane {
const searchContainer = DOM.append(this.headerContainer, $('.search-container'));
const clearInputAction = new Action(SETTINGS_EDITOR_COMMAND_CLEAR_SEARCH_RESULTS, localize('clearInput', "Clear Settings Search Input"), 'codicon-clear-all', false, () => { this.clearSearchResults(); return Promise.resolve(null); });
const clearInputAction = new Action(SETTINGS_EDITOR_COMMAND_CLEAR_SEARCH_RESULTS, localize('clearInput', "Clear Settings Search Input"), ThemeIcon.asClassName(preferencesClearInputIcon), false, () => { this.clearSearchResults(); return Promise.resolve(null); });
this.searchWidget = this._register(this.instantiationService.createInstance(SuggestEnabledInput, `${SettingsEditor2.ID}.searchbox`, searchContainer, {
triggerCharacters: ['@'],
......
......@@ -38,7 +38,7 @@ import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { IOpenerService } from 'vs/platform/opener/common/opener';
import { editorBackground, errorForeground, focusBorder, foreground, inputValidationErrorBackground, inputValidationErrorBorder, inputValidationErrorForeground } from 'vs/platform/theme/common/colorRegistry';
import { attachButtonStyler, attachInputBoxStyler, attachSelectBoxStyler, attachStyler } from 'vs/platform/theme/common/styler';
import { ICssStyleCollector, IColorTheme, IThemeService, registerThemingParticipant } from 'vs/platform/theme/common/themeService';
import { ICssStyleCollector, IColorTheme, IThemeService, registerThemingParticipant, ThemeIcon } from 'vs/platform/theme/common/themeService';
import { getIgnoredSettings } from 'vs/platform/userDataSync/common/settingsMerge';
import { ITOCEntry } from 'vs/workbench/contrib/preferences/browser/settingsLayout';
import { ISettingsEditorViewState, settingKeyToDisplayFormat, SettingsTreeElement, SettingsTreeGroupChild, SettingsTreeGroupElement, SettingsTreeNewExtensionsElement, SettingsTreeSettingElement } from 'vs/workbench/contrib/preferences/browser/settingsTreeModels';
......@@ -56,6 +56,7 @@ import { IListService, WorkbenchObjectTree } from 'vs/platform/list/browser/list
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IAccessibilityService } from 'vs/platform/accessibility/common/accessibility';
import { ILogService } from 'vs/platform/log/common/log';
import { settingsMoreActionIcon } from 'vs/workbench/contrib/preferences/browser/preferencesIcons';
const $ = DOM.$;
......@@ -635,22 +636,12 @@ export abstract class AbstractSettingRenderer extends Disposable implements ITre
const toolbar = new ToolBar(container, this._contextMenuService, {
toggleMenuTitle,
renderDropdownAsChildElement: true
renderDropdownAsChildElement: true,
moreIcon: ThemeIcon.asCSSIcon(settingsMoreActionIcon) // change icon from ellipsis to gear
});
return toolbar;
}
private fixToolbarIcon(toolbar: ToolBar): void {
const button = toolbar.getElement().querySelector('.codicon-toolbar-more');
if (button) {
(<HTMLElement>button).tabIndex = 0;
// change icon from ellipsis to gear
(<HTMLElement>button).classList.add('codicon-gear');
(<HTMLElement>button).classList.remove('codicon-toolbar-more');
}
}
protected renderSettingElement(node: ITreeNode<SettingsTreeSettingElement, never>, index: number, template: ISettingItemTemplate | ISettingBoolItemTemplate): void {
const element = node.element;
template.context = element;
......@@ -658,7 +649,6 @@ export abstract class AbstractSettingRenderer extends Disposable implements ITre
const actions = this.disposableActionFactory(element.setting);
actions.forEach(a => template.elementDisposables?.add(a));
template.toolbar.setActions([], [...this.settingActions, ...actions]);
this.fixToolbarIcon(template.toolbar);
const setting = element.setting;
......
......@@ -24,7 +24,7 @@ import { IContextViewService } from 'vs/platform/contextview/browser/contextView
import { editorWidgetBorder, focusBorder, foreground, inputBackground, inputBorder, inputForeground, listActiveSelectionBackground, listActiveSelectionForeground, listFocusBackground, listHoverBackground, listHoverForeground, listInactiveSelectionBackground, listInactiveSelectionForeground, registerColor, selectBackground, selectBorder, selectForeground, simpleCheckboxBackground, simpleCheckboxBorder, simpleCheckboxForeground, textLinkActiveForeground, textLinkForeground, textPreformatForeground, transparent } from 'vs/platform/theme/common/colorRegistry';
import { attachButtonStyler, attachInputBoxStyler, attachSelectBoxStyler } from 'vs/platform/theme/common/styler';
import { IColorTheme, ICssStyleCollector, IThemeService, registerThemingParticipant, ThemeIcon } from 'vs/platform/theme/common/themeService';
import { preferencesEditIcon } from 'vs/workbench/contrib/preferences/browser/preferencesWidgets';
import { settingsDiscardIcon, settingsEditIcon, settingsRemoveIcon } from 'vs/workbench/contrib/preferences/browser/preferencesIcons';
const $ = DOM.$;
export const settingsHeaderForeground = registerColor('settings.headerForeground', { light: '#444444', dark: '#e7e7e7', hc: '#ffffff' }, localize('headerForeground', "The foreground color for a section header or active title."));
......@@ -496,14 +496,14 @@ export class ListSettingWidget extends AbstractListSettingWidget<IListDataItem>
protected getActionsForItem(item: IListDataItem, idx: number): IAction[] {
return [
{
class: ThemeIcon.asClassName(preferencesEditIcon),
class: ThemeIcon.asClassName(settingsEditIcon),
enabled: true,
id: 'workbench.action.editListItem',
tooltip: this.getLocalizedStrings().editActionTooltip,
run: () => this.editSetting(idx)
},
{
class: 'codicon-close',
class: ThemeIcon.asClassName(settingsRemoveIcon),
enabled: true,
id: 'workbench.action.removeListItem',
tooltip: this.getLocalizedStrings().deleteActionTooltip,
......@@ -740,7 +740,7 @@ export class ObjectSettingWidget extends AbstractListSettingWidget<IObjectDataIt
protected getActionsForItem(item: IObjectDataItem, idx: number): IAction[] {
const actions = [
{
class: ThemeIcon.asClassName(preferencesEditIcon),
class: ThemeIcon.asClassName(settingsEditIcon),
enabled: true,
id: 'workbench.action.editListItem',
tooltip: this.getLocalizedStrings().editActionTooltip,
......@@ -750,7 +750,7 @@ export class ObjectSettingWidget extends AbstractListSettingWidget<IObjectDataIt
if (item.removable) {
actions.push({
class: 'codicon-close',
class: ThemeIcon.asClassName(settingsRemoveIcon),
enabled: true,
id: 'workbench.action.removeListItem',
tooltip: this.getLocalizedStrings().deleteActionTooltip,
......@@ -758,7 +758,7 @@ export class ObjectSettingWidget extends AbstractListSettingWidget<IObjectDataIt
} as IAction);
} else {
actions.push({
class: 'codicon-discard',
class: ThemeIcon.asClassName(settingsDiscardIcon),
enabled: true,
id: 'workbench.action.resetListItem',
tooltip: this.getLocalizedStrings().resetActionTooltip,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册