always have a representedFilename
This commit is contained in:
parent
a7dee48b14
commit
14adf4bb46
3 changed files with 24 additions and 14 deletions
|
@ -155,6 +155,7 @@ export class VSCodeWindow {
|
|||
private currentMenuBarVisibility: MenuBarVisibility;
|
||||
private currentWindowMode: WindowMode;
|
||||
private toDispose: IDisposable[];
|
||||
private representedFilename: string;
|
||||
|
||||
private whenReadyCallbacks: TValueCallback<VSCodeWindow>[];
|
||||
|
||||
|
@ -311,6 +312,22 @@ export class VSCodeWindow {
|
|||
return this._win;
|
||||
}
|
||||
|
||||
public setRepresentedFilename(filename: string): void {
|
||||
if (platform.isMacintosh) {
|
||||
this.win.setRepresentedFilename(filename);
|
||||
} else {
|
||||
this.representedFilename = filename;
|
||||
}
|
||||
}
|
||||
|
||||
public getRepresentedFilename(): string {
|
||||
if (platform.isMacintosh) {
|
||||
return this.win.getRepresentedFilename();
|
||||
}
|
||||
|
||||
return this.representedFilename;
|
||||
}
|
||||
|
||||
public focus(): void {
|
||||
if (!this._win) {
|
||||
return;
|
||||
|
|
|
@ -16,7 +16,6 @@ import Event, { chain } from 'vs/base/common/event';
|
|||
import { fromEventEmitter } from 'vs/base/node/event';
|
||||
import { IURLService } from 'vs/platform/url/common/url';
|
||||
import { ITelemetryData } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { isMacintosh } from "vs/base/common/platform";
|
||||
import { OpenContext } from 'vs/code/common/windows'; // TODO@Joao: remove this dependency, move all implementation to this class
|
||||
import { IWindowsMainService } from 'vs/code/electron-main/windows';
|
||||
import { ILifecycleService } from "vs/code/electron-main/lifecycle";
|
||||
|
@ -124,7 +123,7 @@ export class WindowsService implements IWindowsService, IDisposable {
|
|||
const vscodeWindow = this.windowsMainService.getWindowById(windowId);
|
||||
|
||||
if (vscodeWindow) {
|
||||
vscodeWindow.win.setRepresentedFilename(fileName);
|
||||
vscodeWindow.setRepresentedFilename(fileName);
|
||||
}
|
||||
|
||||
return TPromise.as(null);
|
||||
|
@ -254,11 +253,7 @@ export class WindowsService implements IWindowsService, IDisposable {
|
|||
|
||||
getWindows(): TPromise<{ id: number; path: string; title: string; }[]> {
|
||||
const windows = this.windowsMainService.getWindows();
|
||||
const result = windows.map(w => {
|
||||
const filename = isMacintosh ? w.win.getRepresentedFilename() : void 0;
|
||||
|
||||
return { path: w.openedWorkspacePath, title: w.win.getTitle(), id: w.id, filename };
|
||||
});
|
||||
const result = windows.map(w => ({ path: w.openedWorkspacePath, title: w.win.getTitle(), id: w.id, filename: w.getRepresentedFilename() }));
|
||||
|
||||
return TPromise.as(result);
|
||||
}
|
||||
|
|
|
@ -98,14 +98,12 @@ export class ElectronWindow extends Themable {
|
|||
|
||||
private registerListeners(): void {
|
||||
|
||||
// React to editor input changes (Mac only)
|
||||
if (platform.platform === platform.Platform.Mac) {
|
||||
this.editorGroupService.onEditorsChanged(() => {
|
||||
const file = toResource(this.editorService.getActiveEditorInput(), { supportSideBySide: true, filter: 'file' });
|
||||
// React to editor input changes
|
||||
this.editorGroupService.onEditorsChanged(() => {
|
||||
const file = toResource(this.editorService.getActiveEditorInput(), { supportSideBySide: true, filter: 'file' });
|
||||
|
||||
this.titleService.setRepresentedFilename(file ? file.fsPath : '');
|
||||
});
|
||||
}
|
||||
this.titleService.setRepresentedFilename(file ? file.fsPath : '');
|
||||
});
|
||||
|
||||
let draggedExternalResources: URI[];
|
||||
let dropOverlay: Builder;
|
||||
|
|
Loading…
Reference in a new issue