Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
42265cd2
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
42265cd2
编写于
7月 17, 2017
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix enablement of menu
上级
765e466a
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
26 addition
and
7 deletion
+26
-7
src/vs/code/electron-main/app.ts
src/vs/code/electron-main/app.ts
+2
-2
src/vs/code/electron-main/menus.ts
src/vs/code/electron-main/menus.ts
+9
-4
src/vs/code/electron-main/windows.ts
src/vs/code/electron-main/windows.ts
+9
-1
src/vs/platform/windows/electron-main/windows.ts
src/vs/platform/windows/electron-main/windows.ts
+6
-0
未找到文件。
src/vs/code/electron-main/app.ts
浏览文件 @
42265cd2
...
...
@@ -303,8 +303,8 @@ export class CodeApplication {
this
.
windowsMainService
=
accessor
.
get
(
IWindowsMainService
);
// TODO@Joao: so ugly...
this
.
windowsMainService
.
onWindow
Close
(()
=>
{
if
(
!
platform
.
isMacintosh
&&
this
.
windowsMainService
.
getWindowCount
()
===
0
)
{
this
.
windowsMainService
.
onWindow
sCountChanged
(
e
=>
{
if
(
!
platform
.
isMacintosh
&&
e
.
newCount
===
0
)
{
this
.
sharedProcess
.
dispose
();
}
});
...
...
src/vs/code/electron-main/menus.ts
浏览文件 @
42265cd2
...
...
@@ -20,7 +20,7 @@ import { RunOnceScheduler } from 'vs/base/common/async';
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
tildify
}
from
'
vs/base/common/labels
'
;
import
{
KeybindingsResolver
}
from
"
vs/code/electron-main/keyboard
"
;
import
{
IWindowsMainService
}
from
"
vs/platform/windows/electron-main/windows
"
;
import
{
IWindowsMainService
,
IWindowsCountChangedEvent
}
from
"
vs/platform/windows/electron-main/windows
"
;
import
{
IHistoryMainService
}
from
"
vs/platform/history/common/history
"
;
import
{
IWorkspaceIdentifier
,
IWorkspacesMainService
,
getWorkspaceLabel
,
ISingleFolderWorkspaceIdentifier
,
isSingleFolderWorkspaceIdentifier
}
from
"
vs/platform/workspaces/common/workspaces
"
;
...
...
@@ -102,7 +102,7 @@ export class CodeMenu {
// Listen to some events from window service
this
.
historyService
.
onRecentlyOpenedChange
(()
=>
this
.
updateMenu
());
this
.
windowsService
.
onWindow
Close
(
_
=>
this
.
onClose
(
this
.
windowsService
.
getWindowCount
()
));
this
.
windowsService
.
onWindow
sCountChanged
(
e
=>
this
.
onWindowsCountChanged
(
e
));
// Listen to extension viewlets
ipc
.
on
(
'
vscode:extensionViewlets
'
,
(
event
,
rawExtensionViewlets
)
=>
{
...
...
@@ -201,8 +201,13 @@ export class CodeMenu {
}
}
private
onClose
(
remainingWindowCount
:
number
):
void
{
if
(
remainingWindowCount
===
0
&&
isMacintosh
)
{
private
onWindowsCountChanged
(
e
:
IWindowsCountChangedEvent
):
void
{
if
(
!
isMacintosh
)
{
return
;
}
// Update menu if window count goes from N > 0 or 0 > N to update menu item enablement
if
((
e
.
oldCount
===
0
&&
e
.
newCount
>
0
)
||
(
e
.
oldCount
>
0
&&
e
.
newCount
===
0
))
{
this
.
updateMenu
();
}
}
...
...
src/vs/code/electron-main/windows.ts
浏览文件 @
42265cd2
...
...
@@ -25,7 +25,7 @@ import CommonEvent, { Emitter } from 'vs/base/common/event';
import
product
from
'
vs/platform/node/product
'
;
import
{
ITelemetryService
,
ITelemetryData
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
isEqual
}
from
'
vs/base/common/paths
'
;
import
{
IWindowsMainService
,
IOpenConfiguration
}
from
"
vs/platform/windows/electron-main/windows
"
;
import
{
IWindowsMainService
,
IOpenConfiguration
,
IWindowsCountChangedEvent
}
from
"
vs/platform/windows/electron-main/windows
"
;
import
{
IHistoryMainService
}
from
"
vs/platform/history/common/history
"
;
import
{
IProcessEnvironment
,
isLinux
,
isMacintosh
,
isWindows
}
from
'
vs/base/common/platform
'
;
import
{
TPromise
}
from
"
vs/base/common/winjs.base
"
;
...
...
@@ -122,6 +122,9 @@ export class WindowsManager implements IWindowsMainService {
private
_onWindowReload
=
new
Emitter
<
number
>
();
onWindowReload
:
CommonEvent
<
number
>
=
this
.
_onWindowReload
.
event
;
private
_onWindowsCountChanged
=
new
Emitter
<
IWindowsCountChangedEvent
>
();
onWindowsCountChanged
:
CommonEvent
<
IWindowsCountChangedEvent
>
=
this
.
_onWindowsCountChanged
.
event
;
constructor
(
@
ILogService
private
logService
:
ILogService
,
@
IStorageService
private
storageService
:
IStorageService
,
...
...
@@ -970,8 +973,12 @@ export class WindowsManager implements IWindowsMainService {
isExtensionTestHost
:
!!
configuration
.
extensionTestsPath
});
// Add to our list of windows
WindowsManager
.
WINDOWS
.
push
(
codeWindow
);
// Indicate number change via event
this
.
_onWindowsCountChanged
.
fire
({
oldCount
:
WindowsManager
.
WINDOWS
.
length
-
1
,
newCount
:
WindowsManager
.
WINDOWS
.
length
});
// Window Events
codeWindow
.
win
.
webContents
.
removeAllListeners
(
'
devtools-reload-page
'
);
// remove built in listener so we can handle this on our own
codeWindow
.
win
.
webContents
.
on
(
'
devtools-reload-page
'
,
()
=>
this
.
reload
(
codeWindow
));
...
...
@@ -1293,6 +1300,7 @@ export class WindowsManager implements IWindowsMainService {
WindowsManager
.
WINDOWS
.
splice
(
index
,
1
);
// Emit
this
.
_onWindowsCountChanged
.
fire
({
oldCount
:
WindowsManager
.
WINDOWS
.
length
+
1
,
newCount
:
WindowsManager
.
WINDOWS
.
length
});
this
.
_onWindowClose
.
fire
(
win
.
id
);
}
...
...
src/vs/platform/windows/electron-main/windows.ts
浏览文件 @
42265cd2
...
...
@@ -40,11 +40,17 @@ export interface ICodeWindow {
export
const
IWindowsMainService
=
createDecorator
<
IWindowsMainService
>
(
'
windowsMainService
'
);
export
interface
IWindowsCountChangedEvent
{
oldCount
:
number
;
newCount
:
number
;
}
export
interface
IWindowsMainService
{
_serviceBrand
:
any
;
// events
onWindowReady
:
Event
<
ICodeWindow
>
;
onWindowsCountChanged
:
Event
<
IWindowsCountChangedEvent
>
;
onWindowClose
:
Event
<
number
>
;
onWindowReload
:
Event
<
number
>
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录