Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
64992dee
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,发现更多精彩内容 >>
提交
64992dee
编写于
10月 17, 2017
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Adopt menus using new configuration change event
上级
2cbaa8c7
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
48 addition
and
80 deletion
+48
-80
src/vs/code/electron-main/menus.ts
src/vs/code/electron-main/menus.ts
+48
-80
未找到文件。
src/vs/code/electron-main/menus.ts
浏览文件 @
64992dee
...
@@ -11,8 +11,8 @@ import * as arrays from 'vs/base/common/arrays';
...
@@ -11,8 +11,8 @@ import * as arrays from 'vs/base/common/arrays';
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
ipcMain
as
ipc
,
app
,
shell
,
dialog
,
Menu
,
MenuItem
,
BrowserWindow
}
from
'
electron
'
;
import
{
ipcMain
as
ipc
,
app
,
shell
,
dialog
,
Menu
,
MenuItem
,
BrowserWindow
}
from
'
electron
'
;
import
{
OpenContext
,
IRunActionInWindowRequest
}
from
'
vs/platform/windows/common/windows
'
;
import
{
OpenContext
,
IRunActionInWindowRequest
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IConfigurationService
,
IConfigurationChangeEvent
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IFilesConfiguration
,
AutoSaveConfiguration
}
from
'
vs/platform/files/common/files
'
;
import
{
AutoSaveConfiguration
}
from
'
vs/platform/files/common/files
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IUpdateService
,
State
as
UpdateState
}
from
'
vs/platform/update/common/update
'
;
import
{
IUpdateService
,
State
as
UpdateState
}
from
'
vs/platform/update/common/update
'
;
import
product
from
'
vs/platform/node/product
'
;
import
product
from
'
vs/platform/node/product
'
;
...
@@ -29,27 +29,6 @@ interface IExtensionViewlet {
...
@@ -29,27 +29,6 @@ interface IExtensionViewlet {
label
:
string
;
label
:
string
;
}
}
interface
IConfiguration
extends
IFilesConfiguration
{
window
:
{
enableMenuBarMnemonics
:
boolean
;
nativeTabs
:
boolean
;
};
workbench
:
{
sideBar
:
{
location
:
'
left
'
|
'
right
'
;
},
statusBar
:
{
visible
:
boolean
;
},
activityBar
:
{
visible
:
boolean
;
}
};
editor
:
{
multiCursorModifier
:
'
ctrlCmd
'
|
'
alt
'
};
}
interface
IMenuItemClickHandler
{
interface
IMenuItemClickHandler
{
inDevTools
:
(
contents
:
Electron
.
WebContents
)
=>
void
;
inDevTools
:
(
contents
:
Electron
.
WebContents
)
=>
void
;
inNoWindow
:
()
=>
void
;
inNoWindow
:
()
=>
void
;
...
@@ -61,13 +40,15 @@ export class CodeMenu {
...
@@ -61,13 +40,15 @@ export class CodeMenu {
private
static
MAX_MENU_RECENT_ENTRIES
=
10
;
private
static
MAX_MENU_RECENT_ENTRIES
=
10
;
private
currentAutoSaveSetting
:
string
;
private
keys
=
[
private
currentMultiCursorModifierSetting
:
string
;
'
files.autoSave
'
,
private
currentSidebarLocation
:
'
left
'
|
'
right
'
;
'
editor.multiCursorModifier
'
,
private
currentStatusbarVisible
:
boolean
;
'
workbench.sideBar.location
'
,
private
currentActivityBarVisible
:
boolean
;
'
workbench.statusBar.visible
'
,
private
currentEnableMenuBarMnemonics
:
boolean
;
'
workbench.activityBar.visible
'
,
private
currentEnableNativeTabs
:
boolean
;
'
window.enableMenuBarMnemonics
'
,
'
window.nativeTabs
'
];
private
isQuitting
:
boolean
;
private
isQuitting
:
boolean
;
private
appMenuInstalled
:
boolean
;
private
appMenuInstalled
:
boolean
;
...
@@ -99,8 +80,6 @@ export class CodeMenu {
...
@@ -99,8 +80,6 @@ export class CodeMenu {
this
.
menuUpdater
=
new
RunOnceScheduler
(()
=>
this
.
doUpdateMenu
(),
0
);
this
.
menuUpdater
=
new
RunOnceScheduler
(()
=>
this
.
doUpdateMenu
(),
0
);
this
.
keybindingsResolver
=
instantiationService
.
createInstance
(
KeybindingsResolver
);
this
.
keybindingsResolver
=
instantiationService
.
createInstance
(
KeybindingsResolver
);
this
.
onConfigurationUpdated
(
this
.
configurationService
.
getConfiguration
<
IConfiguration
>
());
this
.
install
();
this
.
install
();
this
.
registerListeners
();
this
.
registerListeners
();
...
@@ -136,7 +115,7 @@ export class CodeMenu {
...
@@ -136,7 +115,7 @@ export class CodeMenu {
});
});
// Update when auto save config changes
// Update when auto save config changes
this
.
configurationService
.
onDidChangeConfiguration
(
e
=>
this
.
onConfigurationUpdated
(
this
.
configurationService
.
getConfiguration
<
IConfiguration
>
(),
true
/* update menu if changed */
));
this
.
configurationService
.
onDidChangeConfiguration
(
e
=>
this
.
onConfigurationUpdated
(
e
));
// Listen to update service
// Listen to update service
this
.
updateService
.
onStateChange
(()
=>
this
.
updateMenu
());
this
.
updateService
.
onStateChange
(()
=>
this
.
updateMenu
());
...
@@ -145,65 +124,54 @@ export class CodeMenu {
...
@@ -145,65 +124,54 @@ export class CodeMenu {
this
.
keybindingsResolver
.
onKeybindingsChanged
(()
=>
this
.
updateMenu
());
this
.
keybindingsResolver
.
onKeybindingsChanged
(()
=>
this
.
updateMenu
());
}
}
private
onConfigurationUpdated
(
config
:
IConfiguration
,
handleMenu
?:
boolean
):
void
{
private
onConfigurationUpdated
(
event
:
IConfigurationChangeEvent
):
void
{
let
updateMenu
=
false
;
if
(
this
.
keys
.
some
(
key
=>
event
.
affectsConfiguration
(
key
)))
{
const
newAutoSaveSetting
=
config
&&
config
.
files
&&
config
.
files
.
autoSave
;
this
.
updateMenu
();
if
(
newAutoSaveSetting
!==
this
.
currentAutoSaveSetting
)
{
this
.
currentAutoSaveSetting
=
newAutoSaveSetting
;
updateMenu
=
true
;
}
}
}
const
newMultiCursorModifierSetting
=
config
&&
config
.
editor
&&
config
.
editor
.
multiCursorModifier
;
private
get
currentAutoSaveSetting
():
string
{
if
(
newMultiCursorModifierSetting
!==
this
.
currentMultiCursorModifierSetting
)
{
return
this
.
configurationService
.
getValue
<
string
>
(
'
files.autoSave
'
);
this
.
currentMultiCursorModifierSetting
=
newMultiCursorModifierSetting
;
}
updateMenu
=
true
;
}
const
newSidebarLocation
=
config
&&
config
.
workbench
&&
config
.
workbench
.
sideBar
&&
config
.
workbench
.
sideBar
.
location
||
'
left
'
;
private
get
currentMultiCursorModifierSetting
():
string
{
if
(
newSidebarLocation
!==
this
.
currentSidebarLocation
)
{
return
this
.
configurationService
.
getValue
<
string
>
(
'
editor.multiCursorModifier
'
);
this
.
currentSidebarLocation
=
newSidebarLocation
;
}
updateMenu
=
true
;
}
let
newStatusbarVisible
=
config
&&
config
.
workbench
&&
config
.
workbench
.
statusBar
&&
config
.
workbench
.
statusBar
.
visible
;
private
get
currentSidebarLocation
():
string
{
if
(
typeof
newStatusbarVisible
!==
'
boolean
'
)
{
return
this
.
configurationService
.
getValue
<
string
>
(
'
workbench.sideBar.location
'
)
||
'
left
'
;
newStatusbarVisible
=
true
;
}
}
if
(
newStatusbarVisible
!==
this
.
currentStatusbarVisible
)
{
this
.
currentStatusbarVisible
=
newStatusbarVisible
;
updateMenu
=
true
;
}
let
newActivityBarVisible
=
config
&&
config
.
workbench
&&
config
.
workbench
.
activityBar
&&
config
.
workbench
.
activityBar
.
visible
;
private
get
currentStatusbarVisible
():
boolean
{
if
(
typeof
newActivityBarVisible
!==
'
boolean
'
)
{
let
statusbarVisible
=
this
.
configurationService
.
getValue
<
boolean
>
(
'
workbench.statusBar.visible
'
);
newActivityBarVisible
=
true
;
if
(
typeof
statusbarVisible
!==
'
boolean
'
)
{
}
statusbarVisible
=
true
;
if
(
newActivityBarVisible
!==
this
.
currentActivityBarVisible
)
{
this
.
currentActivityBarVisible
=
newActivityBarVisible
;
updateMenu
=
true
;
}
}
return
statusbarVisible
;
}
let
newEnableMenuBarMnemonics
=
config
&&
config
.
window
&&
config
.
window
.
enableMenuBarMnemonics
;
private
get
currentActivityBarVisible
():
boolean
{
if
(
typeof
newEnableMenuBarMnemonics
!==
'
boolean
'
)
{
let
activityBarVisible
=
this
.
configurationService
.
getValue
<
boolean
>
(
'
workbench.activityBar.visible
'
);
newEnableMenuBarMnemonics
=
true
;
if
(
typeof
activityBarVisible
!==
'
boolean
'
)
{
}
activityBarVisible
=
true
;
if
(
newEnableMenuBarMnemonics
!==
this
.
currentEnableMenuBarMnemonics
)
{
this
.
currentEnableMenuBarMnemonics
=
newEnableMenuBarMnemonics
;
updateMenu
=
true
;
}
}
return
activityBarVisible
;
}
let
newEnableNativeTabs
=
config
&&
config
.
window
&&
config
.
window
.
nativeTabs
;
private
get
currentEnableMenuBarMnemonics
():
boolean
{
if
(
typeof
newEnableNativeTabs
!==
'
boolean
'
)
{
let
enableMenuBarMnemonics
=
this
.
configurationService
.
getValue
<
boolean
>
(
'
window.enableMenuBarMnemonics
'
);
newEnableNativeTabs
=
false
;
if
(
typeof
enableMenuBarMnemonics
!==
'
boolean
'
)
{
}
enableMenuBarMnemonics
=
true
;
if
(
newEnableNativeTabs
!==
this
.
currentEnableNativeTabs
)
{
this
.
currentEnableNativeTabs
=
newEnableNativeTabs
;
updateMenu
=
true
;
}
}
return
enableMenuBarMnemonics
;
}
if
(
handleMenu
&&
updateMenu
)
{
private
get
currentEnableNativeTabs
():
boolean
{
this
.
updateMenu
();
let
enableNativeTabs
=
this
.
configurationService
.
getValue
<
boolean
>
(
'
window.nativeTabs
'
);
if
(
typeof
enableNativeTabs
!==
'
boolean
'
)
{
enableNativeTabs
=
false
;
}
}
return
enableNativeTabs
;
}
}
private
updateMenu
():
void
{
private
updateMenu
():
void
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录