提交 5b0796e8 编写于 作者: J Jackson Kearl

Add option for always visible action buttons in side panels. Fixes #37714

上级 5b833336
......@@ -54,6 +54,7 @@
/* TODO: actions should be part of the panel, but they aren't yet */
.monaco-panel-view .panel:hover > .panel-header.expanded > .actions,
.monaco-panel-view .panel > .panel-header.actions-always-visible.expanded > .actions,
.monaco-panel-view .panel > .panel-header.focused.expanded > .actions {
display: initial;
}
......
......@@ -11,7 +11,7 @@ import { ColorIdentifier, contrastBorder } from 'vs/platform/theme/common/colorR
import { attachStyler, IColorMapping, IThemable } from 'vs/platform/theme/common/styler';
import { SIDE_BAR_DRAG_AND_DROP_BACKGROUND, SIDE_BAR_SECTION_HEADER_FOREGROUND, SIDE_BAR_SECTION_HEADER_BACKGROUND } from 'vs/workbench/common/theme';
import { Dimension, Builder } from 'vs/base/browser/builder';
import { append, $, trackFocus } from 'vs/base/browser/dom';
import { append, $, trackFocus, toggleClass } from 'vs/base/browser/dom';
import { IDisposable, combinedDisposable } from 'vs/base/common/lifecycle';
import { firstIndex } from 'vs/base/common/arrays';
import { IAction, IActionRunner } from 'vs/base/common/actions';
......@@ -25,6 +25,7 @@ import { IContextMenuService } from 'vs/platform/contextview/browser/contextView
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { PanelView, IPanelViewOptions, IPanelOptions, Panel } from 'vs/base/browser/ui/splitview/panelview';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
export interface IPanelColors extends IColorMapping {
dropBackground?: ColorIdentifier;
......@@ -54,15 +55,19 @@ export abstract class ViewletPanel extends Panel {
protected actionRunner: IActionRunner;
protected toolbar: ToolBar;
private updateActionVisibilityPreferences: () => void = () => { };
constructor(
readonly title: string,
options: IViewletPanelOptions,
@IKeybindingService protected keybindingService: IKeybindingService,
@IContextMenuService protected contextMenuService: IContextMenuService
@IContextMenuService protected contextMenuService: IContextMenuService,
@IConfigurationService protected readonly configurationService: IConfigurationService
) {
super(options);
this.actionRunner = options.actionRunner;
this.configurationService.onDidChangeConfiguration(() => this.updateActionVisibilityPreferences());
}
render(container: HTMLElement): void {
......@@ -76,6 +81,9 @@ export abstract class ViewletPanel extends Panel {
protected renderHeader(container: HTMLElement): void {
this.renderHeaderTitle(container);
this.updateActionVisibilityPreferences = () => toggleClass(container, 'actions-always-visible', this.shouldAlwaysShowActions());
this.updateActionVisibilityPreferences();
const actions = append(container, $('.actions'));
this.toolbar = new ToolBar(actions, this.contextMenuService, {
orientation: ActionsOrientation.HORIZONTAL,
......@@ -102,6 +110,10 @@ export abstract class ViewletPanel extends Panel {
this.toolbar.context = this.getActionsContext();
}
private shouldAlwaysShowActions(): boolean {
return this.configurationService.getValue<boolean>('workbench.panel.alwaysShowActions');
}
getActions(): IAction[] {
return [];
}
......
......@@ -28,6 +28,7 @@ import { TreeViewsViewletPanel, IViewletViewOptions, IViewOptions } from 'vs/wor
import { ICommandService } from 'vs/platform/commands/common/commands';
import { TreeItemCollapsibleState, ITreeItem, ITreeViewDataProvider, TreeViewItemHandleArg } from 'vs/workbench/common/views';
import { WorkbenchTree, IListService } from 'vs/platform/list/browser/listService';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
export class TreeView extends TreeViewsViewletPanel {
......@@ -48,9 +49,10 @@ export class TreeView extends TreeViewsViewletPanel {
@IThemeService private themeService: IThemeService,
@IContextKeyService private contextKeyService: IContextKeyService,
@IExtensionService private extensionService: IExtensionService,
@ICommandService private commandService: ICommandService
@ICommandService private commandService: ICommandService,
@IConfigurationService protected readonly configurationService: IConfigurationService
) {
super({ ...(options as IViewOptions), ariaHeaderLabel: options.name }, keybindingService, contextMenuService);
super({ ...(options as IViewOptions), ariaHeaderLabel: options.name }, keybindingService, contextMenuService, configurationService);
this.menus = this.instantiationService.createInstance(Menus, this.id);
this.menus.onDidChangeTitle(() => this.updateActions(), this, this.disposables);
this.themeService.onThemeChange(() => this.tree.refresh() /* soft refresh */, this, this.disposables);
......
......@@ -28,6 +28,7 @@ import { StandardMouseEvent } from 'vs/base/browser/mouseEvent';
import { PanelViewlet, ViewletPanel } from 'vs/workbench/browser/parts/views/panelViewlet';
import { IPanelOptions } from 'vs/base/browser/ui/splitview/panelview';
import { WorkbenchTree } from 'vs/platform/list/browser/listService';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
export interface IViewOptions extends IPanelOptions {
id: string;
......@@ -45,9 +46,10 @@ export abstract class ViewsViewletPanel extends ViewletPanel {
constructor(
options: IViewOptions,
protected keybindingService: IKeybindingService,
protected contextMenuService: IContextMenuService
protected contextMenuService: IContextMenuService,
@IConfigurationService protected readonly configurationService: IConfigurationService
) {
super(options.name, options, keybindingService, contextMenuService);
super(options.name, options, keybindingService, contextMenuService, configurationService);
this.id = options.id;
this.name = options.name;
......@@ -111,9 +113,10 @@ export abstract class TreeViewsViewletPanel extends ViewsViewletPanel {
constructor(
options: IViewOptions,
protected keybindingService: IKeybindingService,
protected contextMenuService: IContextMenuService
protected contextMenuService: IContextMenuService,
@IConfigurationService protected readonly configurationService: IConfigurationService
) {
super(options, keybindingService, contextMenuService);
super(options, keybindingService, contextMenuService, configurationService);
this.id = options.id;
this.name = options.name;
......
......@@ -253,6 +253,11 @@ configurationRegistry.registerConfiguration({
'default': true,
'description': nls.localize('activityBarVisibility', "Controls the visibility of the activity bar in the workbench.")
},
'workbench.panel.alwaysShowActions': {
'type': 'boolean',
'default': false,
'description': nls.localize('panelActionVisibility', "Controls the visibility of side panel tree view actions. A panel's actions may either be always visible, or only visible when that panel is active.")
},
'workbench.fontAliasing': {
'type': 'string',
'enum': ['default', 'antialiased', 'none'],
......
......@@ -33,6 +33,7 @@ import { ViewsViewletPanel, IViewletViewOptions } from 'vs/workbench/browser/par
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { attachInputBoxStyler } from 'vs/platform/theme/common/styler';
import { isCodeEditor } from 'vs/editor/browser/editorBrowser';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
const $ = dom.$;
......@@ -54,9 +55,10 @@ export class BreakpointsView extends ViewsViewletPanel {
@IThemeService private themeService: IThemeService,
@IEditorService private editorService: IEditorService,
@IContextViewService private contextViewService: IContextViewService,
@IContextKeyService private contextKeyService: IContextKeyService
@IContextKeyService private contextKeyService: IContextKeyService,
@IConfigurationService protected readonly configurationService: IConfigurationService
) {
super(options, keybindingService, contextMenuService);
super(options, keybindingService, contextMenuService, configurationService);
this.minimumBodySize = this.maximumBodySize = this.getExpandedBodySize();
this.settings = options.viewletSettings;
......
......@@ -29,6 +29,7 @@ import { WorkbenchTree, IListService } from 'vs/platform/list/browser/listServic
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import FileResultsNavigation from 'vs/workbench/parts/files/browser/fileResultsNavigation';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
const $ = dom.$;
......@@ -51,8 +52,9 @@ export class CallStackView extends TreeViewsViewletPanel {
@IThemeService private themeService: IThemeService,
@IListService private listService: IListService,
@IWorkbenchEditorService private editorService: IWorkbenchEditorService,
@IConfigurationService protected readonly configurationService: IConfigurationService,
) {
super({ ...(options as IViewOptions), ariaHeaderLabel: nls.localize('callstackSection', "Call Stack Section") }, keybindingService, contextMenuService);
super({ ...(options as IViewOptions), ariaHeaderLabel: nls.localize('callstackSection', "Call Stack Section") }, keybindingService, contextMenuService, configurationService);
this.settings = options.viewletSettings;
// Create scheduler to prevent unnecessary flashing of tree when reacting to changes
......
......@@ -29,6 +29,7 @@ import { ViewModel } from 'vs/workbench/parts/debug/common/debugViewModel';
import { equalsIgnoreCase } from 'vs/base/common/strings';
import { IMouseEvent } from 'vs/base/browser/mouseEvent';
import { WorkbenchTree, IListService } from 'vs/platform/list/browser/listService';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
const $ = dom.$;
......@@ -48,9 +49,10 @@ export class VariablesView extends TreeViewsViewletPanel {
@IInstantiationService private instantiationService: IInstantiationService,
@IListService private listService: IListService,
@IContextKeyService private contextKeyService: IContextKeyService,
@IThemeService private themeService: IThemeService
@IThemeService private themeService: IThemeService,
@IConfigurationService protected readonly configurationService: IConfigurationService,
) {
super({ ...(options as IViewOptions), ariaHeaderLabel: nls.localize('variablesSection', "Variables Section") }, keybindingService, contextMenuService);
super({ ...(options as IViewOptions), ariaHeaderLabel: nls.localize('variablesSection', "Variables Section") }, keybindingService, contextMenuService, configurationService);
this.settings = options.viewletSettings;
this.expandedElements = [];
......
......@@ -30,6 +30,7 @@ import { IMouseEvent, DragMouseEvent } from 'vs/base/browser/mouseEvent';
import { DefaultDragAndDrop } from 'vs/base/parts/tree/browser/treeDefaults';
import { IVariableTemplateData, renderVariable, renderRenameBox, renderExpressionValue, BaseDebugController, twistiePixels, renderViewTree } from 'vs/workbench/parts/debug/electron-browser/baseDebugView';
import { WorkbenchTree, IListService } from 'vs/platform/list/browser/listService';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
const $ = dom.$;
const MAX_VALUE_RENDER_LENGTH_IN_VIEWLET = 1024;
......@@ -49,9 +50,10 @@ export class WatchExpressionsView extends TreeViewsViewletPanel {
@IContextKeyService private contextKeyService: IContextKeyService,
@IListService private listService: IListService,
@IInstantiationService private instantiationService: IInstantiationService,
@IThemeService private themeService: IThemeService
@IThemeService private themeService: IThemeService,
@IConfigurationService protected readonly configurationService: IConfigurationService,
) {
super({ ...(options as IViewOptions), ariaHeaderLabel: nls.localize('expressionsSection', "Expressions Section") }, keybindingService, contextMenuService);
super({ ...(options as IViewOptions), ariaHeaderLabel: nls.localize('expressionsSection', "Expressions Section") }, keybindingService, contextMenuService, configurationService);
this.settings = options.viewletSettings;
this.onWatchExpressionsUpdatedScheduler = new RunOnceScheduler(() => {
......
......@@ -37,6 +37,7 @@ import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
import { InstallWorkspaceRecommendedExtensionsAction, ConfigureWorkspaceFolderRecommendedExtensionsAction } from 'vs/workbench/parts/extensions/browser/extensionsActions';
import { WorkbenchPagedList, IListService } from 'vs/platform/list/browser/listService';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
export class ExtensionsListView extends ViewsViewletPanel {
......@@ -61,9 +62,10 @@ export class ExtensionsListView extends ViewsViewletPanel {
@IExtensionTipsService private tipsService: IExtensionTipsService,
@IModeService private modeService: IModeService,
@ITelemetryService private telemetryService: ITelemetryService,
@IContextKeyService private contextKeyService: IContextKeyService
@IContextKeyService private contextKeyService: IContextKeyService,
@IConfigurationService protected readonly configurationService: IConfigurationService,
) {
super({ ...(options as IViewOptions), ariaHeaderLabel: options.name }, keybindingService, contextMenuService);
super({ ...(options as IViewOptions), ariaHeaderLabel: options.name }, keybindingService, contextMenuService, configurationService);
}
renderHeader(container: HTMLElement): void {
......
......@@ -21,6 +21,7 @@ import { IThemeService } from 'vs/platform/theme/common/themeService';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
export class EmptyView extends ViewsViewletPanel {
......@@ -37,9 +38,10 @@ export class EmptyView extends ViewsViewletPanel {
@IInstantiationService private instantiationService: IInstantiationService,
@IKeybindingService keybindingService: IKeybindingService,
@IContextMenuService contextMenuService: IContextMenuService,
@IWorkspaceContextService private contextService: IWorkspaceContextService
@IWorkspaceContextService private contextService: IWorkspaceContextService,
@IConfigurationService protected configurationService: IConfigurationService
) {
super({ ...(options as IViewOptions), ariaHeaderLabel: nls.localize('explorerSection', "Files Explorer Section") }, keybindingService, contextMenuService);
super({ ...(options as IViewOptions), ariaHeaderLabel: nls.localize('explorerSection', "Files Explorer Section") }, keybindingService, contextMenuService, configurationService);
this.contextService.onDidChangeWorkbenchState(() => this.setLabels());
}
......
......@@ -90,11 +90,11 @@ export class ExplorerView extends TreeViewsViewletPanel implements IExplorerView
@IPartService private partService: IPartService,
@IKeybindingService keybindingService: IKeybindingService,
@IContextKeyService private contextKeyService: IContextKeyService,
@IConfigurationService private configurationService: IConfigurationService,
@IConfigurationService protected configurationService: IConfigurationService,
@IWorkbenchThemeService private themeService: IWorkbenchThemeService,
@IDecorationsService decorationService: IDecorationsService
) {
super({ ...(options as IViewOptions), ariaHeaderLabel: nls.localize('explorerSection', "Files Explorer Section") }, keybindingService, contextMenuService);
super({ ...(options as IViewOptions), ariaHeaderLabel: nls.localize('explorerSection', "Files Explorer Section") }, keybindingService, contextMenuService, configurationService);
this.settings = options.viewletSettings;
this.viewletState = options.viewletState;
......
......@@ -73,7 +73,7 @@ export class OpenEditorsView extends ViewsViewletPanel {
@ITextFileService private textFileService: ITextFileService,
@IWorkbenchEditorService private editorService: IWorkbenchEditorService,
@IEditorGroupService private editorGroupService: IEditorGroupService,
@IConfigurationService private configurationService: IConfigurationService,
@IConfigurationService protected configurationService: IConfigurationService,
@IKeybindingService keybindingService: IKeybindingService,
@IListService private listService: IListService,
@IUntitledEditorService private untitledEditorService: IUntitledEditorService,
......@@ -85,7 +85,7 @@ export class OpenEditorsView extends ViewsViewletPanel {
super({
...(options as IViewOptions),
ariaHeaderLabel: nls.localize({ key: 'openEditosrSection', comment: ['Open is an adjective'] }, "Open Editors Section"),
}, keybindingService, contextMenuService);
}, keybindingService, contextMenuService, configurationService);
this.model = editorGroupService.getStacksModel();
......
......@@ -229,9 +229,10 @@ class MainPanel extends ViewletPanel {
@IThemeService private themeService: IThemeService,
@IContextKeyService private contextKeyService: IContextKeyService,
@IListService private listService: IListService,
@IMenuService private menuService: IMenuService
@IMenuService private menuService: IMenuService,
@IConfigurationService protected readonly configurationService: IConfigurationService
) {
super(localize('scm providers', "Source Control Providers"), {}, keybindingService, contextMenuService);
super(localize('scm providers', "Source Control Providers"), {}, keybindingService, contextMenuService, configurationService);
this.updateBodySize();
}
......@@ -699,7 +700,7 @@ export class RepositoryPanel extends ViewletPanel {
@IInstantiationService protected instantiationService: IInstantiationService,
@IConfigurationService protected configurationService: IConfigurationService
) {
super(repository.provider.label, {}, keybindingService, contextMenuService);
super(repository.provider.label, {}, keybindingService, contextMenuService, configurationService);
this.menus = instantiationService.createInstance(SCMMenus, repository.provider);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册