Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
8c8e2a88
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 搜索 >>
提交
8c8e2a88
编写于
11月 11, 2020
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debt - make dialog handlers a workbench core piece
//cc @sbatten
上级
c58384b8
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
38 addition
and
32 deletion
+38
-32
src/vs/workbench/browser/parts/dialogs/dialog.web.contribution.ts
...orkbench/browser/parts/dialogs/dialog.web.contribution.ts
+8
-6
src/vs/workbench/browser/parts/dialogs/dialogHandler.ts
src/vs/workbench/browser/parts/dialogs/dialogHandler.ts
+2
-2
src/vs/workbench/electron-sandbox/parts/dialogs/dialog.contribution.ts
...nch/electron-sandbox/parts/dialogs/dialog.contribution.ts
+13
-11
src/vs/workbench/electron-sandbox/parts/dialogs/dialogHandler.ts
...workbench/electron-sandbox/parts/dialogs/dialogHandler.ts
+0
-4
src/vs/workbench/workbench.desktop.main.ts
src/vs/workbench/workbench.desktop.main.ts
+0
-3
src/vs/workbench/workbench.sandbox.main.ts
src/vs/workbench/workbench.sandbox.main.ts
+8
-3
src/vs/workbench/workbench.web.main.ts
src/vs/workbench/workbench.web.main.ts
+7
-3
未找到文件。
src/vs/workbench/
contrib/dialogs/browser/dialog
.contribution.ts
→
src/vs/workbench/
browser/parts/dialogs/dialog.web
.contribution.ts
浏览文件 @
8c8e2a88
...
...
@@ -13,11 +13,12 @@ import { Registry } from 'vs/platform/registry/common/platform';
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
IWorkbenchContribution
,
IWorkbenchContributionsRegistry
,
Extensions
as
WorkbenchExtensions
}
from
'
vs/workbench/common/contributions
'
;
import
{
IDialogsModel
,
IDialogViewItem
}
from
'
vs/workbench/common/dialogs
'
;
import
{
HTMLDialogHandler
}
from
'
vs/workbench/contrib/dialogs/browser
/dialogHandler
'
;
import
{
BrowserDialogHandler
}
from
'
vs/workbench/browser/parts/dialogs
/dialogHandler
'
;
import
{
DialogService
}
from
'
vs/workbench/services/dialogs/common/dialogService
'
;
import
{
LifecyclePhase
}
from
'
vs/workbench/services/lifecycle/common/lifecycle
'
;
import
{
Disposable
}
from
'
vs/base/common/lifecycle
'
;
export
class
DialogHandlerContribution
implements
IWorkbenchContribution
{
export
class
DialogHandlerContribution
extends
Disposable
implements
IWorkbenchContribution
{
private
impl
:
IDialogHandler
;
private
model
:
IDialogsModel
;
...
...
@@ -32,15 +33,17 @@ export class DialogHandlerContribution implements IWorkbenchContribution {
@
IProductService
productService
:
IProductService
,
@
IClipboardService
clipboardService
:
IClipboardService
)
{
this
.
impl
=
new
HTMLDialogHandler
(
logService
,
layoutService
,
themeService
,
keybindingService
,
productService
,
clipboardService
);
super
();
this
.
impl
=
new
BrowserDialogHandler
(
logService
,
layoutService
,
themeService
,
keybindingService
,
productService
,
clipboardService
);
this
.
model
=
(
this
.
dialogService
as
DialogService
).
model
;
this
.
model
.
onDidShowDialog
(()
=>
{
this
.
_register
(
this
.
model
.
onDidShowDialog
(()
=>
{
if
(
!
this
.
currentDialog
)
{
this
.
processDialogs
();
}
});
})
)
;
this
.
processDialogs
();
}
...
...
@@ -71,4 +74,3 @@ export class DialogHandlerContribution implements IWorkbenchContribution {
const
workbenchRegistry
=
Registry
.
as
<
IWorkbenchContributionsRegistry
>
(
WorkbenchExtensions
.
Workbench
);
workbenchRegistry
.
registerWorkbenchContribution
(
DialogHandlerContribution
,
LifecyclePhase
.
Starting
);
src/vs/workbench/
contrib/dialogs/browser
/dialogHandler.ts
→
src/vs/workbench/
browser/parts/dialogs
/dialogHandler.ts
浏览文件 @
8c8e2a88
...
...
@@ -19,7 +19,7 @@ import { IProductService } from 'vs/platform/product/common/productService';
import
{
IClipboardService
}
from
'
vs/platform/clipboard/common/clipboardService
'
;
import
{
fromNow
}
from
'
vs/base/common/date
'
;
export
class
HTML
DialogHandler
implements
IDialogHandler
{
export
class
Browser
DialogHandler
implements
IDialogHandler
{
private
static
readonly
ALLOWABLE_COMMANDS
=
[
'
copy
'
,
...
...
@@ -88,7 +88,7 @@ export class HTMLDialogHandler implements IDialogHandler {
keyEventProcessor
:
(
event
:
StandardKeyboardEvent
)
=>
{
const
resolved
=
this
.
keybindingService
.
softDispatch
(
event
,
this
.
layoutService
.
container
);
if
(
resolved
&&
resolved
.
commandId
)
{
if
(
HTML
DialogHandler
.
ALLOWABLE_COMMANDS
.
indexOf
(
resolved
.
commandId
)
===
-
1
)
{
if
(
Browser
DialogHandler
.
ALLOWABLE_COMMANDS
.
indexOf
(
resolved
.
commandId
)
===
-
1
)
{
EventHelper
.
stop
(
event
,
true
);
}
}
...
...
src/vs/workbench/
contrib/dialogs/electron-sandbox
/dialog.contribution.ts
→
src/vs/workbench/
electron-sandbox/parts/dialogs
/dialog.contribution.ts
浏览文件 @
8c8e2a88
...
...
@@ -15,14 +15,15 @@ import { Registry } from 'vs/platform/registry/common/platform';
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
IWorkbenchContribution
,
IWorkbenchContributionsRegistry
,
Extensions
as
WorkbenchExtensions
}
from
'
vs/workbench/common/contributions
'
;
import
{
IDialogsModel
,
IDialogViewItem
}
from
'
vs/workbench/common/dialogs
'
;
import
{
HTMLDialogHandler
}
from
'
vs/workbench/contrib/dialogs/browser
/dialogHandler
'
;
import
{
NativeDialogHandler
}
from
'
vs/workbench/
contrib/dialogs/electron-sandbox
/dialogHandler
'
;
import
{
BrowserDialogHandler
}
from
'
vs/workbench/browser/parts/dialogs
/dialogHandler
'
;
import
{
NativeDialogHandler
}
from
'
vs/workbench/
electron-sandbox/parts/dialogs
/dialogHandler
'
;
import
{
DialogService
}
from
'
vs/workbench/services/dialogs/common/dialogService
'
;
import
{
LifecyclePhase
}
from
'
vs/workbench/services/lifecycle/common/lifecycle
'
;
import
{
Disposable
}
from
'
vs/base/common/lifecycle
'
;
export
class
DialogHandlerContribution
implements
IWorkbenchContribution
{
export
class
DialogHandlerContribution
extends
Disposable
implements
IWorkbenchContribution
{
private
nativeImpl
:
IDialogHandler
;
private
custom
Impl
:
IDialogHandler
;
private
browser
Impl
:
IDialogHandler
;
private
model
:
IDialogsModel
;
private
currentDialog
:
IDialogViewItem
|
undefined
;
...
...
@@ -38,16 +39,18 @@ export class DialogHandlerContribution implements IWorkbenchContribution {
@
IClipboardService
clipboardService
:
IClipboardService
,
@
INativeHostService
nativeHostService
:
INativeHostService
)
{
this
.
customImpl
=
new
HTMLDialogHandler
(
logService
,
layoutService
,
themeService
,
keybindingService
,
productService
,
clipboardService
);
super
();
this
.
browserImpl
=
new
BrowserDialogHandler
(
logService
,
layoutService
,
themeService
,
keybindingService
,
productService
,
clipboardService
);
this
.
nativeImpl
=
new
NativeDialogHandler
(
logService
,
nativeHostService
,
productService
,
clipboardService
);
this
.
model
=
(
this
.
dialogService
as
DialogService
).
model
;
this
.
model
.
onDidShowDialog
(()
=>
{
this
.
_register
(
this
.
model
.
onDidShowDialog
(()
=>
{
if
(
!
this
.
currentDialog
)
{
this
.
processDialogs
();
}
});
})
)
;
this
.
processDialogs
();
}
...
...
@@ -59,16 +62,16 @@ export class DialogHandlerContribution implements IWorkbenchContribution {
let
result
:
IDialogResult
|
undefined
=
undefined
;
if
(
this
.
currentDialog
.
args
.
confirmArgs
)
{
const
args
=
this
.
currentDialog
.
args
.
confirmArgs
;
result
=
this
.
useCustomDialog
?
await
this
.
custom
Impl
.
confirm
(
args
.
confirmation
)
:
await
this
.
nativeImpl
.
confirm
(
args
.
confirmation
);
result
=
this
.
useCustomDialog
?
await
this
.
browser
Impl
.
confirm
(
args
.
confirmation
)
:
await
this
.
nativeImpl
.
confirm
(
args
.
confirmation
);
}
else
if
(
this
.
currentDialog
.
args
.
inputArgs
)
{
const
args
=
this
.
currentDialog
.
args
.
inputArgs
;
result
=
this
.
useCustomDialog
?
await
this
.
custom
Impl
.
input
(
args
.
severity
,
args
.
message
,
args
.
buttons
,
args
.
inputs
,
args
.
options
)
:
await
this
.
browser
Impl
.
input
(
args
.
severity
,
args
.
message
,
args
.
buttons
,
args
.
inputs
,
args
.
options
)
:
await
this
.
nativeImpl
.
input
(
args
.
severity
,
args
.
message
,
args
.
buttons
,
args
.
inputs
,
args
.
options
);
}
else
if
(
this
.
currentDialog
.
args
.
showArgs
)
{
const
args
=
this
.
currentDialog
.
args
.
showArgs
;
result
=
this
.
useCustomDialog
?
await
this
.
custom
Impl
.
show
(
args
.
severity
,
args
.
message
,
args
.
buttons
,
args
.
options
)
:
await
this
.
browser
Impl
.
show
(
args
.
severity
,
args
.
message
,
args
.
buttons
,
args
.
options
)
:
await
this
.
nativeImpl
.
show
(
args
.
severity
,
args
.
message
,
args
.
buttons
,
args
.
options
);
}
else
{
await
this
.
nativeImpl
.
about
();
...
...
@@ -86,4 +89,3 @@ export class DialogHandlerContribution implements IWorkbenchContribution {
const
workbenchRegistry
=
Registry
.
as
<
IWorkbenchContributionsRegistry
>
(
WorkbenchExtensions
.
Workbench
);
workbenchRegistry
.
registerWorkbenchContribution
(
DialogHandlerContribution
,
LifecyclePhase
.
Starting
);
src/vs/workbench/
contrib/dialogs/electron-sandbox
/dialogHandler.ts
→
src/vs/workbench/
electron-sandbox/parts/dialogs
/dialogHandler.ts
浏览文件 @
8c8e2a88
...
...
@@ -31,12 +31,8 @@ interface IMassagedMessageBoxOptions {
buttonIndexMap
:
number
[];
}
export
class
NativeDialogHandler
implements
IDialogHandler
{
declare
readonly
_serviceBrand
:
undefined
;
constructor
(
@
ILogService
private
readonly
logService
:
ILogService
,
@
INativeHostService
private
readonly
nativeHostService
:
INativeHostService
,
...
...
src/vs/workbench/workbench.desktop.main.ts
浏览文件 @
8c8e2a88
...
...
@@ -132,9 +132,6 @@ import 'vs/workbench/contrib/debug/node/debugHelperService';
// Webview
import
'
vs/workbench/contrib/webview/electron-browser/webview.contribution
'
;
// Dialogs
import
'
vs/workbench/contrib/dialogs/electron-sandbox/dialog.contribution
'
;
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//
...
...
src/vs/workbench/workbench.sandbox.main.ts
浏览文件 @
8c8e2a88
...
...
@@ -16,10 +16,12 @@ import 'vs/workbench/workbench.common.main';
//#endregion
import
{
IUserDataAutoSyncEnablementService
}
from
'
vs/platform/userDataSync/common/userDataSync
'
;
import
{
UserDataAutoSyncEnablementService
}
from
'
vs/platform/userDataSync/common/userDataAutoSyncService
'
;
registerSingleton
(
IUserDataAutoSyncEnablementService
,
UserDataAutoSyncEnablementService
);
//#region --- workbench parts
import
'
vs/workbench/electron-sandbox/parts/dialogs/dialog.contribution
'
;
//#endregion
//#region --- workbench services
...
...
@@ -51,9 +53,12 @@ import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
import
{
ITimerService
}
from
'
vs/workbench/services/timer/browser/timerService
'
;
import
{
TimerService
}
from
'
vs/workbench/services/timer/electron-sandbox/timerService
'
;
import
{
IUserDataInitializationService
,
UserDataInitializationService
}
from
'
vs/workbench/services/userData/browser/userDataInit
'
;
import
{
IUserDataAutoSyncEnablementService
}
from
'
vs/platform/userDataSync/common/userDataSync
'
;
import
{
UserDataAutoSyncEnablementService
}
from
'
vs/platform/userDataSync/common/userDataAutoSyncService
'
;
registerSingleton
(
ITimerService
,
TimerService
);
registerSingleton
(
IUserDataInitializationService
,
UserDataInitializationService
);
registerSingleton
(
IUserDataAutoSyncEnablementService
,
UserDataAutoSyncEnablementService
);
//#endregion
...
...
src/vs/workbench/workbench.web.main.ts
浏览文件 @
8c8e2a88
...
...
@@ -18,6 +18,13 @@ import 'vs/workbench/workbench.common.main';
//#endregion
//#region --- workbench parts
import
'
vs/workbench/browser/parts/dialogs/dialog.web.contribution
'
;
//#endregion
//#region --- workbench (web main)
import
'
vs/workbench/browser/web.main
'
;
...
...
@@ -116,9 +123,6 @@ import 'vs/workbench/contrib/debug/browser/extensionHostDebugService';
// Webview
import
'
vs/workbench/contrib/webview/browser/webview.web.contribution
'
;
// Dialog
import
'
vs/workbench/contrib/dialogs/browser/dialog.contribution
'
;
// Terminal
import
'
vs/workbench/contrib/terminal/browser/terminal.web.contribution
'
;
import
'
vs/workbench/contrib/terminal/browser/terminalInstanceService
'
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录