Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
6a40aa29
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,发现更多精彩内容 >>
提交
6a40aa29
编写于
7月 03, 2018
作者:
S
SteVen Batten
提交者:
Benjamin Pasero
7月 04, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
register disposables for menubarPart (#53467)
* register disposables * adding missing disposables
上级
185278a3
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
35 addition
and
26 deletion
+35
-26
src/vs/base/browser/ui/menu/menu.ts
src/vs/base/browser/ui/menu/menu.ts
+9
-0
src/vs/workbench/browser/parts/menubar/menubarPart.ts
src/vs/workbench/browser/parts/menubar/menubarPart.ts
+26
-26
未找到文件。
src/vs/base/browser/ui/menu/menu.ts
浏览文件 @
6a40aa29
...
@@ -260,4 +260,13 @@ class SubmenuActionItem extends MenuActionItem {
...
@@ -260,4 +260,13 @@ class SubmenuActionItem extends MenuActionItem {
this
.
mysubmenu
=
this
.
parentData
.
submenu
;
this
.
mysubmenu
=
this
.
parentData
.
submenu
;
}
}
}
}
public
dispose
()
{
super
.
dispose
();
if
(
this
.
mysubmenu
)
{
this
.
mysubmenu
.
dispose
();
this
.
mysubmenu
=
null
;
}
}
}
}
\ No newline at end of file
src/vs/workbench/browser/parts/menubar/menubarPart.ts
浏览文件 @
6a40aa29
...
@@ -120,33 +120,33 @@ export class MenubarPart extends Part {
...
@@ -120,33 +120,33 @@ export class MenubarPart extends Part {
super
(
id
,
{
hasTitle
:
false
},
themeService
);
super
(
id
,
{
hasTitle
:
false
},
themeService
);
this
.
topLevelMenus
=
{
this
.
topLevelMenus
=
{
'
File
'
:
this
.
menuService
.
createMenu
(
MenuId
.
MenubarFileMenu
,
this
.
contextKeyService
),
'
File
'
:
this
.
_register
(
this
.
menuService
.
createMenu
(
MenuId
.
MenubarFileMenu
,
this
.
contextKeyService
)
),
'
Edit
'
:
this
.
menuService
.
createMenu
(
MenuId
.
MenubarEditMenu
,
this
.
contextKeyService
),
'
Edit
'
:
this
.
_register
(
this
.
menuService
.
createMenu
(
MenuId
.
MenubarEditMenu
,
this
.
contextKeyService
)
),
'
Selection
'
:
this
.
menuService
.
createMenu
(
MenuId
.
MenubarSelectionMenu
,
this
.
contextKeyService
),
'
Selection
'
:
this
.
_register
(
this
.
menuService
.
createMenu
(
MenuId
.
MenubarSelectionMenu
,
this
.
contextKeyService
)
),
'
View
'
:
this
.
menuService
.
createMenu
(
MenuId
.
MenubarViewMenu
,
this
.
contextKeyService
),
'
View
'
:
this
.
_register
(
this
.
menuService
.
createMenu
(
MenuId
.
MenubarViewMenu
,
this
.
contextKeyService
)
),
'
Go
'
:
this
.
menuService
.
createMenu
(
MenuId
.
MenubarGoMenu
,
this
.
contextKeyService
),
'
Go
'
:
this
.
_register
(
this
.
menuService
.
createMenu
(
MenuId
.
MenubarGoMenu
,
this
.
contextKeyService
)
),
'
Terminal
'
:
this
.
menuService
.
createMenu
(
MenuId
.
MenubarTerminalMenu
,
this
.
contextKeyService
),
'
Terminal
'
:
this
.
_register
(
this
.
menuService
.
createMenu
(
MenuId
.
MenubarTerminalMenu
,
this
.
contextKeyService
)
),
'
Debug
'
:
this
.
menuService
.
createMenu
(
MenuId
.
MenubarDebugMenu
,
this
.
contextKeyService
),
'
Debug
'
:
this
.
_register
(
this
.
menuService
.
createMenu
(
MenuId
.
MenubarDebugMenu
,
this
.
contextKeyService
)
),
'
Tasks
'
:
this
.
menuService
.
createMenu
(
MenuId
.
MenubarTasksMenu
,
this
.
contextKeyService
),
'
Tasks
'
:
this
.
_register
(
this
.
menuService
.
createMenu
(
MenuId
.
MenubarTasksMenu
,
this
.
contextKeyService
)
),
'
Help
'
:
this
.
menuService
.
createMenu
(
MenuId
.
MenubarHelpMenu
,
this
.
contextKeyService
)
'
Help
'
:
this
.
_register
(
this
.
menuService
.
createMenu
(
MenuId
.
MenubarHelpMenu
,
this
.
contextKeyService
)
)
};
};
if
(
isMacintosh
)
{
if
(
isMacintosh
)
{
this
.
topLevelMenus
[
'
Window
'
]
=
this
.
menuService
.
createMenu
(
MenuId
.
MenubarWindowMenu
,
this
.
contextKeyService
);
this
.
topLevelMenus
[
'
Window
'
]
=
this
.
_register
(
this
.
menuService
.
createMenu
(
MenuId
.
MenubarWindowMenu
,
this
.
contextKeyService
)
);
}
}
this
.
actionRunner
=
new
ActionRunner
(
);
this
.
actionRunner
=
this
.
_register
(
new
ActionRunner
()
);
this
.
actionRunner
.
onDidBeforeRun
(()
=>
{
this
.
_register
(
this
.
actionRunner
.
onDidBeforeRun
(()
=>
{
if
(
this
.
focusedMenu
&&
this
.
focusedMenu
.
holder
)
{
if
(
this
.
focusedMenu
&&
this
.
focusedMenu
.
holder
)
{
this
.
focusedMenu
.
holder
.
hide
();
this
.
focusedMenu
.
holder
.
hide
();
}
}
});
})
)
;
this
.
_onVisibilityChange
=
new
Emitter
<
Dimension
>
(
);
this
.
_onVisibilityChange
=
this
.
_register
(
new
Emitter
<
Dimension
>
()
);
if
(
isMacintosh
||
this
.
currentTitlebarStyleSetting
!==
'
custom
'
)
{
if
(
isMacintosh
||
this
.
currentTitlebarStyleSetting
!==
'
custom
'
)
{
for
(
let
topLevelMenuName
of
Object
.
keys
(
this
.
topLevelMenus
))
{
for
(
let
topLevelMenuName
of
Object
.
keys
(
this
.
topLevelMenus
))
{
this
.
topLevelMenus
[
topLevelMenuName
].
onDidChange
(()
=>
this
.
setupMenubar
(
));
this
.
_register
(
this
.
topLevelMenus
[
topLevelMenuName
].
onDidChange
(()
=>
this
.
setupMenubar
()
));
}
}
this
.
setupMenubar
();
this
.
setupMenubar
();
}
}
...
@@ -274,21 +274,21 @@ export class MenubarPart extends Part {
...
@@ -274,21 +274,21 @@ export class MenubarPart extends Part {
}
}
private
registerListeners
():
void
{
private
registerListeners
():
void
{
browser
.
onDidChangeFullscreen
(()
=>
this
.
onDidChangeFullscreen
(
));
this
.
_register
(
browser
.
onDidChangeFullscreen
(()
=>
this
.
onDidChangeFullscreen
()
));
// Update when config changes
// Update when config changes
this
.
configurationService
.
onDidChangeConfiguration
(
e
=>
this
.
onConfigurationUpdated
(
e
));
this
.
_register
(
this
.
configurationService
.
onDidChangeConfiguration
(
e
=>
this
.
onConfigurationUpdated
(
e
)
));
// Listen to update service
// Listen to update service
// this.updateService.onStateChange(() => this.setupMenubar());
// this.updateService.onStateChange(() => this.setupMenubar());
// Listen for changes in recently opened menu
// Listen for changes in recently opened menu
this
.
windowsService
.
onRecentlyOpenedChange
(()
=>
{
this
.
onRecentlyOpenedChange
();
}
);
this
.
_register
(
this
.
windowsService
.
onRecentlyOpenedChange
(()
=>
{
this
.
onRecentlyOpenedChange
();
})
);
// Listen to keybindings change
// Listen to keybindings change
this
.
keybindingService
.
onDidUpdateKeybindings
(()
=>
this
.
setupMenubar
(
));
this
.
_register
(
this
.
keybindingService
.
onDidUpdateKeybindings
(()
=>
this
.
setupMenubar
()
));
ModifierKeyEmitter
.
getInstance
().
event
(
this
.
onModifierKeyToggled
,
this
);
this
.
_register
(
ModifierKeyEmitter
.
getInstance
().
event
(
this
.
onModifierKeyToggled
,
this
)
);
}
}
private
setupMenubar
():
void
{
private
setupMenubar
():
void
{
...
@@ -486,7 +486,7 @@ export class MenubarPart extends Part {
...
@@ -486,7 +486,7 @@ export class MenubarPart extends Part {
};
};
this
.
customMenus
[
menuIndex
].
actions
=
[];
this
.
customMenus
[
menuIndex
].
actions
=
[];
menu
.
onDidChange
(()
=>
updateActions
(
menu
,
this
.
customMenus
[
menuIndex
].
actions
));
this
.
_register
(
menu
.
onDidChange
(()
=>
updateActions
(
menu
,
this
.
customMenus
[
menuIndex
].
actions
)
));
updateActions
(
menu
,
this
.
customMenus
[
menuIndex
].
actions
);
updateActions
(
menu
,
this
.
customMenus
[
menuIndex
].
actions
);
this
.
customMenus
[
menuIndex
].
titleElement
.
on
(
EventType
.
CLICK
,
()
=>
{
this
.
customMenus
[
menuIndex
].
titleElement
.
on
(
EventType
.
CLICK
,
()
=>
{
...
@@ -662,19 +662,19 @@ export class MenubarPart extends Part {
...
@@ -662,19 +662,19 @@ export class MenubarPart extends Part {
// actionItemProvider: (action) => { return this._getActionItem(action); }
// actionItemProvider: (action) => { return this._getActionItem(action); }
};
};
let
menuWidget
=
new
Menu
(
menuHolder
.
getHTMLElement
(),
customMenu
.
actions
,
menuOptions
);
let
menuWidget
=
this
.
_register
(
new
Menu
(
menuHolder
.
getHTMLElement
(),
customMenu
.
actions
,
menuOptions
)
);
menuWidget
.
onDidCancel
(()
=>
{
this
.
_register
(
menuWidget
.
onDidCancel
(()
=>
{
this
.
cleanupCustomMenu
();
this
.
cleanupCustomMenu
();
this
.
isFocused
=
false
;
this
.
isFocused
=
false
;
});
})
)
;
menuWidget
.
onDidBlur
(()
=>
{
this
.
_register
(
menuWidget
.
onDidBlur
(()
=>
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
this
.
cleanupCustomMenu
();
this
.
cleanupCustomMenu
();
this
.
isFocused
=
false
;
this
.
isFocused
=
false
;
},
100
);
},
100
);
});
})
)
;
menuWidget
.
focus
();
menuWidget
.
focus
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录