提交 116c61e3 编写于 作者: B Benjamin Pasero

Merge pull request #1767 from Microsoft/ben/electron

Update to Electron 0.35.5
......@@ -57,7 +57,7 @@
},
{
"name": "electron",
"version": "0.34.5",
"version": "0.35.5",
"license": "MIT",
"repositoryURL": "https://github.com/atom/electron",
"isProd": true
......
environment:
ATOM_SHELL_INTERNAL_RUN_AS_NODE: 1
ELECTRON_RUN_AS_NODE: 1
install:
- ps: Install-Product node 4.1.1 x64
......
......@@ -63,6 +63,7 @@ var copyrightFilterList = [
'!**/*.md',
'!**/*.bat',
'!**/*.cmd',
'!resources/win32/bin/code.js',
'!**/*.sh',
'!**/*.txt',
'!src/vs/editor/standalone-languages/swift.ts',
......
......@@ -29,13 +29,11 @@ var build = path.join(root, '.build');
var commit = util.getVersion(root);
var baseModules = [
'app', 'applicationinsights', 'assert', 'auto-updater', 'browser-window',
'child_process', 'chokidar', 'crash-reporter', 'crypto', 'dialog', 'emmet',
'applicationinsights', 'assert', 'child_process', 'chokidar', 'crypto', 'emmet',
'events', 'fs', 'getmac', 'glob', 'graceful-fs', 'http', 'http-proxy-agent',
'https', 'https-proxy-agent', 'iconv-lite', 'ipc', 'menu', 'menu-item', 'net',
'original-fs', 'os', 'path', 'readline', 'remote', 'sax', 'screen', 'semver',
'shell', 'stream', 'string_decoder', 'url', 'vscode-textmate', 'web-frame', 'winreg',
'yauzl', 'native-keymap'
'https', 'https-proxy-agent', 'iconv-lite', 'electron', 'net',
'os', 'path', 'readline', 'sax', 'semver', 'stream', 'string_decoder', 'url',
'vscode-textmate', 'winreg', 'yauzl', 'native-keymap'
];
// Build
......
......@@ -47,7 +47,7 @@ function generatePatchedEnv(env:any, stdInPipeName:string, stdOutPipeName:string
newEnv['STDIN_PIPE_NAME'] = stdInPipeName;
newEnv['STDOUT_PIPE_NAME'] = stdOutPipeName;
newEnv['ATOM_SHELL_INTERNAL_RUN_AS_NODE'] = '1';
newEnv['ELECTRON_RUN_AS_NODE'] = '1';
return newEnv;
}
......
......@@ -31,7 +31,7 @@ var stdOutPipeName = process.env['STDOUT_PIPE_NAME'];
log('STDIN_PIPE_NAME: ' + stdInPipeName);
log('STDOUT_PIPE_NAME: ' + stdOutPipeName);
log('ATOM_SHELL_INTERNAL_RUN_AS_NODE: ' + process.env['ATOM_SHELL_INTERNAL_RUN_AS_NODE']);
log('ELECTRON_RUN_AS_NODE: ' + process.env['ELECTRON_RUN_AS_NODE']);
// stdout redirection to named pipe
(function() {
......@@ -136,7 +136,7 @@ log('ATOM_SHELL_INTERNAL_RUN_AS_NODE: ' + process.env['ATOM_SHELL_INTERNAL_RUN_A
// Unset the custom environmental variables that should not get inherited
delete process.env['STDIN_PIPE_NAME'];
delete process.env['STDOUT_PIPE_NAME'];
delete process.env['ATOM_SHELL_INTERNAL_RUN_AS_NODE'];
delete process.env['ELECTRON_RUN_AS_NODE'];
require(program);
......
{
"name": "Code",
"version": "0.10.6",
"electronVersion": "0.34.5",
"electronVersion": "0.35.5",
"author": {
"name": "Microsoft Corporation"
},
......
@echo off
setlocal
set VSCODE_DEV=
set ATOM_SHELL_INTERNAL_RUN_AS_NODE=1
set ELECTRON_RUN_AS_NODE=1
"%~dp0..\\Code.exe" "%~dp0code.js" %*
endlocal
\ No newline at end of file
delete process.env['ATOM_SHELL_INTERNAL_RUN_AS_NODE'];
delete process.env['ELECTRON_RUN_AS_NODE'];
require('child_process').spawn(require('path').resolve(__dirname, '..', 'Code.exe'), process.argv.slice(2), { detached: true, stdio: 'ignore' });
process.exit(0);
\ No newline at end of file
@echo off
set ATOM_SHELL_INTERNAL_RUN_AS_NODE=1
set ELECTRON_RUN_AS_NODE=1
pushd %~dp0\..
.\.build\electron\Code.exe .\node_modules\mocha\bin\_mocha %*
......
......@@ -9,11 +9,11 @@ fi
# Unit Tests
if [[ "$OSTYPE" == "darwin"* ]]; then
cd $ROOT ; ulimit -n 4096 ; ATOM_SHELL_INTERNAL_RUN_AS_NODE=1 \
cd $ROOT ; ulimit -n 4096 ; ELECTRON_RUN_AS_NODE=1 \
./.build/electron/Electron.app/Contents/MacOS/Electron \
node_modules/mocha/bin/_mocha $*
else
cd $ROOT ; ATOM_SHELL_INTERNAL_RUN_AS_NODE=1 \
cd $ROOT ; ELECTRON_RUN_AS_NODE=1 \
./.build/electron/electron \
node_modules/mocha/bin/_mocha $*
fi
......
......@@ -3,6 +3,11 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// disable electron's asar support early on because bootstrap.js is used in forked processes
// where the environment is purely node based. this will instruct electron to not treat files
// with *.asar ending any special from normal files.
process.noAsar = true;
// Will be defined if we got forked from another node process
// In that case we override console.log/warn/error to be able
// to send loading issues to the main side for logging.
......
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/// <reference path="./node.d.ts" />
declare module 'ipc' {
export interface IIPCEvent {
sender: BrowserWindow;
}
export function on(what: string, callback: (event: IIPCEvent, something: any) => void): void;
export function removeAllListeners(what: string): void;
export function send(channel: string, data: any): void;
}
declare module 'app' {
interface IApp extends IEventEmitter {
quit(): void;
getVersion(): string;
getPath(name:string): string;
getName(): string;
addRecentDocument(path:string): void;
clearRecentDocuments(): void;
getPath(name: string): string;
setPath(name: string, path: string): void;
setUserTasks(tasks:ITask[]): void;
setAppUserModelId(id:string): void;
dock: IDock;
}
var app:IApp;
export = app;
}
declare module 'ipc' {
export function on(what: string, callback: Function): void;
export function once(what: string, callback: Function): void;
export function removeAllListeners(what: string): void;
}
declare module 'shell' {
interface IShell {
showItemInFolder(path: string): void;
openItem(path: string): void;
openExternal(url: string): boolean;
moveItemToTrash(path: string): boolean;
beep(): void;
}
var shell:IShell;
export = shell;
}
declare module 'screen' {
var screen:IScreen;
export = screen;
}
declare module 'browser-window' {
var IBrowserWindow:{
new (options: IBrowserWindowOptions): BrowserWindow;
getFocusedWindow(): BrowserWindow;
getAllWindows(): BrowserWindow[];
fromId(id: number): BrowserWindow;
};
export = IBrowserWindow;
}
declare module 'dialog' {
interface IOpenDialogOptions {
title?: string;
defaultPath?: string;
filters?: string[];
properties?: string[];
}
interface ISaveDialogOptions {
}
interface IMessageBoxOptions {
/**
* Can be "none", "info" or "warning"
*/
type?: string;
/**
* Array of texts for buttons
*/
buttons?: string[];
title?: string;
message?: string;
detail?: string;
cancelId?: number;
noLink?: boolean;
}
interface IDialog {
showOpenDialog(options: IOpenDialogOptions, callback?:(paths:string[]) => void): string[];
showOpenDialog(win: BrowserWindow, options: IOpenDialogOptions, callback?:(paths:string[]) => void): string[];
showSaveDialog(options: ISaveDialogOptions, callback?:(path:string) => void): string;
showSaveDialog(win: BrowserWindow, options: ISaveDialogOptions, callback?:(path:string) => void): string;
showMessageBox(options: IMessageBoxOptions, callback?:(index:number) => void): number;
showMessageBox(win: BrowserWindow, options: IMessageBoxOptions, callback?:(index:number) => void): number;
}
var dialog:IDialog;
export = dialog;
}
declare module 'menu' {
interface IMenu {
new (): Menu;
setApplicationMenu(menu: Menu): void;
buildFromTemplate(template: string): void;
}
var menu:IMenu;
export = menu;
}
declare module 'menu-item' {
interface IMenuItem {
new (options: IMenuItemConfig): MenuItem;
}
var menuItem:IMenuItem;
export = menuItem;
}
interface IEventEmitter {
addListener(event: string, listener: Function): EventEmitter;
on(event: string, listener: Function): EventEmitter;
once(event: string, listener: Function): EventEmitter;
removeListener(event: string, listener: Function): EventEmitter;
removeAllListeners(event?: string): EventEmitter;
setMaxListeners(n: number): void;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
}
declare class EventEmitter implements IEventEmitter {
addListener(event: string, listener: Function): EventEmitter;
on(event: string, listener: Function): EventEmitter;
once(event: string, listener: Function): EventEmitter;
removeListener(event: string, listener: Function): EventEmitter;
removeAllListeners(event?: string): EventEmitter;
setMaxListeners(n: number): void;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
}
declare class WebContents extends EventEmitter {
send(channel: string, ...args: any[]): void;
executeJavaScript(code: string): void;
selectAll(): void;
undo(): void;
redo(): void;
}
declare class BrowserWindow extends EventEmitter {
id: number;
webContents: WebContents;
show(): void;
hide(): void;
focus(): void;
loadUrl(url: string): void;
getUrl(): string;
close(): void;
destroy(): void;
setFullScreen(fullscreen: boolean): void;
isFullScreen(): boolean;
isMaximized(): boolean;
minimize(): void;
isFocused(): boolean;
isMinimized(): boolean;
isVisible(): boolean;
restore(): boolean;
getSize(): number[];
setSize(width: number, height: number): void;
getPosition(): number[];
setPosition(x: number, y: number): void;
setMenuBarVisibility(visible: boolean): void;
setAutoHideMenuBar(autoHide: boolean): void;
maximize(): void;
setRepresentedFilename(path: string): void;
setTitle(title: string): void;
getTitle():string;
toggleDevTools(): void;
openDevTools(): void;
closeDevTools(): void;
isDevToolsFocused(): boolean;
devToolsWebContents: WebContents;
send(channel: string, msg: any): void;
}
interface IMenuItemConfig {
label?: string;
role?: string;
click?: () => void;
type?: string;
selector?: string;
accelerator?: string;
enabled?: boolean;
visible?: boolean;
checked?: boolean;
submenu?: Menu;
}
declare class MenuItem implements IMenuItemConfig {
label: string;
click: () => void;
type: string;
selector: string;
accelerator: string;
enabled: boolean;
visible: boolean;
checked: boolean;
submenu: Menu;
}
declare class Menu {
items: MenuItem[];
append(menuItem: MenuItem): void;
insert(pos: number, menuItem: MenuItem): void;
popup(win: BrowserWindow, x?: number, y?: number): void;
}
interface IScreen extends IEventEmitter {
getCursorScreenPoint():IPoint;
getPrimaryDisplay():IDisplay;
getAllDisplays():IDisplay[];
getDisplayNearestPoint(point:IPoint):IDisplay;
getDisplayMatching(rect:IBounds):IDisplay;
}
interface IDisplay {
id:number;
bounds:IBounds;
workArea:IBounds;
size:IDimension;
workAreaSize:IDimension;
scaleFactor:number;
rotation:number;
touchSupport:string;
}
interface IBounds {
x:number;
y:number;
width:number;
height:number;
}
interface IDimension {
width:number;
height:number;
}
interface IPoint {
x:number;
y:number;
}
interface IBrowserWindowOptions {
x?: number;
y?: number;
width?: number;
height?: number;
show?: boolean;
frame?: boolean;
kiosk?: boolean;
'web-preferences'?: IWebPreferences;
icon?: string;
'min-width'?: number;
'min-height'?: number;
'always-on-top'?: boolean;
'skip-taskbar'?: boolean;
'background-color'?: string;
resizable?: boolean;
title?: string;
}
interface IWebPreferences {
javascript?: boolean;
'web-security'?: boolean;
images?: boolean;
java?: boolean;
'text-areas-are-resizable'?: boolean;
webgl?: boolean;
webaudio?: boolean;
plugins?: boolean;
'extra-plugin-dirs'?: string[];
'experimental-features'?: boolean;
'experimental-canvas-features'?: boolean;
'subpixel-font-scaling'?: boolean;
'overlay-scrollbars'?: boolean;
'overlay-fullscreen-video'?: boolean;
'shared-worker'?: boolean;
'direct-write'?: boolean;
}
interface ITask {
program: string;
arguments?: string;
title: string;
description?: string;
iconPath?: string;
iconIndex?: number;
}
interface IDock {
setMenu(menu:Menu): void;
show(): void;
hide(): void;
}
// https://github.com/atom/electron/blob/master/docs/api/auto-updater.md
declare module 'auto-updater' {
export interface IAutoUpdater extends IEventEmitter {
setFeedUrl(url: string): void;
checkForUpdates(): void;
}
export interface IUpdate {
url: string;
name: string;
releaseNotes?: string;
version?: string;
}
export function setFeedUrl(url: string): void;
export function checkForUpdates(): void;
export function addListener(event: string, listener: Function): EventEmitter;
export function on(event: string, listener: Function): EventEmitter;
export function once(event: string, listener: Function): EventEmitter;
export function removeListener(event: string, listener: Function): EventEmitter;
export function removeAllListeners(event?: string): EventEmitter;
export function setMaxListeners(n: number): void;
export function listeners(event: string): Function[];
export function emit(event: string, ...args: any[]): boolean;
}
declare module 'crash-reporter' {
export function start(config?: ICrashReporterConfigBrowser): void;
}
interface ICrashReporterConfigBrowser {
productName?: string,
companyName: string,
submitUrl?: string,
autoSubmit?: boolean,
ignoreSystemCrashHandler?: boolean,
extra?: any
}
\ No newline at end of file
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/// <reference path="./node.d.ts" />
declare module 'web-frame' {
export function getZoomLevel(): number;
export function setZoomLevel(zoomLevel: number): void;
}
declare module 'clipboard' {
export function readText(type?:string): string;
export function writeText(text:string, type?:string): void;
export function clear(type?:string): void;
}
declare module 'ipc' {
export function on(what: string, callback: Function): void;
export function once(what: string, callback: Function): void;
export function removeListener(what: string, callback: (something: any) => void): void;
export function removeAllListeners(what: string): void;
export function send(channel: string, ...args:any[]): void;
export function sendSync(channel: string, ...args:any[]): void;
}
declare module 'remote' {
interface IProcess extends IEventEmitter {
argv:string[];
platform:string;
execPath:string;
}
export var process:IProcess;
export interface IEventEmitter {
addListener(event: string, listener: Function): EventEmitter;
on(event: string, listener: Function): EventEmitter;
once(event: string, listener: Function): EventEmitter;
removeListener(event: string, listener: Function): EventEmitter;
removeAllListeners(event?: string): EventEmitter;
setMaxListeners(n: number): void;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
}
export class EventEmitter implements IEventEmitter {
addListener(event: string, listener: Function): EventEmitter;
on(event: string, listener: Function): EventEmitter;
once(event: string, listener: Function): EventEmitter;
removeListener(event: string, listener: Function): EventEmitter;
removeAllListeners(event?: string): EventEmitter;
setMaxListeners(n: number): void;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
}
export interface HTMLIWebView extends HTMLObjectElement {
/**
* Sets or retrieves a URL to be loaded by the object.
*/
src: string;
send(channel: string, ...args: any[]): void;
executeJavaScript(code: string): void;
stop(): void;
openDevTools(): void;
closeDevTools(): void;
isDevToolsOpened(): boolean;
}
export class Event {
returnValue: any;
sender: WebContents;
}
export interface IIPC extends IEventEmitter {
}
// https://github.com/atom/electron/blob/master/docs/api/app.md
export interface IApp extends IEventEmitter {
quit(): void;
getVersion(): string;
getPath(name:string): string;
getName(): string;
addRecentDocument(path:string): void;
clearRecentDocuments(): void;
}
export interface IOpenDialogOptions {
title?: string;
defaultPath?: string;
filters?: { name:string; extensions:string[] }[];
properties?: string[];
}
export interface ISaveDialogOptions extends IOpenDialogOptions {
}
export interface IMessageBoxOptions {
/**
* Can be "none", "info" or "warning"
*/
type?: string;
/**
* Array of texts for buttons
*/
buttons?: string[];
title?: string;
message?: string;
detail?: string;
cancelId?: number;
noLink?: boolean;
}
// https://github.com/atom/electron/blob/master/docs/api/dialog.md
export interface IDialog {
showOpenDialog(options: IOpenDialogOptions, callback?:(paths:string[]) => void): string[];
showOpenDialog(win: BrowserWindow, options: IOpenDialogOptions, callback?:(paths:string[]) => void): string[];
showSaveDialog(options: ISaveDialogOptions, callback?:(path:string) => void): string;
showSaveDialog(win: BrowserWindow, options: ISaveDialogOptions, callback?:(path:string) => void): string;
showMessageBox(options: ISaveDialogOptions, callback?:(index:number) => void): number;
showMessageBox(win: BrowserWindow, options: IMessageBoxOptions, callback?:(index:number) => void): number;
}
// https://github.com/atom/electron/blob/master/docs/api/shell.md
export interface IShell {
showItemInFolder(path: string): void;
openItem(path: string): void;
openExternal(url: string): boolean;
moveItemToTrash(path: string): boolean;
beep(): void;
}
export interface IWebContents {
new (): WebContents;
}
export class WebContents extends EventEmitter {
selectAll(): void;
undo(): void;
redo(): void;
send(channel: string, ...args: any[]): void;
}
export interface IBrowserWindow {
new (options: IBrowserWindowOptions): BrowserWindow;
getFocusedWindow(): BrowserWindow;
}
export interface IBrowserWindowOptions {
x?: number;
y?: number;
width?: number;
height?: number;
show?: boolean;
frame?: boolean;
kiosk?: boolean;
'web-preferences'?: IWebPreferences;
'min-width'?: number;
'min-height'?: number;
'always-on-top'?: boolean;
'skip-taskbar'?: boolean;
'background-color'?: string;
resizable?: boolean;
title?: string;
}
export interface IWebPreferences {
javascript?: boolean;
'web-security'?: boolean;
images?: boolean;
java?: boolean;
'text-areas-are-resizable'?: boolean;
webgl?: boolean;
webaudio?: boolean;
plugins?: boolean;
'extra-plugin-dirs'?: string[];
'experimental-features'?: boolean;
'experimental-canvas-features'?: boolean;
'subpixel-font-scaling'?: boolean;
'overlay-scrollbars'?: boolean;
'overlay-fullscreen-video'?: boolean;
'shared-worker'?: boolean;
'direct-write'?: boolean;
}
// https://github.com/atom/electron/blob/master/docs/api/browser-window.md
export class BrowserWindow extends EventEmitter {
id: number;
webContents: WebContents;
show(): void;
hide() : void;
focus(): void;
isFocused(): boolean;
reload(): void;
loadUrl(url: string): void;
close(): void;
destroy(): void;
setFullScreen(fullscreen: boolean): void;
isFullScreen(): boolean;
isMaximized(): boolean;
isMinimized(): boolean;
isVisible(): boolean;
getSize(): number[];
setSize(width: number, height: number): void;
getPosition(): number[];
setPosition(x: number, y: number): void;
setMenuBarVisibility(visible: boolean): void;
setAutoHideMenuBar(autoHide: boolean): void;
maximize(): void;
setRepresentedFilename(path: string): void;
setDocumentEdited(edited: boolean): void;
isDocumentEdited(): boolean;
setTitle(title: string): void;
getTitle(): string;
flashFrame(flag: boolean): void;
openDevTools(): void;
closeDevTools(): void;
toggleDevTools(): void;
isDevToolsOpened(): boolean;
isDevToolsFocused(): boolean;
devToolsWebContents: WebContents;
}
export interface IMenu {
new (): Menu;
setApplicationMenu(menu: Menu): void;
buildFromTemplate(template: string): void;
}
// https://github.com/atom/electron/blob/master/docs/api/menu.md
export class Menu {
items: MenuItem[];
append(menuItem: MenuItem): void;
insert(pos: number, menuItem: MenuItem): void;
popup(win: BrowserWindow, x?: number, y?: number): void;
}
export interface IMenuItem {
new (options: IMenuItemConfig): MenuItem;
}
// https://github.com/atom/electron/blob/master/docs/api/menu-item.md
export class MenuItem implements IMenuItemConfig {
label: string;
role: string;
click: () => void;
type: string;
selector: string;
accelerator: string;
enabled: boolean;
visible: boolean;
checked: boolean;
submenu: Menu;
}
export interface IMenuItemConfig {
label?: string;
click?: () => void;
type?: string;
selector?: string;
accelerator?: string;
enabled?: boolean;
visible?: boolean;
checked?: boolean;
submenu?: Menu;
}
export interface IClipboard {
readText(type?:string): string;
writeText(text:string, type?:string): void;
clear(type?:string): void;
}
export interface IUnknown {
}
export function require(moduleName: 'shell'): IShell;
export function require(moduleName: 'menu'): IMenu;
export function require(moduleName: 'menu-item'): IMenuItem;
export function require(moduleName: 'app'): IApp;
export function require(moduleName: 'dialog'): IDialog;
export function require(moduleName: 'ipc'): IIPC;
export function require(moduleName: 'clipboard'): IClipboard;
export function require(moduleName: 'browser-window'): IBrowserWindow;
export function require(moduleName: string): IUnknown;
export function getCurrentWindow(): BrowserWindow;
export function getGlobal(name: string): any;
}
declare module 'crash-reporter' {
export function start(config?: ICrashReporterConfigRenderer): void;
}
interface ICrashReporterConfigRenderer {
productName?: string,
companyName: string,
submitUrl?: string,
autoSubmit?: boolean,
ignoreSystemCrashHandler?: boolean,
extra?: any
}
\ No newline at end of file
此差异已折叠。
......@@ -48,7 +48,7 @@ function generatePatchedEnv(env:any, stdInPipeName:string, stdOutPipeName:string
newEnv['STDIN_PIPE_NAME'] = stdInPipeName;
newEnv['STDOUT_PIPE_NAME'] = stdOutPipeName;
newEnv['ATOM_SHELL_INTERNAL_RUN_AS_NODE'] = '1';
newEnv['ELECTRON_RUN_AS_NODE'] = '1';
return newEnv;
}
......
......@@ -31,7 +31,7 @@ var stdOutPipeName = process.env['STDOUT_PIPE_NAME'];
log('STDIN_PIPE_NAME: ' + stdInPipeName);
log('STDOUT_PIPE_NAME: ' + stdOutPipeName);
log('ATOM_SHELL_INTERNAL_RUN_AS_NODE: ' + process.env['ATOM_SHELL_INTERNAL_RUN_AS_NODE']);
log('ELECTRON_RUN_AS_NODE: ' + process.env['ELECTRON_RUN_AS_NODE']);
// stdout redirection to named pipe
(function() {
......@@ -136,7 +136,7 @@ log('ATOM_SHELL_INTERNAL_RUN_AS_NODE: ' + process.env['ATOM_SHELL_INTERNAL_RUN_A
// Unset the custom environmental variables that should not get inherited
delete process.env['STDIN_PIPE_NAME'];
delete process.env['STDOUT_PIPE_NAME'];
delete process.env['ATOM_SHELL_INTERNAL_RUN_AS_NODE'];
delete process.env['ELECTRON_RUN_AS_NODE'];
require(program);
......
......@@ -19,9 +19,7 @@ import {IQuickOpenService} from 'vs/workbench/services/quickopen/common/quickOpe
import {INullService} from 'vs/platform/instantiation/common/instantiation';
import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
import ipc = require('ipc');
import remote = require('remote');
import webFrame = require('web-frame');
import {ipcRenderer as ipc, webFrame, remote} from 'electron';
export class CloseEditorAction extends Action {
......@@ -74,14 +72,15 @@ export class CloseFolderAction extends Action {
id: string,
label: string,
@IWorkspaceContextService private contextService: IWorkspaceContextService,
@IMessageService private messageService: IMessageService
@IMessageService private messageService: IMessageService,
@IWindowService private windowService: IWindowService
) {
super(id, label);
}
public run(): Promise {
if (this.contextService.getWorkspace()) {
ipc.send('vscode:closeFolder', remote.getCurrentWindow().id); // handled from browser process
ipc.send('vscode:closeFolder', this.windowService.getWindowId()); // handled from browser process
} else {
this.messageService.show(Severity.Info, nls.localize('noFolderOpened', "There is currently no folder opened in this instance to close."));
}
......@@ -95,7 +94,11 @@ export class NewWindowAction extends Action {
public static ID = 'workbench.action.newWindow';
public static LABEL = nls.localize('newWindow', "New Window");
constructor(id: string, label: string, @IWindowService private windowService: IWindowService) {
constructor(
id: string,
label: string,
@IWindowService private windowService: IWindowService
) {
super(id, label);
}
......@@ -148,7 +151,7 @@ export class ToggleDevToolsAction extends Action {
}
public run(): Promise {
remote.getCurrentWindow().toggleDevTools();
remote.getCurrentWindow().webContents.toggleDevTools();
return Promise.as(true);
}
......
......@@ -10,8 +10,7 @@ import {IConfigurationService} from 'vs/platform/configuration/common/configurat
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {Registry} from 'vs/platform/platform';
import crashReporter = require('crash-reporter');
import ipc = require('ipc');
import {ipcRenderer as ipc, crashReporter} from 'electron';
let TELEMETRY_SECTION_ID = 'telemetry';
......@@ -51,7 +50,7 @@ export class CrashReporter {
this.config = null;
}
public start(rawConfiguration:ICrashReporterConfigRenderer): void {
public start(rawConfiguration:Electron.CrashReporterStartOptions): void {
if (!this.isStarted) {
if (!this.config) {
this.configurationService.loadConfiguration(TELEMETRY_SECTION_ID).done((c) => {
......@@ -68,7 +67,7 @@ export class CrashReporter {
}
}
private doStart(rawConfiguration:ICrashReporterConfigRenderer): void {
private doStart(rawConfiguration:Electron.CrashReporterStartOptions): void {
const config = this.toConfiguration(rawConfiguration);
crashReporter.start(config);
......@@ -77,7 +76,7 @@ export class CrashReporter {
ipc.send('vscode:startCrashReporter', config);
}
private toConfiguration(rawConfiguration:ICrashReporterConfigRenderer): ICrashReporterConfigRenderer {
private toConfiguration(rawConfiguration:Electron.CrashReporterStartOptions): Electron.CrashReporterStartOptions {
return JSON.parse(JSON.stringify(rawConfiguration, (key, value) => {
if (value === '$(sessionId)') {
return this.sessionId;
......
......@@ -12,12 +12,13 @@
<!-- Helpers -->
<script type="text/javascript">
var path = require('path');
var remote = require('remote');
var ipc = require('ipc');
var electron = require('electron');
var remote = electron.remote;
var ipc = electron.ipcRenderer;
function onError(error, enableDeveloperTools) {
if (enableDeveloperTools) {
remote.getCurrentWindow().openDevTools();
remote.getCurrentWindow().webContents.openDevTools();
remote.getCurrentWindow().show();
}
......@@ -99,7 +100,7 @@
<!-- Startup Code -->
<script type="text/javascript">
var webFrame = require('web-frame');
var webFrame = require('electron').webFrame;
var mainStarted = false;
var args = parseURLQueryArgs();
......
......@@ -24,9 +24,7 @@ import {IConfigurationService, IConfigurationServiceEvent, ConfigurationServiceE
import win = require('vs/workbench/electron-browser/window');
import remote = require('remote');
import ipc = require('ipc');
import webFrame = require('web-frame');
import {ipcRenderer as ipc, webFrame, remote} from 'electron';
export class ElectronIntegration {
......@@ -50,12 +48,12 @@ export class ElectronIntegration {
this.windowService.registerWindow(activeWindow);
// Support runAction event
ipc.on('vscode:runAction', (actionId: string) => {
ipc.on('vscode:runAction', (event, actionId: string) => {
this.keybindingService.executeCommand(actionId, { from: 'menu' }).done(undefined, err => this.messageService.show(Severity.Error, err));
});
// Support options change
ipc.on('vscode:optionsChange', (options: string) => {
ipc.on('vscode:optionsChange', (event, options: string) => {
let optionsData = JSON.parse(options);
for (let key in optionsData) {
if (optionsData.hasOwnProperty(key)) {
......@@ -66,7 +64,7 @@ export class ElectronIntegration {
});
// Support resolve keybindings event
ipc.on('vscode:resolveKeybindings', (rawActionIds: string) => {
ipc.on('vscode:resolveKeybindings', (event, rawActionIds: string) => {
let actionIds: string[] = [];
try {
actionIds = JSON.parse(rawActionIds);
......@@ -82,11 +80,11 @@ export class ElectronIntegration {
}, () => errors.onUnexpectedError);
});
ipc.on('vscode:telemetry', ({ eventName, data }) => {
ipc.on('vscode:telemetry', (event, { eventName, data }) => {
this.telemetryService.publicLog(eventName, data);
});
ipc.on('vscode:reportError', (error) => {
ipc.on('vscode:reportError', (event, error) => {
if (error) {
let errorParsed = JSON.parse(error);
errorParsed.mainProcess = true;
......@@ -100,7 +98,7 @@ export class ElectronIntegration {
});
// Theme changes
ipc.on('vscode:changeTheme', (theme: string) => {
ipc.on('vscode:changeTheme', (event, theme: string) => {
this.storageService.store('workbench.theme', theme, StorageScope.GLOBAL);
});
......
......@@ -9,15 +9,12 @@ import nls = require('vs/nls');
import severity from 'vs/base/common/severity';
import {Promise} from 'vs/base/common/winjs.base';
import {Action} from 'vs/base/common/actions';
import ipc = require('ipc');
import remote = require('remote');
import {ipcRenderer as ipc, shell} from 'electron';
import {isLinux} from 'vs/base/common/platform';
import {IMessageService} from 'vs/platform/message/common/message';
import {IWorkspaceContextService} from 'vs/workbench/services/workspace/common/contextService';
import {IRequestService} from 'vs/platform/request/common/request';
const shell = remote.require('shell');
interface IUpdate {
releaseNotes: string;
version: string;
......@@ -57,7 +54,7 @@ export class Update {
) {
const env = this.contextService.getConfiguration().env;
ipc.on('vscode:update-downloaded', (update: IUpdate) => {
ipc.on('vscode:update-downloaded', (event, update: IUpdate) => {
this.messageService.show(severity.Info, {
message: nls.localize('updateAvailable', "{0} will be updated after it restarts.", env.appName),
actions: [Update.ShowReleaseNotesAction(env.releaseNotesUrl), Update.NotNowAction, Update.ApplyUpdateAction]
......
......@@ -18,11 +18,7 @@ import {IStorageService} from 'vs/platform/storage/common/storage';
import {IEventService} from 'vs/platform/event/common/event';
import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
import remote = require('remote');
import ipc = require('ipc');
const Shell = remote.require('shell');
const Dialog = remote.require('dialog');
import {ipcRenderer as ipc, shell, remote} from 'electron';
export interface IWindowConfiguration {
window: {
......@@ -33,10 +29,10 @@ export interface IWindowConfiguration {
}
export class ElectronWindow {
private win: remote.BrowserWindow;
private win: Electron.BrowserWindow;
constructor(
win: remote.BrowserWindow,
win: Electron.BrowserWindow,
shellContainer: HTMLElement,
@IWorkspaceContextService private contextService: IWorkspaceContextService,
@IEventService private eventService: IEventService,
......@@ -127,10 +123,10 @@ export class ElectronWindow {
});
// Handle window.open() calls
window.open = function(url: string, target: string, features: string, replace: boolean) {
Shell.openExternal(url);
(<any>window).open = function(url: string, target: string, features: string, replace: boolean) {
shell.openExternal(url);
return <Window>null;
return null;
};
}
......@@ -158,8 +154,8 @@ export class ElectronWindow {
this.win.close();
}
public showMessageBox(options: remote.IMessageBoxOptions): number {
return Dialog.showMessageBox(this.win, options);
public showMessageBox(options: Electron.Dialog.ShowMessageBoxOptions): number {
return remote.dialog.showMessageBox(this.win, options);
}
public setFullScreen(fullscreen: boolean): void {
......@@ -167,7 +163,7 @@ export class ElectronWindow {
}
public openDevTools(): void {
this.win.openDevTools();
this.win.webContents.openDevTools();
}
public isFullScreen(): boolean {
......
......@@ -8,7 +8,7 @@
// Perf measurements
global.vscodeStart = Date.now();
var app = require('app');
var app = require('electron').app;
var path = require('path');
// Change cwd if given via env variable
......
......@@ -9,7 +9,7 @@ import crypto = require('crypto');
import fs = require('fs');
import path = require('path');
import os = require('os');
import app = require('app');
import {app} from 'electron';
import arrays = require('vs/base/common/arrays');
import strings = require('vs/base/common/strings');
......@@ -43,7 +43,7 @@ export interface IProductConfiguration {
serviceUrl: string;
itemUrl: string;
};
crashReporter: ICrashReporterConfigBrowser;
crashReporter: Electron.CrashReporterStartOptions;
welcomePage: string;
enableTelemetry: boolean;
aiConfig: {
......
......@@ -5,9 +5,8 @@
'use strict';
import app = require('app');
import events = require('events');
import ipc = require('ipc');
import {ipcMain as ipc, app} from 'electron';
import {TPromise, TValueCallback} from 'vs/base/common/winjs.base';
import {ReadyState, VSCodeWindow} from 'vs/workbench/electron-main/window';
......@@ -77,7 +76,7 @@ export class Lifecycle {
// Window Before Closing: Main -> Renderer
vscodeWindow.win.on('close', (e) => {
let windowId = vscodeWindow.win.id;
let windowId = vscodeWindow.id;
env.log('Lifecycle#window-before-close', windowId);
// The window already acknowledged to be closed
......@@ -104,7 +103,7 @@ export class Lifecycle {
}
public unload(vscodeWindow: VSCodeWindow): TPromise<boolean /* veto */> {
env.log('Lifecycle#unload()', vscodeWindow.win.id);
env.log('Lifecycle#unload()', vscodeWindow.id);
// Always allow to unload a window that is not yet ready
if (vscodeWindow.readyState !== ReadyState.READY) {
......
......@@ -5,10 +5,8 @@
'use strict';
import app = require('app');
import {app, shell, dialog} from 'electron';
import fs = require('fs');
import dialog = require('dialog');
import shell = require('shell');
import nls = require('vs/nls');
import {assign} from 'vs/base/common/objects';
import platform = require('vs/base/common/platform');
......@@ -23,7 +21,7 @@ import {getUserEnvironment} from 'vs/base/node/env';
import {Promise, TPromise} from 'vs/base/common/winjs.base';
import {GitAskpassService} from 'vs/workbench/parts/git/electron-main/askpassService';
import {spawnSharedProcess} from 'vs/workbench/electron-main/sharedProcess';
import { Mutex } from 'windows-mutex';
import {Mutex} from 'windows-mutex';
export class LaunchService {
public start(args: env.ICommandLineArguments, userEnv: env.IProcessEnvironment): Promise {
......
......@@ -6,12 +6,7 @@
'use strict';
import app = require('app');
import Menu = require('menu');
import MenuItem = require('menu-item');
import Dialog = require('dialog');
import shell = require('shell');
import ipc = require('ipc');
import {ipcMain as ipc, app, shell, dialog, Menu, MenuItem} from 'electron';
import nls = require('vs/nls');
import platform = require('vs/base/common/platform');
......@@ -154,7 +149,7 @@ export class VSCodeMenu {
let menubar = new Menu();
// Mac: Application
let macApplicationMenuItem: MenuItem;
let macApplicationMenuItem: Electron.MenuItem;
if (platform.isMacintosh) {
let applicationMenu = new Menu();
macApplicationMenuItem = new MenuItem({ label: env.product.nameShort, submenu: applicationMenu });
......@@ -182,7 +177,7 @@ export class VSCodeMenu {
this.setGotoMenu(gotoMenu);
// Mac: Window
let macWindowMenuItem: MenuItem;
let macWindowMenuItem: Electron.MenuItem;
if (platform.isMacintosh) {
let windowMenu = new Menu();
macWindowMenuItem = new MenuItem({ label: mnemonicLabel(nls.localize('mWindow', "Window")), submenu: windowMenu, role: 'window' });
......@@ -276,7 +271,7 @@ export class VSCodeMenu {
return mru;
}
private setMacApplicationMenu(macApplicationMenu: Menu): void {
private setMacApplicationMenu(macApplicationMenu: Electron.Menu): void {
let about = new MenuItem({ label: nls.localize('mAbout', "About {0}", env.product.nameLong), role: 'about' });
let checkForUpdates = this.getUpdateMenuItems();
let preferences = this.getPreferencesMenu();
......@@ -301,10 +296,10 @@ export class VSCodeMenu {
actions.forEach(i => macApplicationMenu.append(i));
}
private setFileMenu(fileMenu: Menu): void {
private setFileMenu(fileMenu: Electron.Menu): void {
let hasNoWindows = (windows.manager.getWindowCount() === 0);
let newFile:MenuItem;
let newFile: Electron.MenuItem;
if (hasNoWindows) {
newFile = new MenuItem({ label: mnemonicLabel(nls.localize('miNewFile', "&&New File")), accelerator: this.getAccelerator('workbench.action.files.newUntitledFile'), click: () => windows.manager.openNewWindow() });
} else {
......@@ -358,7 +353,7 @@ export class VSCodeMenu {
]).forEach((item) => fileMenu.append(item));
}
private getPreferencesMenu(): MenuItem {
private getPreferencesMenu(): Electron.MenuItem {
let userSettings = this.createMenuItem(nls.localize('miOpenSettings', "&&User Settings"), 'workbench.action.openGlobalSettings');
let workspaceSettings = this.createMenuItem(nls.localize('miOpenWorkspaceSettings', "&&Workspace Settings"), 'workbench.action.openWorkspaceSettings');
let kebindingSettings = this.createMenuItem(nls.localize('miOpenKeymap', "&&Keyboard Shortcuts"), 'workbench.action.openGlobalKeybindings');
......@@ -396,7 +391,7 @@ export class VSCodeMenu {
}
}
private setOpenRecentMenu(openRecentMenu: Menu): void {
private setOpenRecentMenu(openRecentMenu: Electron.Menu): void {
let recentList = this.getOpenedPathsList();
// Folders
......@@ -425,7 +420,7 @@ export class VSCodeMenu {
}
}
private createOpenRecentMenuItem(path:string): MenuItem {
private createOpenRecentMenuItem(path:string): Electron.MenuItem {
return new MenuItem({ label: path, click: () => {
let success = windows.manager.open({ cli: env.cliArgs, pathsToOpen: [path] });
if (!success) {
......@@ -435,8 +430,8 @@ export class VSCodeMenu {
}});
}
private createRoleMenuItem(label:string, actionId:string, role:string): MenuItem {
let options:IMenuItemConfig = {
private createRoleMenuItem(label:string, actionId:string, role:string): Electron.MenuItem {
let options:Electron.MenuItemOptions = {
label: mnemonicLabel(label),
accelerator: this.getAccelerator(actionId),
role: role,
......@@ -446,13 +441,13 @@ export class VSCodeMenu {
return new MenuItem(options);
}
private setEditMenu(winLinuxEditMenu: Menu): void {
let undo:MenuItem;
let redo:MenuItem;
let cut:MenuItem;
let copy:MenuItem;
let paste:MenuItem;
let selectAll:MenuItem;
private setEditMenu(winLinuxEditMenu: Electron.Menu): void {
let undo: Electron.MenuItem;
let redo: Electron.MenuItem;
let cut: Electron.MenuItem;
let copy: Electron.MenuItem;
let paste: Electron.MenuItem;
let selectAll: Electron.MenuItem;
if (platform.isMacintosh) {
undo = this.createDevToolsAwareMenuItem(nls.localize('miUndo', "&&Undo"), 'undo', (devTools) => devTools.undo());
......@@ -490,7 +485,7 @@ export class VSCodeMenu {
].forEach((item) => winLinuxEditMenu.append(item));
}
private setViewMenu(viewMenu: Menu): void {
private setViewMenu(viewMenu: Electron.Menu): void {
let commands = this.createMenuItem(nls.localize('miCommandPalette', "&&Command Palette..."), 'workbench.action.showCommands');
let markers = this.createMenuItem(nls.localize('miMarker', "&&Errors and Warnings..."), 'workbench.action.showErrorsWarnings');
let output = this.createMenuItem(nls.localize('miToggleOutput', "Toggle &&Output"), 'workbench.action.output.toggleOutput');
......@@ -520,7 +515,7 @@ export class VSCodeMenu {
]).forEach((item) => viewMenu.append(item));
}
private setGotoMenu(gotoMenu: Menu): void {
private setGotoMenu(gotoMenu: Electron.Menu): void {
let back = this.createMenuItem(nls.localize('miBack', "&&Back"), 'workbench.action.navigateBack');
let forward = this.createMenuItem(nls.localize('miForward', "&&Forward"), 'workbench.action.navigateForward');
let navigateHistory = this.createMenuItem(nls.localize('miNavigateHistory', "&&Navigate History"), 'workbench.action.openPreviousEditor');
......@@ -542,7 +537,7 @@ export class VSCodeMenu {
].forEach((item) => gotoMenu.append(item));
}
private setMacWindowMenu(macWindowMenu: Menu): void {
private setMacWindowMenu(macWindowMenu: Electron.Menu): void {
let minimize = new MenuItem({ label: nls.localize('mMinimize', "Minimize"), role: 'minimize', accelerator: 'Command+M', enabled: windows.manager.getWindowCount() > 0 });
let close = new MenuItem({ label: nls.localize('mClose', "Close"), role: 'close', accelerator: 'Command+W', enabled: windows.manager.getWindowCount() > 0 });
let bringAllToFront = new MenuItem({ label: nls.localize('mBringToFront', "Bring All to Front"), role: 'front', enabled: windows.manager.getWindowCount() > 0 });
......@@ -555,7 +550,7 @@ export class VSCodeMenu {
].forEach((item) => macWindowMenu.append(item));
}
private setHelpMenu(helpMenu: Menu): void {
private setHelpMenu(helpMenu: Electron.Menu): void {
let toggleDevToolsItem = new MenuItem({
label: mnemonicLabel(nls.localize('miToggleDevTools', "&&Toggle Developer Tools")),
accelerator: this.getAccelerator('workbench.action.toggleDevTools'),
......@@ -590,7 +585,7 @@ export class VSCodeMenu {
}
}
private getUpdateMenuItems(): MenuItem[]{
private getUpdateMenuItems(): Electron.MenuItem[]{
switch (UpdateManager.state) {
case um.State.Uninitialized:
return [];
......@@ -626,9 +621,9 @@ export class VSCodeMenu {
}
}
private createMenuItem(label:string, actionId: string, enabled?:boolean): MenuItem;
private createMenuItem(label:string, click:() => void, enabled?:boolean): MenuItem;
private createMenuItem(arg1:string, arg2:any, arg3?:boolean): MenuItem {
private createMenuItem(label:string, actionId: string, enabled?:boolean): Electron.MenuItem;
private createMenuItem(label:string, click:() => void, enabled?:boolean): Electron.MenuItem;
private createMenuItem(arg1:string, arg2:any, arg3?:boolean): Electron.MenuItem {
let label = mnemonicLabel(arg1);
let click:() => void = (typeof arg2 === 'function') ? arg2 : () => windows.manager.sendToFocused('vscode:runAction', arg2);
let enabled = typeof arg3 === 'boolean' ? arg3 : windows.manager.getWindowCount() > 0;
......@@ -638,7 +633,7 @@ export class VSCodeMenu {
actionId = arg2;
}
let options:IMenuItemConfig = {
let options:Electron.MenuItemOptions = {
label: label,
accelerator: this.getAccelerator(actionId),
click: click,
......@@ -648,7 +643,7 @@ export class VSCodeMenu {
return new MenuItem(options);
}
private createDevToolsAwareMenuItem(label:string, actionId: string, devToolsFocusedFn: (contents: WebContents) => void): MenuItem {
private createDevToolsAwareMenuItem(label:string, actionId: string, devToolsFocusedFn: (contents: Electron.WebContents) => void): Electron.MenuItem {
return new MenuItem({
label: mnemonicLabel(label),
accelerator: this.getAccelerator(actionId),
......@@ -659,7 +654,7 @@ export class VSCodeMenu {
return;
}
if (windowInFocus.win.isDevToolsFocused()) {
if (windowInFocus.win.webContents.isDevToolsFocused()) {
devToolsFocusedFn(windowInFocus.win.devToolsWebContents);
} else {
windows.manager.sendToFocused('vscode:runAction', actionId);
......@@ -691,7 +686,7 @@ export class VSCodeMenu {
function openAboutDialog(): void {
let lastActiveWindow = windows.manager.getFocusedWindow() || windows.manager.getLastActiveWindow();
Dialog.showMessageBox(lastActiveWindow && lastActiveWindow.win, {
dialog.showMessageBox(lastActiveWindow && lastActiveWindow.win, {
title: env.product.nameLong,
type: 'info',
message: env.product.nameLong,
......@@ -719,7 +714,7 @@ function openUrl(url: string, id: string): void {
function toggleDevTools(): void {
let w = windows.manager.getFocusedWindow();
if (w && w.win) {
w.win.toggleDevTools();
w.win.webContents.toggleDevTools();
}
}
......@@ -727,7 +722,7 @@ function reportMenuActionTelemetry(id: string): void {
windows.manager.sendToFocused('vscode:telemetry', { eventName: 'workbenchActionExecuted', data: { id, from: 'menu' } });
}
function __separator__(): MenuItem {
function __separator__(): Electron.MenuItem {
return new MenuItem({ type: 'separator' });
}
......
......@@ -5,7 +5,7 @@
'use strict';
import app = require('app');
import {app} from 'electron';
import env = require('vs/workbench/electron-main/env');
import {UserSettings} from 'vs/workbench/node/userSettings';
......
......@@ -8,6 +8,7 @@ import fs = require('fs');
import path = require('path');
import events = require('events');
import electron = require('electron');
import platform = require('vs/base/common/platform');
import env = require('vs/workbench/electron-main/env');
import storage = require('vs/workbench/electron-main/storage');
......@@ -37,8 +38,8 @@ export interface IUpdate {
quitAndUpdate: () => void;
}
interface IAutoUpdater extends IEventEmitter {
setFeedUrl(url: string): void;
interface IAutoUpdater extends NodeJS.EventEmitter {
setFeedURL(url: string): void;
checkForUpdates(): void;
}
......@@ -67,7 +68,7 @@ export class UpdateManager extends events.EventEmitter {
if (platform.isWindows) {
this.raw = new Win32AutoUpdaterImpl();
} else if (platform.isMacintosh) {
this.raw = <any>require.__$__nodeRequire('auto-updater'); // https://github.com/atom/electron/issues/3194
this.raw = electron.autoUpdater;
}
if (this.raw) {
......@@ -141,7 +142,7 @@ export class UpdateManager extends events.EventEmitter {
this._channel = channel;
this._feedUrl = feedUrl;
this.raw.setFeedUrl(feedUrl);
this.raw.setFeedURL(feedUrl);
this.setState(State.Idle);
// Check for updates on startup after 30 seconds
......
......@@ -6,7 +6,6 @@
'use strict';
import events = require('events');
import {IAutoUpdater, IUpdate} from 'auto-updater';
import path = require('path');
import os = require('os');
import cp = require('child_process');
......@@ -19,7 +18,14 @@ import { getProxyAgent } from 'vs/workbench/node/proxy';
import {manager as Settings} from 'vs/workbench/electron-main/settings';
import {manager as Lifecycle} from 'vs/workbench/electron-main/lifecycle';
export class Win32AutoUpdaterImpl extends events.EventEmitter implements IAutoUpdater {
export interface IUpdate {
url: string;
name: string;
releaseNotes?: string;
version?: string;
}
export class Win32AutoUpdaterImpl extends events.EventEmitter {
private url: string;
private currentRequest: Promise;
......@@ -36,7 +42,7 @@ export class Win32AutoUpdaterImpl extends events.EventEmitter implements IAutoUp
return new TPromise<string>((c, e) => mkdirp(result, null, err => err ? e(err) : c(result)));
}
public setFeedUrl(url: string): void {
public setFeedURL(url: string): void {
this.url = url;
}
......@@ -102,7 +108,7 @@ export class Win32AutoUpdaterImpl extends events.EventEmitter implements IAutoUp
}
private getUpdatePackagePath(version: string): TPromise<string> {
return this.cachePath.then(cachePath => path.join(cachePath, `CodeSetup-${ version }.exe`));
return this.cachePath.then(cachePath => path.join(cachePath, `CodeSetup-${version}.exe`));
}
private quitAndUpdate(updatePackagePath: string): void {
......
......@@ -8,9 +8,7 @@
import path = require('path');
import os = require('os');
import Shell = require('shell');
import screen = require('screen');
import BrowserWindow = require('browser-window');
import {shell, screen, BrowserWindow} from 'electron';
import {TPromise, TValueCallback} from 'vs/base/common/winjs.base';
import platform = require('vs/base/common/platform');
......@@ -108,7 +106,7 @@ export interface IWindowConfiguration extends env.ICommandLineArguments {
filesToOpen?: IPath[];
filesToCreate?: IPath[];
extensionsToInstall: string[];
crashReporter: ICrashReporterConfigBrowser;
crashReporter: Electron.CrashReporterStartOptions;
extensionsGallery: {
serviceUrl: string;
itemUrl: string;
......@@ -139,7 +137,8 @@ export class VSCodeWindow {
private static MIN_HEIGHT = 120;
private showTimeoutHandle: any;
private _win: BrowserWindow;
private _id: number;
private _win: Electron.BrowserWindow;
private _lastFocusTime: number;
private _readyState: ReadyState;
private _isPluginDevelopmentHost: boolean;
......@@ -167,14 +166,14 @@ export class VSCodeWindow {
global.windowShow = new Date().getTime();
}
let options: IBrowserWindowOptions = {
let options: Electron.BrowserWindowOptions = {
width: this.windowState.width,
height: this.windowState.height,
x: this.windowState.x,
y: this.windowState.y,
'background-color': usesLightTheme ? '#FFFFFF' : '#1E1E1E',
'min-width': VSCodeWindow.MIN_WIDTH,
'min-height': VSCodeWindow.MIN_HEIGHT,
backgroundColor: usesLightTheme ? '#FFFFFF' : '#1E1E1E',
minWidth: VSCodeWindow.MIN_WIDTH,
minHeight: VSCodeWindow.MIN_HEIGHT,
show: showDirectly && this.currentWindowMode !== WindowMode.Maximized, // in case we are maximized, only show later after the call to maximize (see below)
title: env.product.nameLong
};
......@@ -185,6 +184,7 @@ export class VSCodeWindow {
// Create the browser window.
this._win = new BrowserWindow(options);
this._id = this._win.id;
if (showDirectly && this.currentWindowMode === WindowMode.Maximized) {
this.win.maximize();
......@@ -213,7 +213,11 @@ export class VSCodeWindow {
return this.currentConfig;
}
public get win(): BrowserWindow {
public get id(): number {
return this._id;
}
public get win(): Electron.BrowserWindow {
return this._win;
}
......@@ -321,7 +325,7 @@ export class VSCodeWindow {
this._win.webContents.on('new-window', (event: Event, url: string) => {
event.preventDefault();
Shell.openExternal(url);
shell.openExternal(url);
});
// Window Focus
......@@ -363,7 +367,7 @@ export class VSCodeWindow {
}
// Load URL
this._win.loadUrl(this.getUrl(config));
this._win.loadURL(this.getUrl(config));
// Make window visible if it did not open in N seconds because this indicates an error
if (!config.isBuilt) {
......@@ -371,7 +375,7 @@ export class VSCodeWindow {
if (this._win && !this._win.isVisible() && !this._win.isMinimized()) {
this._win.show();
this._win.focus();
this._win.openDevTools();
this._win.webContents.openDevTools();
}
}, 10000);
}
......@@ -534,7 +538,7 @@ export class VSCodeWindow {
return null;
}
public getBounds(): IBounds {
public getBounds(): Electron.Bounds {
let pos = this.win.getPosition();
let dimension = this.win.getSize();
......
......@@ -10,12 +10,7 @@ import events = require('events');
import path = require('path');
import fs = require('fs');
import BrowserWindow = require('browser-window');
import Dialog = require('dialog');
import app = require('app');
import ipc = require('ipc');
import screen = require('screen');
import crashReporter = require('crash-reporter');
import {ipcMain as ipc, app, screen, crashReporter, BrowserWindow, dialog} from 'electron';
import platform = require('vs/base/common/platform');
import env = require('vs/workbench/electron-main/env');
......@@ -157,7 +152,7 @@ export class WindowsManager {
crashReporter.start(config);
});
ipc.on('vscode:windowOpen', (event: Event, paths: string[], forceNewWindow?: boolean) => {
ipc.on('vscode:windowOpen', (event, paths: string[], forceNewWindow?: boolean) => {
env.log('IPC#vscode-windowOpen: ', paths);
if (paths && paths.length) {
......@@ -165,7 +160,7 @@ export class WindowsManager {
}
});
ipc.on('vscode:workbenchLoaded', (event: Event, windowId: number) => {
ipc.on('vscode:workbenchLoaded', (event, windowId: number) => {
env.log('IPC#vscode-workbenchLoaded');
let win = this.getWindowById(windowId);
......@@ -180,19 +175,19 @@ export class WindowsManager {
}
});
ipc.on('vscode:openFilePicker', (event: Event) => {
ipc.on('vscode:openFilePicker', () => {
env.log('IPC#vscode-openFilePicker');
this.openFilePicker();
});
ipc.on('vscode:openFolderPicker', (event: Event) => {
ipc.on('vscode:openFolderPicker', () => {
env.log('IPC#vscode-openFolderPicker');
this.openFolderPicker();
});
ipc.on('vscode:closeFolder', (event: Event, windowId: number) => {
ipc.on('vscode:closeFolder', (event, windowId: number) => {
env.log('IPC#vscode-closeFolder');
let win = this.getWindowById(windowId);
......@@ -201,19 +196,19 @@ export class WindowsManager {
}
});
ipc.on('vscode:openNewWindow', (event: Event) => {
ipc.on('vscode:openNewWindow', () => {
env.log('IPC#vscode-openNewWindow');
this.openNewWindow();
});
ipc.on('vscode:openFileFolderPicker', (event: Event) => {
ipc.on('vscode:openFileFolderPicker', () => {
env.log('IPC#vscode-openFileFolderPicker');
this.openFolderPicker();
});
ipc.on('vscode:reloadWindow', (event: Event, windowId: number) => {
ipc.on('vscode:reloadWindow', (event, windowId: number) => {
env.log('IPC#vscode:reloadWindow');
let vscodeWindow = this.getWindowById(windowId);
......@@ -222,7 +217,7 @@ export class WindowsManager {
}
});
ipc.on('vscode:toggleFullScreen', (event: Event, windowId: number) => {
ipc.on('vscode:toggleFullScreen', (event, windowId: number) => {
env.log('IPC#vscode:toggleFullScreen');
let vscodeWindow = this.getWindowById(windowId);
......@@ -231,7 +226,7 @@ export class WindowsManager {
}
});
ipc.on('vscode:toggleMenuBar', (event: Event, windowId: number) => {
ipc.on('vscode:toggleMenuBar', (event, windowId: number) => {
env.log('IPC#vscode:toggleMenuBar');
// Update in settings
......@@ -248,10 +243,10 @@ export class WindowsManager {
storage.setItem(window.VSCodeWindow.themeStorageKey, theme);
});
ipc.on('vscode:broadcast', (event: Event, windowId: number, target: string, broadcast: { channel: string; payload: any; }) => {
ipc.on('vscode:broadcast', (event, windowId: number, target: string, broadcast: { channel: string; payload: any; }) => {
if (broadcast.channel && broadcast.payload) {
if (target) {
const otherWindowsWithTarget = WindowsManager.WINDOWS.filter(w => w.win.id !== windowId && typeof w.openedWorkspacePath === 'string');
const otherWindowsWithTarget = WindowsManager.WINDOWS.filter(w => w.id !== windowId && typeof w.openedWorkspacePath === 'string');
const directTargetMatch = otherWindowsWithTarget.filter(w => this.isPathEqual(target, w.openedWorkspacePath));
const parentTargetMatch = otherWindowsWithTarget.filter(w => paths.isEqualOrParent(target, w.openedWorkspacePath));
......@@ -265,7 +260,7 @@ export class WindowsManager {
}
});
ipc.on('vscode:log', (event: Event, logEntry: ILogEntry) => {
ipc.on('vscode:log', (event, logEntry: ILogEntry) => {
let args = [];
try {
let parsed = JSON.parse(logEntry.arguments);
......@@ -277,7 +272,7 @@ export class WindowsManager {
console[logEntry.severity].apply(console, args);
});
ipc.on('vscode:exit', (event: Event, code: number) => {
ipc.on('vscode:exit', (event, code: number) => {
process.exit(code);
});
......@@ -291,7 +286,7 @@ export class WindowsManager {
}));
});
ipc.on('vscode:update-apply', (event: Event) => {
ipc.on('vscode:update-apply', () => {
env.log('IPC#vscode:update-apply');
if (UpdateManager.availableUpdate) {
......@@ -411,9 +406,9 @@ export class WindowsManager {
let activeWindow = BrowserWindow.getFocusedWindow();
if (activeWindow) {
Dialog.showMessageBox(activeWindow, options);
dialog.showMessageBox(activeWindow, options);
} else {
Dialog.showMessageBox(options);
dialog.showMessageBox(options);
}
}
......@@ -801,7 +796,7 @@ export class WindowsManager {
//
// We want the new window to open on the same display that the last active one is in
let displayToUse: IDisplay;
let displayToUse: Electron.Display;
let displays = screen.getAllDisplays();
// Single Display
......@@ -877,7 +872,7 @@ export class WindowsManager {
pickerProperties = ['multiSelections', isFolder ? 'openDirectory' : 'openFile', 'createDirectory'];
}
Dialog.showOpenDialog(focussedWindow && focussedWindow.win, {
dialog.showOpenDialog(focussedWindow && focussedWindow.win, {
defaultPath: workingDir,
properties: pickerProperties
}, (paths) => {
......@@ -973,7 +968,7 @@ export class WindowsManager {
public sendToAll(channel: string, payload: any, windowIdsToIgnore?: number[]): void {
WindowsManager.WINDOWS.forEach((w) => {
if (windowIdsToIgnore && windowIdsToIgnore.indexOf(w.win.id) >= 0) {
if (windowIdsToIgnore && windowIdsToIgnore.indexOf(w.id) >= 0) {
return; // do not send if we are instructed to ignore it
}
......@@ -991,7 +986,7 @@ export class WindowsManager {
}
public getWindowById(windowId: number): window.VSCodeWindow {
let res = WindowsManager.WINDOWS.filter((w) => w.win.id === windowId);
let res = WindowsManager.WINDOWS.filter((w) => w.id === windowId);
if (res && res.length === 1) {
return res[0];
}
......@@ -1007,12 +1002,12 @@ export class WindowsManager {
return WindowsManager.WINDOWS.length;
}
private onWindowError(win: BrowserWindow, error: WindowError): void {
private onWindowError(win: Electron.BrowserWindow, error: WindowError): void {
console.error(error === WindowError.CRASHED ? '[VS Code]: render process crashed!' : '[VS Code]: detected unresponsive');
// Unresponsive
if (error === WindowError.UNRESPONSIVE) {
Dialog.showMessageBox(win, {
dialog.showMessageBox(win, {
title: env.product.nameLong,
type: 'warning',
buttons: [nls.localize('exit', "Exit"), nls.localize('wait', "Keep Waiting")],
......@@ -1029,7 +1024,7 @@ export class WindowsManager {
// Crashed
else {
Dialog.showMessageBox(win, {
dialog.showMessageBox(win, {
title: env.product.nameLong,
type: 'warning',
buttons: [nls.localize('exit', "Exit")],
......
......@@ -18,11 +18,9 @@ import model = require('vs/workbench/parts/debug/common/debugModel');
import { IViewletService } from 'vs/workbench/services/viewlet/common/viewletService';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybindingService';
import remote = require('remote');
import {clipboard} from 'electron';
import IDebugService = debug.IDebugService;
const clipboard = remote.require('clipboard');
export class AbstractDebugAction extends actions.Action {
protected debugService: IDebugService;
......
......@@ -27,8 +27,8 @@ import { HighlightedLabel } from 'vs/base/browser/ui/highlightedlabel/highlighte
import { Action } from 'vs/base/common/actions';
import * as semver from 'semver';
import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
import remote = require('remote');
const shell = remote.require('shell');
import { shell } from 'electron';
const $ = dom.emmet;
const InstallLabel = nls.localize('install', "Install Extension");
......
......@@ -19,7 +19,7 @@ import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
import { ListExtensionsAction, InstallExtensionAction, ListOutdatedExtensionsAction } from './extensionsActions';
import { IQuickOpenRegistry, Extensions, QuickOpenHandlerDescriptor } from 'vs/workbench/browser/quickopen';
import ipc = require('ipc');
import {ipcRenderer as ipc} from 'electron';
interface IInstallExtensionsRequest {
extensionsToInstall: string[];
......@@ -83,7 +83,7 @@ export class ExtensionsWorkbenchExtension implements IWorkbenchContribution {
}
private registerListeners(): void {
ipc.on('vscode:installExtensions', (request: IInstallExtensionsRequest) => {
ipc.on('vscode:installExtensions', (event, request: IInstallExtensionsRequest) => {
if (request.extensionsToInstall) {
this.install(request.extensionsToInstall).done(null, errors.onUnexpectedError);
}
......
......@@ -11,8 +11,7 @@ import {FeedbackDropdown, IFeedback, IFeedbackService} from 'vs/workbench/parts/
import {IContextViewService} from 'vs/platform/contextview/browser/contextView';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {IRequestService} from 'vs/platform/request/common/request';
import shell = require('shell');
import {shell} from 'electron';
class TwitterFeedbackService implements IFeedbackService {
......
......@@ -18,11 +18,7 @@ import {asFileEditorInput} from 'vs/workbench/common/editor';
import {IMessageService} from 'vs/platform/message/common/message';
import {INullService} from 'vs/platform/instantiation/common/instantiation';
import remote = require('remote');
import ipc = require('ipc');
const Shell = remote.require('shell');
const Clipboard = remote.require('clipboard');
import {ipcRenderer as ipc, shell, clipboard} from 'electron';
export class RevealInOSAction extends Action {
private resource: uri;
......@@ -36,7 +32,7 @@ export class RevealInOSAction extends Action {
}
public run(): Promise {
Shell.showItemInFolder(paths.normalize(this.resource.fsPath, true));
shell.showItemInFolder(paths.normalize(this.resource.fsPath, true));
return Promise.as(true);
}
......@@ -59,7 +55,7 @@ export class GlobalRevealInOSAction extends Action {
public run(): Promise {
let fileInput = asFileEditorInput(this.editorService.getActiveEditorInput(), true);
if (fileInput) {
Shell.showItemInFolder(paths.normalize(fileInput.getResource().fsPath, true));
shell.showItemInFolder(paths.normalize(fileInput.getResource().fsPath, true));
} else {
this.messageService.show(severity.Info, nls.localize('openFileToReveal', "Open a file first to reveal"));
}
......@@ -80,7 +76,7 @@ export class CopyPathAction extends Action {
}
public run(): Promise {
Clipboard.writeText(labels.getPathLabel(this.resource));
clipboard.writeText(labels.getPathLabel(this.resource));
return Promise.as(true);
}
......@@ -103,7 +99,7 @@ export class GlobalCopyPathAction extends Action {
public run(): Promise {
let fileInput = asFileEditorInput(this.editorService.getActiveEditorInput(), true);
if (fileInput) {
Clipboard.writeText(labels.getPathLabel(fileInput.getResource()));
clipboard.writeText(labels.getPathLabel(fileInput.getResource()));
this.editorService.focusEditor(); // focus back to editor
} else {
this.messageService.show(severity.Info, nls.localize('openFileToCopy', "Open a file first to copy its path"));
......
......@@ -21,8 +21,7 @@ import {IEventService} from 'vs/platform/event/common/event';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {ILifecycleService} from 'vs/platform/lifecycle/common/lifecycle';
import remote = require('remote');
import ipc = require('ipc');
import {ipcRenderer as ipc, remote} from 'electron';
export interface IPath {
filePath: string;
......@@ -82,7 +81,7 @@ export class FileTracker implements IWorkbenchContribution {
this.toUnbind.push(() => disposable.dispose());
// Support openFiles event for existing and new files
ipc.on('vscode:openFiles', (request: IOpenFileRequest) => {
ipc.on('vscode:openFiles', (event, request: IOpenFileRequest) => {
let inputs: IResourceInput[] = [];
if (request.filesToOpen) {
inputs.push(...this.toInputs(request.filesToOpen, false));
......
......@@ -29,10 +29,7 @@ import {ILifecycleService} from 'vs/platform/lifecycle/common/lifecycle';
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {IConfigurationService, IConfigurationServiceEvent, ConfigurationServiceEventTypes} from 'vs/platform/configuration/common/configuration';
import remote = require('remote');
import ipc = require('ipc');
const Dialog = remote.require('dialog');
import {remote} from 'electron';
export class TextFileService extends AbstractTextFileService {
......@@ -183,7 +180,7 @@ export class TextFileService extends AbstractTextFileService {
buttons.push(cancel, dontSave);
}
let opts: remote.IMessageBoxOptions = {
let opts: Electron.Dialog.ShowMessageBoxOptions = {
title: this.contextService.getConfiguration().env.appName,
message: message.join('\n'),
type: 'warning',
......@@ -193,7 +190,7 @@ export class TextFileService extends AbstractTextFileService {
cancelId: buttons.indexOf(cancel)
};
const choice = Dialog.showMessageBox(remote.getCurrentWindow(), opts);
const choice = remote.dialog.showMessageBox(remote.getCurrentWindow(), opts);
return buttons[choice].result;
}
......@@ -366,18 +363,18 @@ export class TextFileService extends AbstractTextFileService {
private promptForPathAsync(defaultPath?: string): TPromise<string> {
return new TPromise<string>((c, e) => {
Dialog.showSaveDialog(remote.getCurrentWindow(), this.getSaveDialogOptions(defaultPath ? paths.normalize(defaultPath, true) : void 0), (path) => {
remote.dialog.showSaveDialog(remote.getCurrentWindow(), this.getSaveDialogOptions(defaultPath ? paths.normalize(defaultPath, true) : void 0), (path) => {
c(path);
});
});
}
private promptForPathSync(defaultPath?: string): string {
return Dialog.showSaveDialog(remote.getCurrentWindow(), this.getSaveDialogOptions(defaultPath ? paths.normalize(defaultPath, true) : void 0));
return remote.dialog.showSaveDialog(remote.getCurrentWindow(), this.getSaveDialogOptions(defaultPath ? paths.normalize(defaultPath, true) : void 0));
}
private getSaveDialogOptions(defaultPath?: string): remote.ISaveDialogOptions {
let options: remote.ISaveDialogOptions = {
private getSaveDialogOptions(defaultPath?: string): Electron.Dialog.SaveDialogOptions {
let options: Electron.Dialog.SaveDialogOptions = {
defaultPath: defaultPath
};
......
......@@ -20,7 +20,7 @@ import { RawGitService, DelayedRawGitService } from 'vs/workbench/parts/git/node
import URI from 'vs/base/common/uri';
import { spawn, exec } from 'child_process';
import { join } from 'path';
import * as remote from 'remote';
import { remote } from 'electron';
function findSpecificGit(gitPath: string): Promise {
return new Promise((c, e) => {
......@@ -110,7 +110,7 @@ export function createNativeRawGitService(workspaceRoot: string, gitPath: string
timeout: 1000 * 60,
args: [gitPath, workspaceRoot, defaultEncoding, remote.process.execPath],
env: {
ATOM_SHELL_INTERNAL_RUN_AS_NODE: 1,
ELECTRON_RUN_AS_NODE: 1,
AMD_ENTRYPOINT: 'vs/workbench/parts/git/electron-browser/gitApp'
}
}
......
......@@ -4,10 +4,9 @@
*--------------------------------------------------------------------------------------------*/
import * as nls from 'vs/nls';
import ipc = require('ipc');
import { ipcMain as ipc, BrowserWindow} from 'electron';
import platform = require('vs/base/common/platform');
import { TPromise } from 'vs/base/common/winjs.base';
import BrowserWindow = require('browser-window');
export interface ICredentials {
username: string;
......@@ -21,7 +20,7 @@ interface ICredentialsResult {
interface IContext {
credentials: ICredentials;
window: BrowserWindow;
window: Electron.BrowserWindow;
}
export class GitAskpassService {
......@@ -47,8 +46,8 @@ export class GitAskpassService {
}
let win = new BrowserWindow({
'always-on-top': true,
'skip-taskbar': true,
alwaysOnTop: true,
skipTaskbar: true,
resizable: false,
width: 450,
height: platform.isWindows ? 280 : 260,
......@@ -63,7 +62,7 @@ export class GitAskpassService {
credentials: null
};
win.loadUrl(require.toUrl('vs/workbench/parts/git/electron-main/index.html'));
win.loadURL(require.toUrl('vs/workbench/parts/git/electron-main/index.html'));
win.webContents.executeJavaScript('init(' + JSON.stringify({ id, host, command }) + ')');
win.once('closed', () => {
......
......@@ -68,9 +68,10 @@
}
</style>
<script>
var shell = require('shell');
var ipc = require('ipc');
var remote = require('remote');
var electron = require('electron');
var shell = electron.shell;
var ipc = electron.ipcRenderer;
var remote = electron.remote;
var currentWindow = remote.getCurrentWindow();
function init(context) {
......
......@@ -10,8 +10,7 @@ import env = require('vs/workbench/electron-main/env');
import events = require('vs/base/common/eventEmitter');
import platform = require('vs/base/common/platform');
import BrowserWindow = require('browser-window');
import ipc = require('ipc');
import { ipcMain as ipc, BrowserWindow } from 'electron';
interface ICredentialsContext {
id: number;
......@@ -31,7 +30,7 @@ interface ICredentialsResult {
interface IContext {
credentials: ICredentials;
window: BrowserWindow;
window: Electron.BrowserWindow;
}
export function configure(bus: events.EventEmitter): void {
......@@ -55,8 +54,8 @@ export function configure(bus: events.EventEmitter): void {
}
var win = new BrowserWindow({
'always-on-top': true,
'skip-taskbar': true,
alwaysOnTop: true,
skipTaskbar: true,
resizable: false,
width: 450,
height: platform.isWindows ? 280 : 260,
......@@ -71,7 +70,7 @@ export function configure(bus: events.EventEmitter): void {
credentials: null
};
win.loadUrl(require.toUrl('vs/workbench/parts/git/electron-main/index.html'));
win.loadURL(require.toUrl('vs/workbench/parts/git/electron-main/index.html'));
win.webContents.executeJavaScript('init(' + JSON.stringify(context) + ')');
win.once('closed', () => {
......
......@@ -26,12 +26,12 @@ export interface IExecutionResult {
function exec(child: ChildProcess, encoding = 'utf8'): TPromise<IExecutionResult> {
const disposables: IDisposable[] = [];
const once = (ee: EventEmitter, name: string, fn: Function) => {
const once = (ee: NodeJS.EventEmitter, name: string, fn: Function) => {
ee.once(name, fn);
disposables.push(toDisposable(() => ee.removeListener(name, fn)));
};
const on = (ee: EventEmitter, name: string, fn: Function) => {
const on = (ee: NodeJS.EventEmitter, name: string, fn: Function) => {
ee.on(name, fn);
disposables.push(toDisposable(() => ee.removeListener(name, fn)));
};
......
......@@ -20,7 +20,7 @@ import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
import * as JSONContributionRegistry from 'vs/platform/jsonschemas/common/jsonContributionRegistry';
import {IJSONSchema} from 'vs/base/common/jsonSchema';
import ipc = require('ipc');
import {ipcRenderer as ipc} from 'electron';
import fs = require('fs');
class OpenSnippetsAction extends actions.Action {
......
......@@ -19,8 +19,6 @@ import {IFileService} from 'vs/platform/files/common/files';
import {ILifecycleService} from 'vs/platform/lifecycle/common/lifecycle';
import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
import remote = require('remote');
import ipc = require('ipc');
import fs = require('fs');
export class SnippetsTracker implements workbenchExt.IWorkbenchContribution {
......
......@@ -19,7 +19,7 @@ import {IQuickOpenService, IPickOpenEntry} from 'vs/workbench/services/quickopen
import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
import {IThemeService, ITheme} from 'vs/workbench/services/themes/node/themeService';
import ipc = require('ipc');
import {ipcRenderer as ipc} from 'electron';
class SelectThemeAction extends actions.Action {
......
......@@ -5,7 +5,7 @@
'use strict';
import { TPromise } from 'vs/base/common/winjs.base';
import {TPromise} from 'vs/base/common/winjs.base';
import severity from 'vs/base/common/severity';
import actions = require('vs/base/common/actions');
import {Separator} from 'vs/base/browser/ui/actionbar/actionbar';
......@@ -16,10 +16,7 @@ import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {IMessageService} from 'vs/platform/message/common/message';
import {IKeybindingService} from 'vs/platform/keybinding/common/keybindingService';
import remote = require('remote');
const Menu = remote.require('menu');
const MenuItem = remote.require('menu-item');
import {remote} from 'electron';
export class ContextMenuService implements IContextMenuService {
public serviceId = IContextMenuService;
......@@ -39,26 +36,26 @@ export class ContextMenuService implements IContextMenuService {
return TPromise.as(null);
}
let menu = new Menu();
let menu = new remote.Menu();
let actionToRun: actions.IAction = null;
actions.forEach(a => {
if (a instanceof Separator) {
menu.append(new MenuItem({ type: 'separator' }));
menu.append(new remote.MenuItem({ type: 'separator' }));
} else {
const keybinding = !!delegate.getKeyBinding ? delegate.getKeyBinding(a) : undefined;
const accelerator = keybinding && this.keybindingService.getElectronAcceleratorFor(keybinding);
const item = new MenuItem({
const item = new remote.MenuItem({
label: a.label,
checked: a.checked,
accelerator,
enabled: a.enabled,
click: () => {
actionToRun = a;
}
});
item.enabled = a.enabled;
menu.append(item);
}
});
......
......@@ -19,9 +19,7 @@ import {IConfigurationService, IConfigurationServiceEvent, ConfigurationServiceE
import {IEventService} from 'vs/platform/event/common/event';
import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
import remote = require('remote');
const Shell = remote.require('shell');
import {shell} from 'electron';
export class FileService implements files.IFileService {
public serviceId = files.IFileService;
......@@ -176,7 +174,7 @@ export class FileService implements files.IFileService {
let absolutePath = resource.fsPath;
let result = Shell.moveItemToTrash(absolutePath);
let result = shell.moveItemToTrash(absolutePath);
if (!result) {
return TPromise.wrapError(new Error(nls.localize('trashFailed', "Failed to move '{0}' to the trash", paths.basename(absolutePath))));
}
......
......@@ -11,7 +11,7 @@ import {BaseLifecycleService} from 'vs/platform/lifecycle/common/baseLifecycleSe
import {IWindowService} from 'vs/workbench/services/window/electron-browser/windowService';
import severity from 'vs/base/common/severity';
import ipc = require('ipc');
import {ipcRenderer as ipc} from 'electron';
export class LifecycleService extends BaseLifecycleService {
......@@ -28,7 +28,7 @@ export class LifecycleService extends BaseLifecycleService {
let windowId = this.windowService.getWindowId();
// Main side indicates that window is about to unload, check for vetos
ipc.on('vscode:beforeUnload', (reply: { okChannel: string, cancelChannel: string }) => {
ipc.on('vscode:beforeUnload', (event, reply: { okChannel: string, cancelChannel: string }) => {
let veto = this.beforeUnload();
if (typeof veto === 'boolean') {
......
......@@ -14,8 +14,6 @@ import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {IKeybindingService} from 'vs/platform/keybinding/common/keybindingService';
import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
import remote = require('remote');
export class MessageService extends WorkbenchMessageService {
constructor(
......@@ -36,7 +34,7 @@ export class MessageService extends WorkbenchMessageService {
confirmation.secondaryButton = nls.localize('cancelButton', "Cancel");
}
let opts: remote.IMessageBoxOptions = {
let opts: Electron.Dialog.ShowMessageBoxOptions = {
title: confirmation.title || this.contextService.getConfiguration().env.appName,
message: confirmation.message,
buttons: [
......
......@@ -21,7 +21,7 @@ import {IWindowService} from 'vs/workbench/services/window/electron-browser/wind
import ports = require('vs/base/node/ports');
import cp = require('child_process');
import ipc = require('ipc');
import {ipcRenderer as ipc} from 'electron';
export const PLUGIN_LOG_BROADCAST_CHANNEL = 'vscode:pluginLog';
export const PLUGIN_ATTACH_BROADCAST_CHANNEL = 'vscode:pluginAttach';
......
......@@ -9,8 +9,7 @@ import {ElectronWindow} from 'vs/workbench/electron-browser/window';
import {createDecorator, ServiceIdentifier} from 'vs/platform/instantiation/common/instantiation';
import Event, {Emitter} from 'vs/base/common/event';
import remote = require('remote');
import ipc = require('ipc');
import {ipcRenderer as ipc, remote} from 'electron';
export var IWindowService = createDecorator<IWindowService>('windowService');
......@@ -50,7 +49,7 @@ export class WindowService implements IWindowService {
}
private registerListeners(): void {
ipc.on('vscode:broadcast', (b: IBroadcast) => {
ipc.on('vscode:broadcast', (event, b: IBroadcast) => {
this._onBroadcast.fire(b);
});
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册