mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 09:08:48 +01:00
adopt shell module
This commit is contained in:
@@ -34,7 +34,7 @@ var baseModules = [
|
||||
'events', 'fs', 'getmac', 'glob', 'graceful-fs', 'http', 'http-proxy-agent',
|
||||
'https', 'https-proxy-agent', 'iconv-lite', 'electron', 'ipc', 'menu', 'menu-item', 'net',
|
||||
'original-fs', 'os', 'path', 'readline', 'remote', 'sax', 'screen', 'semver',
|
||||
'shell', 'stream', 'string_decoder', 'url', 'vscode-textmate', 'winreg',
|
||||
'stream', 'string_decoder', 'url', 'vscode-textmate', 'winreg',
|
||||
'yauzl', 'native-keymap'
|
||||
];
|
||||
|
||||
|
||||
@@ -9,15 +9,13 @@ 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 {ipcRenderer as ipc} from 'electron';
|
||||
import {ipcRenderer as ipc, shell} from 'electron';
|
||||
import remote = require('remote');
|
||||
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;
|
||||
|
||||
@@ -19,9 +19,8 @@ import {IEventService} from 'vs/platform/event/common/event';
|
||||
import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
|
||||
|
||||
import remote = require('remote');
|
||||
import {ipcRenderer as ipc} from 'electron';
|
||||
import {ipcRenderer as ipc, shell} from 'electron';
|
||||
|
||||
const Shell = remote.require('shell');
|
||||
const Dialog = remote.require('dialog');
|
||||
|
||||
export interface IWindowConfiguration {
|
||||
@@ -128,7 +127,7 @@ export class ElectronWindow {
|
||||
|
||||
// Handle window.open() calls
|
||||
window.open = function(url: string, target: string, features: string, replace: boolean) {
|
||||
Shell.openExternal(url);
|
||||
shell.openExternal(url);
|
||||
|
||||
return <Window>null;
|
||||
};
|
||||
|
||||
@@ -5,10 +5,9 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import {app} from 'electron';
|
||||
import {app, shell} 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');
|
||||
|
||||
@@ -9,8 +9,7 @@
|
||||
import Menu = require('menu');
|
||||
import MenuItem = require('menu-item');
|
||||
import Dialog = require('dialog');
|
||||
import shell = require('shell');
|
||||
import {ipcMain as ipc, app} from 'electron';
|
||||
import {ipcMain as ipc, app, shell} from 'electron';
|
||||
|
||||
import nls = require('vs/nls');
|
||||
import platform = require('vs/base/common/platform');
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
import path = require('path');
|
||||
import os = require('os');
|
||||
|
||||
import Shell = require('shell');
|
||||
import {shell} from 'electron';
|
||||
import screen = require('screen');
|
||||
import BrowserWindow = require('browser-window');
|
||||
|
||||
@@ -321,7 +321,7 @@ export class VSCodeWindow {
|
||||
this._win.webContents.on('new-window', (event: Event, url: string) => {
|
||||
event.preventDefault();
|
||||
|
||||
Shell.openExternal(url);
|
||||
shell.openExternal(url);
|
||||
});
|
||||
|
||||
// Window Focus
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
@@ -19,9 +19,8 @@ import {IMessageService} from 'vs/platform/message/common/message';
|
||||
import {INullService} from 'vs/platform/instantiation/common/instantiation';
|
||||
|
||||
import remote = require('remote');
|
||||
import {ipcRenderer as ipc} from 'electron';
|
||||
import {ipcRenderer as ipc, shell} from 'electron';
|
||||
|
||||
const Shell = remote.require('shell');
|
||||
const Clipboard = remote.require('clipboard');
|
||||
|
||||
export class RevealInOSAction extends Action {
|
||||
@@ -36,7 +35,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 +58,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"));
|
||||
}
|
||||
|
||||
@@ -68,8 +68,9 @@
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
var shell = require('shell');
|
||||
var ipc = require('electron').ipcRenderer;
|
||||
var electron = require('electron');
|
||||
var shell = electron.shell;
|
||||
var ipc = electron.ipcRenderer;
|
||||
var remote = require('remote');
|
||||
var currentWindow = remote.getCurrentWindow();
|
||||
|
||||
|
||||
@@ -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))));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user