未验证 提交 ca19bd62 编写于 作者: I Isidor Nikolic 提交者: GitHub

Merge pull request #59621 from Microsoft/isidorn/panelPosition

Panel: remove the "toggle location" action in the panel header and move to menu
......@@ -682,6 +682,7 @@ export class CodeMenu {
}
const moveSidebar = this.createMenuItem(moveSideBarLabel, 'workbench.action.toggleSidebarPosition');
const movePanel = this.createMenuItem(nls.localize('togglePanelPosition', "Toggle Panel Position"), 'workbench.action.togglePanelPosition');
const togglePanel = this.createMenuItem(nls.localize({ key: 'miTogglePanel', comment: ['&& denotes a mnemonic'] }, "Toggle &&Panel"), 'workbench.action.togglePanel');
let statusBarLabel: string;
......@@ -712,6 +713,7 @@ export class CodeMenu {
__separator__(),
moveSidebar,
toggleSidebar,
movePanel,
togglePanel,
toggleStatusbar,
toggleActivtyBar,
......@@ -1291,4 +1293,4 @@ export class CodeMenu {
function __separator__(): Electron.MenuItem {
return new MenuItem({ type: 'separator' });
}
\ No newline at end of file
}
......@@ -30,6 +30,7 @@ import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IEditorGroupsService } from 'vs/workbench/services/group/common/editorGroupsService';
import { URI } from 'vs/base/common/uri';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
export interface IUserFriendlyViewsContainerDescriptor {
id: string;
......@@ -161,6 +162,7 @@ class ViewsContainersExtensionHandler implements IWorkbenchContribution {
// Register as viewlet
class CustomViewlet extends ViewContainerViewlet {
constructor(
@IConfigurationService configurationService: IConfigurationService,
@IPartService partService: IPartService,
@ITelemetryService telemetryService: ITelemetryService,
@IWorkspaceContextService contextService: IWorkspaceContextService,
......@@ -171,7 +173,7 @@ class ViewsContainersExtensionHandler implements IWorkbenchContribution {
@IContextMenuService contextMenuService: IContextMenuService,
@IExtensionService extensionService: IExtensionService
) {
super(id, `${id}.state`, true, partService, telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService);
super(id, `${id}.state`, true, configurationService, partService, telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService);
}
}
const viewletDescriptor = new ViewletDescriptor(
......
......@@ -37,6 +37,10 @@ export class ToggleSidebarPositionAction extends Action {
return this.configurationService.updateValue(ToggleSidebarPositionAction.sidebarPositionConfigurationKey, newPositionValue, ConfigurationTarget.USER);
}
static getLabel(partService: IPartService): string {
return partService.getSideBarPosition() === Position.LEFT ? nls.localize('moveSidebarRight', "Move Side Bar Right") : nls.localize('moveSidebarLeft', "Move Side Bar Left");
}
}
const registry = Registry.as<IWorkbenchActionRegistry>(Extensions.WorkbenchActions);
......
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.icon-canvas-transparent,.icon-vs-out{fill:#2d2d30;}.icon-canvas-transparent{opacity:0;}.icon-vs-fg{fill:#2b282e;}.icon-vs-bg{fill:#c5c5c5;}</style></defs><title>DockBottom_16x</title><path class="icon-canvas-transparent" d="M16,0V16H0V0Z"/><path class="icon-vs-out" d="M16,1V15H0V1Z" style="display: none;"/><path class="icon-vs-fg" d="M14,3V9H2V3Z" style="display: none;"/><path class="icon-vs-bg" d="M1,2V14H15V2ZM14,9H2V3H14Z"/></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.icon-canvas-transparent,.icon-vs-out{fill:#f6f6f6;}.icon-canvas-transparent{opacity:0;}.icon-vs-fg{fill:#f0eff1;}.icon-vs-bg{fill:#424242;}</style></defs><title>DockBottom_16x</title><path class="icon-canvas-transparent" d="M16,0V16H0V0Z"/><path class="icon-vs-out" d="M16,1V15H0V1Z" style="display: none;"/><path class="icon-vs-fg" d="M14,3V9H2V3Z" style="display: none;"/><path class="icon-vs-bg" d="M1,2V14H15V2ZM14,9H2V3H14Z"/></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.icon-canvas-transparent,.icon-vs-out{fill:#2d2d30;}.icon-canvas-transparent{opacity:0;}.icon-vs-fg{fill:#2b282e;}.icon-vs-bg{fill:#c5c5c5;}</style></defs><title>DockRight_16x</title><path class="icon-canvas-transparent" d="M16,0V16H0V0Z"/><path class="icon-vs-out" d="M16,1V15H0V1Z" style="display: none;"/><path class="icon-vs-fg" d="M10,3V13H2V3Z" style="display: none;"/><path class="icon-vs-bg" d="M1,2V14H15V2Zm9,11H2V3h8Z"/></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.icon-canvas-transparent,.icon-vs-out{fill:#f6f6f6;}.icon-canvas-transparent{opacity:0;}.icon-vs-fg{fill:#f0eff1;}.icon-vs-bg{fill:#424242;}</style></defs><title>DockRight_16x</title><path class="icon-canvas-transparent" d="M16,0V16H0V0Z"/><path class="icon-vs-out" d="M16,1V15H0V1Z" style="display: none;"/><path class="icon-vs-fg" d="M10,3V13H2V3Z" style="display: none;"/><path class="icon-vs-bg" d="M1,2V14H15V2Zm9,11H2V3h8Z"/></svg>
\ No newline at end of file
......@@ -147,24 +147,6 @@
background-image: url('right-inverse.svg');
}
.monaco-workbench .move-panel-to-right {
background: url('panel-right.svg') center center no-repeat;
}
.vs-dark .monaco-workbench .move-panel-to-right,
.hc-black .monaco-workbench .move-panel-to-right {
background: url('panel-right-inverse.svg') center center no-repeat;
}
.monaco-workbench .move-panel-to-bottom {
background: url('panel-bottom.svg') center center no-repeat;
}
.vs-dark .monaco-workbench .move-panel-to-bottom,
.hc-black .monaco-workbench .move-panel-to-bottom {
background: url('panel-bottom-inverse.svg') center center no-repeat;
}
.vs-dark .monaco-workbench .hide-panel-action,
.hc-black .monaco-workbench .hide-panel-action {
background: url('close-inverse.svg') center center no-repeat;
......
......@@ -88,8 +88,8 @@ export class TogglePanelPositionAction extends Action {
static readonly ID = 'workbench.action.togglePanelPosition';
static readonly LABEL = nls.localize('toggledPanelPosition', "Toggle Panel Position");
private static readonly MOVE_TO_RIGHT_LABEL = nls.localize('moveToRight', "Move to Right");
private static readonly MOVE_TO_BOTTOM_LABEL = nls.localize('moveToBottom', "Move to Bottom");
private static readonly MOVE_TO_RIGHT_LABEL = nls.localize('moveToRight', "Move Panel Right");
private static readonly MOVE_TO_BOTTOM_LABEL = nls.localize('moveToBottom', "Move Panel to Bottom");
private toDispose: IDisposable[];
......@@ -97,7 +97,6 @@ export class TogglePanelPositionAction extends Action {
id: string,
label: string,
@IPartService private partService: IPartService,
) {
super(id, label, partService.getPanelPosition() === Position.RIGHT ? 'move-panel-to-bottom' : 'move-panel-to-right');
this.toDispose = [];
......@@ -186,3 +185,12 @@ MenuRegistry.appendMenuItem(MenuId.MenubarAppearanceMenu, {
},
order: 5
});
MenuRegistry.appendMenuItem(MenuId.MenubarAppearanceMenu, {
group: '2_workbench_layout',
command: {
id: TogglePanelPositionAction.ID,
title: TogglePanelPositionAction.LABEL
},
order: 3
});
......@@ -89,7 +89,10 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
getActivityAction: (compositeId: string) => this.getCompositeActions(compositeId).activityAction,
getCompositePinnedAction: (compositeId: string) => this.getCompositeActions(compositeId).pinnedAction,
getOnCompositeClickAction: (compositeId: string) => this.instantiationService.createInstance(PanelActivityAction, this.getPanel(compositeId)),
getContextMenuActions: () => [this.instantiationService.createInstance(TogglePanelAction, TogglePanelAction.ID, localize('hidePanel', "Hide Panel"))],
getContextMenuActions: () => [
this.instantiationService.createInstance(TogglePanelPositionAction, TogglePanelPositionAction.ID, TogglePanelPositionAction.LABEL),
this.instantiationService.createInstance(TogglePanelAction, TogglePanelAction.ID, localize('hidePanel', "Hide Panel"))
],
getDefaultCompositeId: () => Registry.as<PanelRegistry>(PanelExtensions.Panels).getDefaultPanelId(),
hidePart: () => this.partService.setPanelHidden(true),
compositeSize: 0,
......@@ -210,7 +213,6 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
protected getActions(): IAction[] {
return [
this.instantiationService.createInstance(ToggleMaximizedPanelAction, ToggleMaximizedPanelAction.ID, ToggleMaximizedPanelAction.LABEL),
this.instantiationService.createInstance(TogglePanelPositionAction, TogglePanelPositionAction.ID, TogglePanelPositionAction.LABEL),
this.instantiationService.createInstance(ClosePanelAction, ClosePanelAction.ID, ClosePanelAction.LABEL)
];
}
......
......@@ -199,12 +199,13 @@ export class PanelViewlet extends Viewlet {
constructor(
id: string,
private options: IViewsViewletOptions,
@IConfigurationService configurationService: IConfigurationService,
@IPartService partService: IPartService,
@IContextMenuService protected contextMenuService: IContextMenuService,
@ITelemetryService telemetryService: ITelemetryService,
@IThemeService themeService: IThemeService
) {
super(id, partService, telemetryService, themeService);
super(id, configurationService, partService, telemetryService, themeService);
}
create(parent: HTMLElement): TPromise<void> {
......
......@@ -123,6 +123,7 @@ export abstract class ViewContainerViewlet extends PanelViewlet implements IView
id: string,
viewletStateStorageId: string,
showHeaderInTitleWhenSingleView: boolean,
@IConfigurationService configurationService: IConfigurationService,
@IPartService partService: IPartService,
@ITelemetryService telemetryService: ITelemetryService,
@IStorageService protected storageService: IStorageService,
......@@ -132,7 +133,7 @@ export abstract class ViewContainerViewlet extends PanelViewlet implements IView
@IExtensionService protected extensionService: IExtensionService,
@IWorkspaceContextService protected contextService: IWorkspaceContextService
) {
super(id, { showHeaderInTitleWhenSingleView, dnd: new DefaultPanelDndController() }, partService, contextMenuService, telemetryService, themeService);
super(id, { showHeaderInTitleWhenSingleView, dnd: new DefaultPanelDndController() }, configurationService, partService, contextMenuService, telemetryService, themeService);
const container = Registry.as<IViewContainersRegistry>(ViewContainerExtensions.ViewContainersRegistry).get(id);
this.viewsModel = this._register(this.instantiationService.createInstance(PersistentContributableViewsModel, container, viewletStateStorageId));
......
......@@ -19,10 +19,13 @@ import { IPartService, Parts } from 'vs/workbench/services/part/common/partServi
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { IEditorGroupsService } from 'vs/workbench/services/group/common/editorGroupsService';
import { URI } from 'vs/base/common/uri';
import { ToggleSidebarPositionAction } from 'vs/workbench/browser/actions/toggleSidebarPosition';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
export abstract class Viewlet extends Composite implements IViewlet {
constructor(id: string,
protected configurationService: IConfigurationService,
private partService: IPartService,
telemetryService: ITelemetryService,
themeService: IThemeService
......@@ -35,12 +38,14 @@ export abstract class Viewlet extends Composite implements IViewlet {
}
getContextMenuActions(): IAction[] {
return [<IAction>{
id: ToggleSidebarVisibilityAction.ID,
label: nls.localize('compositePart.hideSideBarLabel', "Hide Side Bar"),
enabled: true,
run: () => this.partService.setSideBarHidden(true)
}];
const toggleSidebarPositionAction = new ToggleSidebarPositionAction(ToggleSidebarPositionAction.ID, ToggleSidebarPositionAction.getLabel(this.partService), this.partService, this.configurationService);
return [toggleSidebarPositionAction,
<IAction>{
id: ToggleSidebarVisibilityAction.ID,
label: nls.localize('compositePart.hideSideBarLabel', "Hide Side Bar"),
enabled: true,
run: () => this.partService.setSideBarHidden(true)
}];
}
}
......
......@@ -48,11 +48,11 @@ export class DebugViewlet extends ViewContainerViewlet {
@IThemeService themeService: IThemeService,
@IContextMenuService contextMenuService: IContextMenuService,
@IExtensionService extensionService: IExtensionService,
@IConfigurationService private configurationService: IConfigurationService,
@IConfigurationService configurationService: IConfigurationService,
@IKeybindingService private keybindingService: IKeybindingService,
@IContextViewService private contextViewService: IContextViewService,
) {
super(VIEWLET_ID, `${VIEWLET_ID}.state`, false, partService, telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService);
super(VIEWLET_ID, `${VIEWLET_ID}.state`, false, configurationService, partService, telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService);
this.progressRunner = null;
......@@ -184,4 +184,4 @@ export class DebugViewlet extends ViewContainerViewlet {
this.breakpointView.maximumBodySize = allOtherCollapsed ? Number.POSITIVE_INFINITY : this.breakpointView.minimumBodySize;
}
}
}
\ No newline at end of file
}
......@@ -291,7 +291,7 @@ export class ExtensionsViewlet extends ViewContainerViewlet implements IExtensio
@INotificationService private notificationService: INotificationService,
@IViewletService private viewletService: IViewletService,
@IThemeService themeService: IThemeService,
@IConfigurationService private configurationService: IConfigurationService,
@IConfigurationService configurationService: IConfigurationService,
@IStorageService storageService: IStorageService,
@IWorkspaceContextService contextService: IWorkspaceContextService,
@IContextKeyService contextKeyService: IContextKeyService,
......@@ -299,7 +299,7 @@ export class ExtensionsViewlet extends ViewContainerViewlet implements IExtensio
@IExtensionService extensionService: IExtensionService,
@IExtensionManagementServerService private extensionManagementServerService: IExtensionManagementServerService
) {
super(VIEWLET_ID, `${VIEWLET_ID}.state`, true, partService, telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService);
super(VIEWLET_ID, `${VIEWLET_ID}.state`, true, configurationService, partService, telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService);
this.searchDelayer = new ThrottledDelayer(500);
this.nonEmptyWorkspaceContextKey = NonEmptyWorkspaceContext.bindTo(contextKeyService);
......@@ -650,4 +650,4 @@ export class MaliciousExtensionChecker implements IWorkbenchContribution {
dispose(): void {
this.disposables = dispose(this.disposables);
}
}
\ No newline at end of file
}
......@@ -163,14 +163,14 @@ export class ExplorerViewlet extends ViewContainerViewlet implements IExplorerVi
@IStorageService protected storageService: IStorageService,
@IEditorService private editorService: IEditorService,
@IEditorGroupsService private editorGroupService: IEditorGroupsService,
@IConfigurationService private configurationService: IConfigurationService,
@IConfigurationService configurationService: IConfigurationService,
@IInstantiationService protected instantiationService: IInstantiationService,
@IContextKeyService contextKeyService: IContextKeyService,
@IThemeService themeService: IThemeService,
@IContextMenuService contextMenuService: IContextMenuService,
@IExtensionService extensionService: IExtensionService
) {
super(VIEWLET_ID, ExplorerViewlet.EXPLORER_VIEWS_STATE, true, partService, telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService);
super(VIEWLET_ID, ExplorerViewlet.EXPLORER_VIEWS_STATE, true, configurationService, partService, telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService);
this.viewletState = new FileViewletState();
this.viewletVisibleContextKey = ExplorerViewletVisibleContext.bindTo(contextKeyService);
......
......@@ -1062,9 +1062,9 @@ export class SCMViewlet extends PanelViewlet implements IViewModel, IViewsViewle
@IWorkspaceContextService contextService: IWorkspaceContextService,
@IStorageService storageService: IStorageService,
@IExtensionService extensionService: IExtensionService,
@IConfigurationService private configurationService: IConfigurationService,
@IConfigurationService configurationService: IConfigurationService,
) {
super(VIEWLET_ID, { showHeaderInTitleWhenSingleView: true, dnd: new SCMPanelDndController() }, partService, contextMenuService, telemetryService, themeService);
super(VIEWLET_ID, { showHeaderInTitleWhenSingleView: true, dnd: new SCMPanelDndController() }, configurationService, partService, contextMenuService, telemetryService, themeService);
this.menus = instantiationService.createInstance(SCMMenus, undefined);
this.menus.onDidChangeTitle(this.updateTitleArea, this, this.disposables);
......
......@@ -126,7 +126,7 @@ export class SearchView extends Viewlet implements IViewlet, IPanel {
@IStorageService private storageService: IStorageService,
@IContextViewService private contextViewService: IContextViewService,
@IInstantiationService private instantiationService: IInstantiationService,
@IConfigurationService private configurationService: IConfigurationService,
@IConfigurationService configurationService: IConfigurationService,
@IWorkspaceContextService private contextService: IWorkspaceContextService,
@ISearchWorkbenchService private searchWorkbenchService: ISearchWorkbenchService,
@IContextKeyService private contextKeyService: IContextKeyService,
......@@ -137,7 +137,7 @@ export class SearchView extends Viewlet implements IViewlet, IPanel {
@ISearchHistoryService private searchHistoryService: ISearchHistoryService,
@IEditorGroupsService private editorGroupsService: IEditorGroupsService
) {
super(VIEW_ID, partService, telemetryService, themeService);
super(VIEW_ID, configurationService, partService, telemetryService, themeService);
this.viewletVisible = Constants.SearchViewVisibleKey.bindTo(contextKeyService);
this.viewletFocused = Constants.SearchViewFocusedKey.bindTo(contextKeyService);
......@@ -1578,4 +1578,4 @@ registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => {
if (outlineSelectionColor) {
collector.addRule(`.monaco-workbench .search-view .monaco-tree.focused .monaco-tree-row.focused.selected:not(.highlighted) .action-label:focus { outline-color: ${outlineSelectionColor} }`);
}
});
\ No newline at end of file
});
......@@ -15,7 +15,7 @@ suite('Viewlets', () => {
class TestViewlet extends Viewlet {
constructor() {
super('id', null, null, null);
super('id', null, null, null, null);
}
public layout(dimension: any): void {
......@@ -53,4 +53,4 @@ suite('Viewlets', () => {
assert(d === Platform.Registry.as<ViewletRegistry>(Extensions.Viewlets).getViewlet('reg-test-id'));
assert.equal(oldCount + 1, Platform.Registry.as<ViewletRegistry>(Extensions.Viewlets).getViewlets().length);
});
});
\ No newline at end of file
});
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册