Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
380a5024
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
380a5024
编写于
9月 24, 2018
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
💄
上级
39d87d6d
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
30 addition
and
41 deletion
+30
-41
src/vs/base/browser/ui/dropdown/dropdown.ts
src/vs/base/browser/ui/dropdown/dropdown.ts
+1
-7
src/vs/base/common/actions.ts
src/vs/base/common/actions.ts
+29
-34
未找到文件。
src/vs/base/browser/ui/dropdown/dropdown.ts
浏览文件 @
380a5024
...
@@ -310,7 +310,7 @@ export class DropdownMenuActionItem extends BaseActionItem {
...
@@ -310,7 +310,7 @@ export class DropdownMenuActionItem extends BaseActionItem {
options
.
actionProvider
=
this
.
menuActionsOrProvider
;
options
.
actionProvider
=
this
.
menuActionsOrProvider
;
}
}
this
.
dropdownMenu
=
new
DropdownMenu
(
container
,
options
);
this
.
dropdownMenu
=
this
.
_register
(
new
DropdownMenu
(
container
,
options
)
);
this
.
dropdownMenu
.
menuOptions
=
{
this
.
dropdownMenu
.
menuOptions
=
{
actionItemProvider
:
this
.
actionItemProvider
,
actionItemProvider
:
this
.
actionItemProvider
,
...
@@ -333,10 +333,4 @@ export class DropdownMenuActionItem extends BaseActionItem {
...
@@ -333,10 +333,4 @@ export class DropdownMenuActionItem extends BaseActionItem {
this
.
dropdownMenu
.
show
();
this
.
dropdownMenu
.
show
();
}
}
}
}
dispose
():
void
{
this
.
dropdownMenu
.
dispose
();
super
.
dispose
();
}
}
}
\ No newline at end of file
src/vs/base/common/actions.ts
浏览文件 @
380a5024
...
@@ -54,6 +54,8 @@ export interface IActionChangeEvent {
...
@@ -54,6 +54,8 @@ export interface IActionChangeEvent {
export
class
Action
implements
IAction
{
export
class
Action
implements
IAction
{
protected
_onDidChange
=
new
Emitter
<
IActionChangeEvent
>
();
protected
_onDidChange
=
new
Emitter
<
IActionChangeEvent
>
();
get
onDidChange
():
Event
<
IActionChangeEvent
>
{
return
this
.
_onDidChange
.
event
;
}
protected
_id
:
string
;
protected
_id
:
string
;
protected
_label
:
string
;
protected
_label
:
string
;
protected
_tooltip
:
string
;
protected
_tooltip
:
string
;
...
@@ -71,23 +73,15 @@ export class Action implements IAction {
...
@@ -71,23 +73,15 @@ export class Action implements IAction {
this
.
_actionCallback
=
actionCallback
;
this
.
_actionCallback
=
actionCallback
;
}
}
public
dispose
()
{
get
id
():
string
{
this
.
_onDidChange
.
dispose
();
}
public
get
onDidChange
():
Event
<
IActionChangeEvent
>
{
return
this
.
_onDidChange
.
event
;
}
public
get
id
():
string
{
return
this
.
_id
;
return
this
.
_id
;
}
}
public
get
label
():
string
{
get
label
():
string
{
return
this
.
_label
;
return
this
.
_label
;
}
}
public
set
label
(
value
:
string
)
{
set
label
(
value
:
string
)
{
this
.
_setLabel
(
value
);
this
.
_setLabel
(
value
);
}
}
...
@@ -98,11 +92,11 @@ export class Action implements IAction {
...
@@ -98,11 +92,11 @@ export class Action implements IAction {
}
}
}
}
public
get
tooltip
():
string
{
get
tooltip
():
string
{
return
this
.
_tooltip
;
return
this
.
_tooltip
;
}
}
public
set
tooltip
(
value
:
string
)
{
set
tooltip
(
value
:
string
)
{
this
.
_setTooltip
(
value
);
this
.
_setTooltip
(
value
);
}
}
...
@@ -113,11 +107,11 @@ export class Action implements IAction {
...
@@ -113,11 +107,11 @@ export class Action implements IAction {
}
}
}
}
public
get
class
():
string
{
get
class
():
string
{
return
this
.
_cssClass
;
return
this
.
_cssClass
;
}
}
public
set
class
(
value
:
string
)
{
set
class
(
value
:
string
)
{
this
.
_setClass
(
value
);
this
.
_setClass
(
value
);
}
}
...
@@ -128,11 +122,11 @@ export class Action implements IAction {
...
@@ -128,11 +122,11 @@ export class Action implements IAction {
}
}
}
}
public
get
enabled
():
boolean
{
get
enabled
():
boolean
{
return
this
.
_enabled
;
return
this
.
_enabled
;
}
}
public
set
enabled
(
value
:
boolean
)
{
set
enabled
(
value
:
boolean
)
{
this
.
_setEnabled
(
value
);
this
.
_setEnabled
(
value
);
}
}
...
@@ -143,19 +137,19 @@ export class Action implements IAction {
...
@@ -143,19 +137,19 @@ export class Action implements IAction {
}
}
}
}
public
get
checked
():
boolean
{
get
checked
():
boolean
{
return
this
.
_checked
;
return
this
.
_checked
;
}
}
public
set
checked
(
value
:
boolean
)
{
set
checked
(
value
:
boolean
)
{
this
.
_setChecked
(
value
);
this
.
_setChecked
(
value
);
}
}
public
get
radio
():
boolean
{
get
radio
():
boolean
{
return
this
.
_radio
;
return
this
.
_radio
;
}
}
public
set
radio
(
value
:
boolean
)
{
set
radio
(
value
:
boolean
)
{
this
.
_setRadio
(
value
);
this
.
_setRadio
(
value
);
}
}
...
@@ -173,12 +167,17 @@ export class Action implements IAction {
...
@@ -173,12 +167,17 @@ export class Action implements IAction {
}
}
}
}
public
run
(
event
?:
any
,
data
?:
ITelemetryData
):
TPromise
<
any
>
{
run
(
event
?:
any
,
data
?:
ITelemetryData
):
TPromise
<
any
>
{
if
(
this
.
_actionCallback
!==
void
0
)
{
if
(
this
.
_actionCallback
!==
void
0
)
{
return
this
.
_actionCallback
(
event
);
return
this
.
_actionCallback
(
event
);
}
}
return
TPromise
.
as
(
true
);
return
TPromise
.
as
(
true
);
}
}
dispose
()
{
this
.
_onDidChange
.
dispose
();
}
}
}
export
interface
IRunEvent
{
export
interface
IRunEvent
{
...
@@ -190,12 +189,12 @@ export interface IRunEvent {
...
@@ -190,12 +189,12 @@ export interface IRunEvent {
export
class
ActionRunner
extends
Disposable
implements
IActionRunner
{
export
class
ActionRunner
extends
Disposable
implements
IActionRunner
{
private
_onDidBeforeRun
=
this
.
_register
(
new
Emitter
<
IRunEvent
>
());
private
_onDidBeforeRun
=
this
.
_register
(
new
Emitter
<
IRunEvent
>
());
public
get
onDidBeforeRun
():
Event
<
IRunEvent
>
{
return
this
.
_onDidBeforeRun
.
event
;
}
get
onDidBeforeRun
():
Event
<
IRunEvent
>
{
return
this
.
_onDidBeforeRun
.
event
;
}
private
_onDidRun
=
this
.
_register
(
new
Emitter
<
IRunEvent
>
());
private
_onDidRun
=
this
.
_register
(
new
Emitter
<
IRunEvent
>
());
public
get
onDidRun
():
Event
<
IRunEvent
>
{
return
this
.
_onDidRun
.
event
;
}
get
onDidRun
():
Event
<
IRunEvent
>
{
return
this
.
_onDidRun
.
event
;
}
public
run
(
action
:
IAction
,
context
?:
any
):
TPromise
<
any
>
{
run
(
action
:
IAction
,
context
?:
any
):
TPromise
<
any
>
{
if
(
!
action
.
enabled
)
{
if
(
!
action
.
enabled
)
{
return
TPromise
.
as
(
null
);
return
TPromise
.
as
(
null
);
}
}
...
@@ -220,12 +219,12 @@ export class ActionRunner extends Disposable implements IActionRunner {
...
@@ -220,12 +219,12 @@ export class ActionRunner extends Disposable implements IActionRunner {
}
}
}
}
export
class
RadioGroup
{
export
class
RadioGroup
extends
Disposable
{
private
_disposable
:
IDisposable
;
constructor
(
readonly
actions
:
Action
[])
{
constructor
(
readonly
actions
:
Action
[])
{
this
.
_disposable
=
combinedDisposable
(
actions
.
map
(
action
=>
{
super
();
this
.
_register
(
combinedDisposable
(
actions
.
map
(
action
=>
{
return
action
.
onDidChange
(
e
=>
{
return
action
.
onDidChange
(
e
=>
{
if
(
e
.
checked
&&
action
.
checked
)
{
if
(
e
.
checked
&&
action
.
checked
)
{
for
(
const
candidate
of
actions
)
{
for
(
const
candidate
of
actions
)
{
...
@@ -235,10 +234,6 @@ export class RadioGroup {
...
@@ -235,10 +234,6 @@ export class RadioGroup {
}
}
}
}
});
});
}));
})));
}
dispose
():
void
{
this
.
_disposable
.
dispose
();
}
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录