提交 11c186f1 编写于 作者: B Benjamin Pasero

some cleanup and 💄

上级 a0656567
...@@ -385,12 +385,18 @@ export class CodeWindow implements ICodeWindow { ...@@ -385,12 +385,18 @@ export class CodeWindow implements ICodeWindow {
// Window (Un)Maximize // Window (Un)Maximize
this._win.on('maximize', (e) => { this._win.on('maximize', (e) => {
if (this.currentConfig) {
this.currentConfig.maximized = true; this.currentConfig.maximized = true;
}
app.emit('browser-window-maximize', e, this._win); app.emit('browser-window-maximize', e, this._win);
}); });
this._win.on('unmaximize', (e) => { this._win.on('unmaximize', (e) => {
if (this.currentConfig) {
this.currentConfig.maximized = false; this.currentConfig.maximized = false;
}
app.emit('browser-window-unmaximize', e, this._win); app.emit('browser-window-unmaximize', e, this._win);
}); });
...@@ -596,7 +602,6 @@ export class CodeWindow implements ICodeWindow { ...@@ -596,7 +602,6 @@ export class CodeWindow implements ICodeWindow {
// Set fullscreen state // Set fullscreen state
windowConfiguration.fullscreen = this._win.isFullScreen(); windowConfiguration.fullscreen = this._win.isFullScreen();
windowConfiguration.maximized = this._win.isMaximized();
// Set Accessibility Config // Set Accessibility Config
let autoDetectHighContrast = true; let autoDetectHighContrast = true;
...@@ -609,6 +614,9 @@ export class CodeWindow implements ICodeWindow { ...@@ -609,6 +614,9 @@ export class CodeWindow implements ICodeWindow {
// Theme // Theme
windowConfiguration.baseTheme = this.getBaseTheme(); windowConfiguration.baseTheme = this.getBaseTheme();
windowConfiguration.backgroundColor = this.getBackgroundColor(); windowConfiguration.backgroundColor = this.getBackgroundColor();
// Title style related
windowConfiguration.maximized = this._win.isMaximized();
windowConfiguration.frameless = this.hasHiddenTitleBarStyle() && !isMacintosh; windowConfiguration.frameless = this.hasHiddenTitleBarStyle() && !isMacintosh;
// Perf Counters // Perf Counters
......
...@@ -179,7 +179,6 @@ export class WindowsChannelClient implements IWindowsService { ...@@ -179,7 +179,6 @@ export class WindowsChannelClient implements IWindowsService {
private _onWindowUnmaximize: Event<number> = eventFromCall<number>(this.channel, 'event:onWindowUnmaximize'); private _onWindowUnmaximize: Event<number> = eventFromCall<number>(this.channel, 'event:onWindowUnmaximize');
get onWindowUnmaximize(): Event<number> { return this._onWindowUnmaximize; } get onWindowUnmaximize(): Event<number> { return this._onWindowUnmaximize; }
pickFileFolderAndOpen(options: INativeOpenDialogOptions): TPromise<void> { pickFileFolderAndOpen(options: INativeOpenDialogOptions): TPromise<void> {
return this.channel.call('pickFileFolderAndOpen', options); return this.channel.call('pickFileFolderAndOpen', options);
} }
......
...@@ -341,6 +341,7 @@ export class WindowsService implements IWindowsService, IURLHandler, IDisposable ...@@ -341,6 +341,7 @@ export class WindowsService implements IWindowsService, IURLHandler, IDisposable
} }
minimizeWindow(windowId: number): TPromise<void> { minimizeWindow(windowId: number): TPromise<void> {
this.logService.trace('windowsService#minimizeWindow', windowId);
const codeWindow = this.windowsMainService.getWindowById(windowId); const codeWindow = this.windowsMainService.getWindowById(windowId);
if (codeWindow) { if (codeWindow) {
......
...@@ -434,7 +434,7 @@ export class WorkbenchLayout extends Disposable implements IVerticalSashLayoutPr ...@@ -434,7 +434,7 @@ export class WorkbenchLayout extends Disposable implements IVerticalSashLayoutPr
this.statusbarHeight = isStatusbarHidden ? 0 : this.partLayoutInfo.statusbar.height; this.statusbarHeight = isStatusbarHidden ? 0 : this.partLayoutInfo.statusbar.height;
this.titlebarHeight = isTitlebarHidden ? 0 : this.partLayoutInfo.titlebar.height / getZoomFactor(); // adjust for zoom prevention this.titlebarHeight = isTitlebarHidden ? 0 : this.partLayoutInfo.titlebar.height / getZoomFactor(); // adjust for zoom prevention
this.menubarHeight = isMenubarHidden ? 0 : this.partLayoutInfo.menubar.height / getZoomFactor(); this.menubarHeight = isMenubarHidden ? 0 : this.partLayoutInfo.menubar.height / getZoomFactor(); // adjust for zoom prevention
this.headingHeight = Math.max(this.menubarHeight, this.titlebarHeight); this.headingHeight = Math.max(this.menubarHeight, this.titlebarHeight);
this.sidebarHeight = this.workbenchSize.height - this.statusbarHeight - this.headingHeight; this.sidebarHeight = this.workbenchSize.height - this.statusbarHeight - this.headingHeight;
......
...@@ -18,7 +18,7 @@ import { IContextKeyService, ContextKeyExpr } from 'vs/platform/contextkey/commo ...@@ -18,7 +18,7 @@ import { IContextKeyService, ContextKeyExpr } from 'vs/platform/contextkey/commo
import { ActionRunner, IActionRunner, IAction } from 'vs/base/common/actions'; import { ActionRunner, IActionRunner, IAction } from 'vs/base/common/actions';
import { Builder, $ } from 'vs/base/browser/builder'; import { Builder, $ } from 'vs/base/browser/builder';
import { Separator, ActionItem } from 'vs/base/browser/ui/actionbar/actionbar'; import { Separator, ActionItem } from 'vs/base/browser/ui/actionbar/actionbar';
import { EventType, Dimension } from 'vs/base/browser/dom'; import { EventType, Dimension, toggleClass } from 'vs/base/browser/dom';
import { TITLE_BAR_ACTIVE_BACKGROUND, TITLE_BAR_ACTIVE_FOREGROUND } from 'vs/workbench/common/theme'; import { TITLE_BAR_ACTIVE_BACKGROUND, TITLE_BAR_ACTIVE_FOREGROUND } from 'vs/workbench/common/theme';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { isWindows, isMacintosh } from 'vs/base/common/platform'; import { isWindows, isMacintosh } from 'vs/base/common/platform';
...@@ -630,7 +630,7 @@ export class MenubarPart extends Part { ...@@ -630,7 +630,7 @@ export class MenubarPart extends Part {
this.container.style('background-color', null); this.container.style('background-color', null);
} }
this.container.getHTMLElement().classList.toggle('light', Color.fromHex(bgColor).isLighter()); toggleClass(this.container.getHTMLElement(), 'light', Color.fromHex(bgColor).isLighter());
} }
} }
......
...@@ -29,9 +29,8 @@ ...@@ -29,9 +29,8 @@
zoom: 1; /* prevent zooming */ zoom: 1; /* prevent zooming */
} }
/***********************\ /* Windows/Linux: Rules for custom title (icon, window controls) */
| Windows and Linux CSS |
\***********************/
.monaco-workbench.windows > .part.titlebar, .monaco-workbench.windows > .part.titlebar,
.monaco-workbench.linux > .part.titlebar { .monaco-workbench.linux > .part.titlebar {
padding: 0; padding: 0;
......
...@@ -27,7 +27,7 @@ import { IEnvironmentService } from 'vs/platform/environment/common/environment' ...@@ -27,7 +27,7 @@ import { IEnvironmentService } from 'vs/platform/environment/common/environment'
import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace'; import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace';
import { IThemeService } from 'vs/platform/theme/common/themeService'; import { IThemeService } from 'vs/platform/theme/common/themeService';
import { TITLE_BAR_ACTIVE_BACKGROUND, TITLE_BAR_ACTIVE_FOREGROUND, TITLE_BAR_INACTIVE_FOREGROUND, TITLE_BAR_INACTIVE_BACKGROUND, TITLE_BAR_BORDER } from 'vs/workbench/common/theme'; import { TITLE_BAR_ACTIVE_BACKGROUND, TITLE_BAR_ACTIVE_FOREGROUND, TITLE_BAR_INACTIVE_FOREGROUND, TITLE_BAR_INACTIVE_BACKGROUND, TITLE_BAR_BORDER } from 'vs/workbench/common/theme';
import { isMacintosh, isWindows } from 'vs/base/common/platform'; import { isMacintosh, isWindows, isLinux } from 'vs/base/common/platform';
import URI from 'vs/base/common/uri'; import URI from 'vs/base/common/uri';
import { Color } from 'vs/base/common/color'; import { Color } from 'vs/base/common/color';
import { trim } from 'vs/base/common/strings'; import { trim } from 'vs/base/common/strings';
...@@ -48,6 +48,7 @@ export class TitlebarPart extends Part implements ITitleService { ...@@ -48,6 +48,7 @@ export class TitlebarPart extends Part implements ITitleService {
private title: Builder; private title: Builder;
private windowControls: Builder; private windowControls: Builder;
private appIcon: Builder; private appIcon: Builder;
private pendingTitle: string; private pendingTitle: string;
private representedFileName: string; private representedFileName: string;
private menubarWidth: number; private menubarWidth: number;
...@@ -58,7 +59,7 @@ export class TitlebarPart extends Part implements ITitleService { ...@@ -58,7 +59,7 @@ export class TitlebarPart extends Part implements ITitleService {
controlsWidth?: number; controlsWidth?: number;
appIconWidth?: number; appIconWidth?: number;
appIconLeftPadding?: number; appIconLeftPadding?: number;
} = {}; } = Object.create(null);
private isInactive: boolean; private isInactive: boolean;
...@@ -248,13 +249,14 @@ export class TitlebarPart extends Part implements ITitleService { ...@@ -248,13 +249,14 @@ export class TitlebarPart extends Part implements ITitleService {
public createContentArea(parent: HTMLElement): HTMLElement { public createContentArea(parent: HTMLElement): HTMLElement {
this.titleContainer = $(parent); this.titleContainer = $(parent);
// App Icon (Windows/Linux)
if (!isMacintosh) { if (!isMacintosh) {
// App Icon
this.appIcon = $(this.titleContainer).img({ this.appIcon = $(this.titleContainer).img({
class: 'window-appicon', class: 'window-appicon',
src: paths.join(this.environmentService.appRoot, isWindows ? 'resources/win32/code.ico' : 'resources/linux/code.png') src: paths.join(this.environmentService.appRoot, isWindows ? 'resources/win32/code.ico' : 'resources/linux/code.png')
}).on(EventType.DBLCLICK, (e) => { }).on(EventType.DBLCLICK, e => {
EventHelper.stop(e, true); EventHelper.stop(e, true);
this.windowService.closeWindow().then(null, errors.onUnexpectedError); this.windowService.closeWindow().then(null, errors.onUnexpectedError);
}); });
...@@ -284,29 +286,32 @@ export class TitlebarPart extends Part implements ITitleService { ...@@ -284,29 +286,32 @@ export class TitlebarPart extends Part implements ITitleService {
} }
}); });
// Window Controls (Windows/Linux)
if (!isMacintosh) { if (!isMacintosh) {
this.windowControls = $(this.titleContainer).div({ class: 'window-controls-container' }); this.windowControls = $(this.titleContainer).div({ class: 'window-controls-container' });
// Minimize
$(this.windowControls).div({ class: 'window-icon window-minimize' }).on(EventType.CLICK, () => { $(this.windowControls).div({ class: 'window-icon window-minimize' }).on(EventType.CLICK, () => {
this.windowService.minimizeWindow().then(null, errors.onUnexpectedError); this.windowService.minimizeWindow().then(null, errors.onUnexpectedError);
}); });
let maxRestore = $(this.windowControls).div({ class: 'window-icon window-max-restore' }); // Restore
maxRestore.on(EventType.CLICK, (e, builder) => { $(this.windowControls).div({ class: 'window-icon window-max-restore' }).on(EventType.CLICK, () => {
this.windowService.isMaximized().then((maximized) => { this.windowService.isMaximized().then((maximized) => {
if (maximized) { if (maximized) {
return this.windowService.unmaximizeWindow(); return this.windowService.unmaximizeWindow();
} else {
return this.windowService.maximizeWindow();
} }
return this.windowService.maximizeWindow();
}).then(null, errors.onUnexpectedError); }).then(null, errors.onUnexpectedError);
}); });
// Close
$(this.windowControls).div({ class: 'window-icon window-close' }).on(EventType.CLICK, () => { $(this.windowControls).div({ class: 'window-icon window-close' }).on(EventType.CLICK, () => {
this.windowService.closeWindow().then(null, errors.onUnexpectedError); this.windowService.closeWindow().then(null, errors.onUnexpectedError);
}); });
let isMaximized = this.windowService.getConfiguration().maximized ? true : false; const isMaximized = this.windowService.getConfiguration().maximized ? true : false;
this.onDidChangeMaximized(isMaximized); this.onDidChangeMaximized(isMaximized);
this.windowService.onDidChangeMaximize(this.onDidChangeMaximized, this); this.windowService.onDidChangeMaximize(this.onDidChangeMaximized, this);
} }
...@@ -326,17 +331,17 @@ export class TitlebarPart extends Part implements ITitleService { ...@@ -326,17 +331,17 @@ export class TitlebarPart extends Part implements ITitleService {
} }
private onDidChangeMaximized(maximized: boolean) { private onDidChangeMaximized(maximized: boolean) {
let element = $(this.titleContainer).getHTMLElement().querySelector('.window-max-restore'); const element = $(this.titleContainer).getHTMLElement().querySelector('.window-max-restore') as HTMLElement;
if (!element) { if (!element) {
return; return;
} }
if (maximized) { if (maximized) {
removeClass(<HTMLElement>element, 'window-maximize'); removeClass(element, 'window-maximize');
addClass(<HTMLElement>element, 'window-unmaximize'); addClass(element, 'window-unmaximize');
} else { } else {
removeClass(<HTMLElement>element, 'window-unmaximize'); removeClass(element, 'window-unmaximize');
addClass(<HTMLElement>element, 'window-maximize'); addClass(element, 'window-maximize');
} }
} }
...@@ -345,15 +350,17 @@ export class TitlebarPart extends Part implements ITitleService { ...@@ -345,15 +350,17 @@ export class TitlebarPart extends Part implements ITitleService {
// Part container // Part container
if (this.titleContainer) { if (this.titleContainer) {
const bgColor = this.getColor(this.isInactive ? TITLE_BAR_INACTIVE_BACKGROUND : TITLE_BAR_ACTIVE_BACKGROUND); const titleBackground = this.getColor(this.isInactive ? TITLE_BAR_INACTIVE_BACKGROUND : TITLE_BAR_ACTIVE_BACKGROUND);
this.titleContainer.style('color', this.getColor(this.isInactive ? TITLE_BAR_INACTIVE_FOREGROUND : TITLE_BAR_ACTIVE_FOREGROUND)); this.titleContainer.style('background-color', titleBackground);
this.titleContainer.style('background-color', bgColor); if (Color.fromHex(titleBackground).isLighter()) {
if (Color.fromHex(bgColor).isLighter()) {
this.titleContainer.addClass('light'); this.titleContainer.addClass('light');
} else { } else {
this.titleContainer.removeClass('light'); this.titleContainer.removeClass('light');
} }
const titleForeground = this.getColor(this.isInactive ? TITLE_BAR_INACTIVE_FOREGROUND : TITLE_BAR_ACTIVE_FOREGROUND);
this.titleContainer.style('color', titleForeground);
const titleBorder = this.getColor(TITLE_BAR_BORDER); const titleBorder = this.getColor(TITLE_BAR_BORDER);
this.titleContainer.style('border-bottom', titleBorder ? `1px solid ${titleBorder}` : null); this.titleContainer.style('border-bottom', titleBorder ? `1px solid ${titleBorder}` : null);
} }
...@@ -423,6 +430,7 @@ export class TitlebarPart extends Part implements ITitleService { ...@@ -423,6 +430,7 @@ export class TitlebarPart extends Part implements ITitleService {
} }
private updateLayout() { private updateLayout() {
// To prevent zooming we need to adjust the font size with the zoom factor // To prevent zooming we need to adjust the font size with the zoom factor
if (typeof this.initialSizing.titleFontSize !== 'number') { if (typeof this.initialSizing.titleFontSize !== 'number') {
this.initialSizing.titleFontSize = parseInt(this.titleContainer.getComputedStyle().fontSize, 10); this.initialSizing.titleFontSize = parseInt(this.titleContainer.getComputedStyle().fontSize, 10);
...@@ -439,7 +447,8 @@ export class TitlebarPart extends Part implements ITitleService { ...@@ -439,7 +447,8 @@ export class TitlebarPart extends Part implements ITitleService {
'line-height': `${newHeight}px` 'line-height': `${newHeight}px`
}); });
if (!isMacintosh) { // Windows/Linux specific layout
if (isWindows || isLinux) {
if (typeof this.initialSizing.controlsWidth !== 'number') { if (typeof this.initialSizing.controlsWidth !== 'number') {
this.initialSizing.controlsWidth = parseInt(this.windowControls.getComputedStyle().width, 10); this.initialSizing.controlsWidth = parseInt(this.windowControls.getComputedStyle().width, 10);
} }
...@@ -472,8 +481,6 @@ export class TitlebarPart extends Part implements ITitleService { ...@@ -472,8 +481,6 @@ export class TitlebarPart extends Part implements ITitleService {
bufferWidth = 0; bufferWidth = 0;
} }
// Adjust app icon mimic menubar // Adjust app icon mimic menubar
this.appIcon.style({ this.appIcon.style({
width: `${newAppIconWidth}px`, width: `${newAppIconWidth}px`,
......
...@@ -65,6 +65,15 @@ ...@@ -65,6 +65,15 @@
cursor: pointer; cursor: pointer;
} }
.monaco-shell .monaco-menu .monaco-action-bar.vertical {
padding: .5em 0;
}
.monaco-shell .monaco-menu .monaco-action-bar.vertical .action-label,
.monaco-shell .monaco-menu .monaco-action-bar.vertical .keybinding {
padding: 0.5em 2em;
}
/* START Keyboard Focus Indication Styles */ /* START Keyboard Focus Indication Styles */
.monaco-shell [tabindex="0"]:focus, .monaco-shell [tabindex="0"]:focus,
...@@ -132,12 +141,3 @@ ...@@ -132,12 +141,3 @@
.monaco-shell .monaco-list:focus { .monaco-shell .monaco-list:focus {
outline: 0 !important; /* tree indicates focus not via outline but through the focused item */ outline: 0 !important; /* tree indicates focus not via outline but through the focused item */
} }
\ No newline at end of file
.monaco-shell .monaco-menu .monaco-action-bar.vertical .action-label,
.monaco-shell .monaco-menu .monaco-action-bar.vertical .keybinding {
padding: 0.5em 2em;
}
.monaco-shell .monaco-menu .monaco-action-bar.vertical {
padding: .5em 0;
}
\ No newline at end of file
...@@ -356,11 +356,8 @@ export class Workbench extends Disposable implements IPartService { ...@@ -356,11 +356,8 @@ export class Workbench extends Disposable implements IPartService {
// List // List
serviceCollection.set(IListService, this.instantiationService.createInstance(ListService)); serviceCollection.set(IListService, this.instantiationService.createInstance(ListService));
// Context Menu
const hasCustomTitle = this.getCustomTitleBarStyle() === 'custom';
// Use themable context menus when custom titlebar is enabled to match custom menubar // Use themable context menus when custom titlebar is enabled to match custom menubar
if (!isMacintosh && hasCustomTitle) { if (!isMacintosh && this.getCustomTitleBarStyle() === 'custom') {
serviceCollection.set(IContextMenuService, new SyncDescriptor(HTMLContextMenuService, null, this.telemetryService, this.notificationService, this.contextViewService)); serviceCollection.set(IContextMenuService, new SyncDescriptor(HTMLContextMenuService, null, this.telemetryService, this.notificationService, this.contextViewService));
} else { } else {
serviceCollection.set(IContextMenuService, new SyncDescriptor(NativeContextMenuService)); serviceCollection.set(IContextMenuService, new SyncDescriptor(NativeContextMenuService));
...@@ -411,6 +408,7 @@ export class Workbench extends Disposable implements IPartService { ...@@ -411,6 +408,7 @@ export class Workbench extends Disposable implements IPartService {
this.titlebarPart = this.instantiationService.createInstance(TitlebarPart, Identifiers.TITLEBAR_PART); this.titlebarPart = this.instantiationService.createInstance(TitlebarPart, Identifiers.TITLEBAR_PART);
this._register(toDisposable(() => this.titlebarPart.shutdown())); this._register(toDisposable(() => this.titlebarPart.shutdown()));
serviceCollection.set(ITitleService, this.titlebarPart); serviceCollection.set(ITitleService, this.titlebarPart);
// History // History
serviceCollection.set(IHistoryService, new SyncDescriptor(HistoryService)); serviceCollection.set(IHistoryService, new SyncDescriptor(HistoryService));
...@@ -1017,9 +1015,10 @@ export class Workbench extends Disposable implements IPartService { ...@@ -1017,9 +1015,10 @@ export class Workbench extends Disposable implements IPartService {
}); });
this.menubarPart.create(menubarContainer.getHTMLElement()); this.menubarPart.create(menubarContainer.getHTMLElement());
this.menubarPart.onVisibilityChange((dimension => {
this._register(this.menubarPart.onVisibilityChange((dimension => {
this._onMenubarVisibilityChange.fire(dimension); this._onMenubarVisibilityChange.fire(dimension);
})); })));
} }
private createActivityBarPart(): void { private createActivityBarPart(): void {
...@@ -1133,10 +1132,10 @@ export class Workbench extends Disposable implements IPartService { ...@@ -1133,10 +1132,10 @@ export class Workbench extends Disposable implements IPartService {
//#region IPartService //#region IPartService
private _onTitleBarVisibilityChange: Emitter<void> = new Emitter<void>(); private _onTitleBarVisibilityChange: Emitter<void> = this._register(new Emitter<void>());
get onTitleBarVisibilityChange(): Event<void> { return this._onTitleBarVisibilityChange.event; } get onTitleBarVisibilityChange(): Event<void> { return this._onTitleBarVisibilityChange.event; }
private _onMenubarVisibilityChange: Emitter<DOM.Dimension> = new Emitter<DOM.Dimension>(); private _onMenubarVisibilityChange: Emitter<DOM.Dimension> = this._register(new Emitter<DOM.Dimension>());
get onMenubarVisibilityChange(): Event<DOM.Dimension> { return this._onMenubarVisibilityChange.event; } get onMenubarVisibilityChange(): Event<DOM.Dimension> { return this._onMenubarVisibilityChange.event; }
get onEditorLayout(): Event<IDimension> { return this.editorPart.onDidLayout; } get onEditorLayout(): Event<IDimension> { return this.editorPart.onDidLayout; }
...@@ -1187,9 +1186,9 @@ export class Workbench extends Disposable implements IPartService { ...@@ -1187,9 +1186,9 @@ export class Workbench extends Disposable implements IPartService {
isVisible(part: Parts): boolean { isVisible(part: Parts): boolean {
switch (part) { switch (part) {
case Parts.TITLEBAR_PART: case Parts.TITLEBAR_PART:
return this.getCustomTitleBarStyle() && !browser.isFullscreen(); return this.getCustomTitleBarStyle() === 'custom' && !browser.isFullscreen();
case Parts.MENUBAR_PART: case Parts.MENUBAR_PART:
return this.getCustomTitleBarStyle() && !this.menubarHidden; return this.getCustomTitleBarStyle() === 'custom' && !this.menubarHidden;
case Parts.SIDEBAR_PART: case Parts.SIDEBAR_PART:
return !this.sideBarHidden; return !this.sideBarHidden;
case Parts.PANEL_PART: case Parts.PANEL_PART:
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
import * as nls from 'vs/nls'; import * as nls from 'vs/nls';
import { Registry } from 'vs/platform/registry/common/platform'; import { Registry } from 'vs/platform/registry/common/platform';
import { GlobalNewUntitledFileAction, ShowOpenedFileInNewWindow, CopyPathAction, FocusOpenEditorsView, FocusFilesExplorer, GlobalCompareResourcesAction, SaveAllAction, ShowActiveFileInExplorer, CollapseExplorerView, RefreshExplorerView, CompareWithClipboardAction, NEW_FILE_COMMAND_ID, NEW_FILE_LABEL, NEW_FOLDER_COMMAND_ID, NEW_FOLDER_LABEL, TRIGGER_RENAME_LABEL, MOVE_FILE_TO_TRASH_LABEL, COPY_FILE_LABEL, PASTE_FILE_LABEL, FileCopiedContext, renameHandler, moveFileToTrashHandler, copyFileHandler, pasteFileHandler, deleteFileHandler } from 'vs/workbench/parts/files/electron-browser/fileActions'; import { ToggleAutoSaveAction, GlobalNewUntitledFileAction, ShowOpenedFileInNewWindow, CopyPathAction, FocusOpenEditorsView, FocusFilesExplorer, GlobalCompareResourcesAction, SaveAllAction, ShowActiveFileInExplorer, CollapseExplorerView, RefreshExplorerView, CompareWithClipboardAction, NEW_FILE_COMMAND_ID, NEW_FILE_LABEL, NEW_FOLDER_COMMAND_ID, NEW_FOLDER_LABEL, TRIGGER_RENAME_LABEL, MOVE_FILE_TO_TRASH_LABEL, COPY_FILE_LABEL, PASTE_FILE_LABEL, FileCopiedContext, renameHandler, moveFileToTrashHandler, copyFileHandler, pasteFileHandler, deleteFileHandler } from 'vs/workbench/parts/files/electron-browser/fileActions';
import { revertLocalChangesCommand, acceptLocalChangesCommand, CONFLICT_RESOLUTION_CONTEXT } from 'vs/workbench/parts/files/electron-browser/saveErrorHandler'; import { revertLocalChangesCommand, acceptLocalChangesCommand, CONFLICT_RESOLUTION_CONTEXT } from 'vs/workbench/parts/files/electron-browser/saveErrorHandler';
import { SyncActionDescriptor, MenuId, MenuRegistry } from 'vs/platform/actions/common/actions'; import { SyncActionDescriptor, MenuId, MenuRegistry } from 'vs/platform/actions/common/actions';
import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/workbench/common/actions'; import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/workbench/common/actions';
...@@ -40,6 +40,7 @@ registry.registerWorkbenchAction(new SyncActionDescriptor(RefreshExplorerView, R ...@@ -40,6 +40,7 @@ registry.registerWorkbenchAction(new SyncActionDescriptor(RefreshExplorerView, R
registry.registerWorkbenchAction(new SyncActionDescriptor(GlobalNewUntitledFileAction, GlobalNewUntitledFileAction.ID, GlobalNewUntitledFileAction.LABEL, { primary: KeyMod.CtrlCmd | KeyCode.KEY_N }), 'File: New Untitled File', category); registry.registerWorkbenchAction(new SyncActionDescriptor(GlobalNewUntitledFileAction, GlobalNewUntitledFileAction.ID, GlobalNewUntitledFileAction.LABEL, { primary: KeyMod.CtrlCmd | KeyCode.KEY_N }), 'File: New Untitled File', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(ShowOpenedFileInNewWindow, ShowOpenedFileInNewWindow.ID, ShowOpenedFileInNewWindow.LABEL, { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyCode.KEY_O) }), 'File: Open Active File in New Window', category); registry.registerWorkbenchAction(new SyncActionDescriptor(ShowOpenedFileInNewWindow, ShowOpenedFileInNewWindow.ID, ShowOpenedFileInNewWindow.LABEL, { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyCode.KEY_O) }), 'File: Open Active File in New Window', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(CompareWithClipboardAction, CompareWithClipboardAction.ID, CompareWithClipboardAction.LABEL, { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyCode.KEY_C) }), 'File: Compare Active File with Clipboard', category); registry.registerWorkbenchAction(new SyncActionDescriptor(CompareWithClipboardAction, CompareWithClipboardAction.ID, CompareWithClipboardAction.LABEL, { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyCode.KEY_C) }), 'File: Compare Active File with Clipboard', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(ToggleAutoSaveAction, ToggleAutoSaveAction.ID, ToggleAutoSaveAction.LABEL), 'File: Toggle Auto Save', category);
// Commands // Commands
CommandsRegistry.registerCommand('_files.windowOpen', openWindowCommand); CommandsRegistry.registerCommand('_files.windowOpen', openWindowCommand);
......
...@@ -34,7 +34,6 @@ import { DataUriEditorInput } from 'vs/workbench/common/editor/dataUriEditorInpu ...@@ -34,7 +34,6 @@ import { DataUriEditorInput } from 'vs/workbench/common/editor/dataUriEditorInpu
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IEditorGroupsService } from 'vs/workbench/services/group/common/editorGroupsService'; import { IEditorGroupsService } from 'vs/workbench/services/group/common/editorGroupsService';
import { ToggleAutoSaveAction } from 'vs/workbench/parts/files/electron-browser/fileActions';
// Viewlet Action // Viewlet Action
export class OpenExplorerViewletAction extends ToggleViewletAction { export class OpenExplorerViewletAction extends ToggleViewletAction {
...@@ -74,9 +73,6 @@ registry.registerWorkbenchAction( ...@@ -74,9 +73,6 @@ registry.registerWorkbenchAction(
nls.localize('view', "View") nls.localize('view', "View")
); );
// Register Action to Toggle Auto Save
registry.registerWorkbenchAction(new SyncActionDescriptor(ToggleAutoSaveAction, ToggleAutoSaveAction.ID, ToggleAutoSaveAction.LABEL), 'Toggle Auto Save', nls.localize('file', "File"));
// Register file editors // Register file editors
Registry.as<IEditorRegistry>(EditorExtensions.Editors).registerEditor( Registry.as<IEditorRegistry>(EditorExtensions.Editors).registerEditor(
new EditorDescriptor( new EditorDescriptor(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册