Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
9b6928ca
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,发现更多精彩内容 >>
提交
9b6928ca
编写于
11月 28, 2018
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix datatree.getNode()
上级
701c8482
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
14 addition
and
10 deletion
+14
-10
src/vs/base/browser/ui/tree/dataTree.ts
src/vs/base/browser/ui/tree/dataTree.ts
+13
-9
src/vs/base/browser/ui/tree/objectTree.ts
src/vs/base/browser/ui/tree/objectTree.ts
+1
-1
未找到文件。
src/vs/base/browser/ui/tree/dataTree.ts
浏览文件 @
9b6928ca
...
...
@@ -38,7 +38,7 @@ interface IDataTreeListTemplateData<T> {
class
DataTreeNodeWrapper
<
T
,
TFilterData
>
implements
ITreeNode
<
T
,
TFilterData
>
{
get
element
():
T
{
return
this
.
node
.
element
.
element
!
;
}
get
element
():
T
{
return
this
.
node
.
element
!
.
element
!
;
}
get
parent
():
ITreeNode
<
T
,
TFilterData
>
|
undefined
{
return
this
.
node
.
parent
&&
new
DataTreeNodeWrapper
(
this
.
node
.
parent
);
}
get
children
():
ITreeNode
<
T
,
TFilterData
>
[]
{
return
this
.
node
.
children
.
map
(
node
=>
new
DataTreeNodeWrapper
(
node
));
}
get
depth
():
number
{
return
this
.
node
.
depth
;
}
...
...
@@ -47,7 +47,7 @@ class DataTreeNodeWrapper<T, TFilterData> implements ITreeNode<T, TFilterData> {
get
visible
():
boolean
{
return
this
.
node
.
visible
;
}
get
filterData
():
TFilterData
|
undefined
{
return
this
.
node
.
filterData
;
}
constructor
(
private
node
:
ITreeNode
<
IDataTreeNode
<
T
>
,
TFilterData
>
)
{
}
constructor
(
private
node
:
ITreeNode
<
IDataTreeNode
<
T
>
|
null
,
TFilterData
>
)
{
}
}
class
DataTreeRenderer
<
T
,
TFilterData
,
TTemplateData
>
implements
ITreeRenderer
<
IDataTreeNode
<
T
>
,
TFilterData
,
IDataTreeListTemplateData
<
TTemplateData
>>
{
...
...
@@ -136,7 +136,7 @@ export class DataTree<T extends NonNullable<any>, TFilterData = void> implements
get
onDidChangeFocus
():
Event
<
ITreeEvent
<
T
>>
{
return
mapEvent
(
this
.
tree
.
onDidChangeFocus
,
asTreeEvent
);
}
get
onDidChangeSelection
():
Event
<
ITreeEvent
<
T
>>
{
return
mapEvent
(
this
.
tree
.
onDidChangeSelection
,
asTreeEvent
);
}
get
onDidChangeCollapseState
():
Event
<
T
>
{
return
mapEvent
(
this
.
tree
.
onDidChangeCollapseState
,
e
=>
e
.
element
.
element
!
);
}
get
onDidChangeCollapseState
():
Event
<
T
>
{
return
mapEvent
(
this
.
tree
.
onDidChangeCollapseState
,
e
=>
e
.
element
!
.
element
!
);
}
private
_onDidResolveChildren
=
new
Emitter
<
IChildrenResolutionEvent
<
T
>>
();
readonly
onDidResolveChildren
:
Event
<
IChildrenResolutionEvent
<
T
>>
=
this
.
_onDidResolveChildren
.
event
;
...
...
@@ -210,8 +210,10 @@ export class DataTree<T extends NonNullable<any>, TFilterData = void> implements
// Tree
getNode
(
element
:
T
|
null
):
ITreeNode
<
T
,
TFilterData
>
{
return
new
DataTreeNodeWrapper
(
this
.
tree
.
getNode
(
this
.
getDataNode
(
element
)));
getNode
(
element
:
T
|
null
):
ITreeNode
<
T
|
null
,
TFilterData
>
{
const
dataNode
=
this
.
getDataNode
(
element
);
const
node
=
this
.
tree
.
getNode
(
dataNode
===
this
.
root
?
null
:
dataNode
);
return
new
DataTreeNodeWrapper
<
T
|
null
,
TFilterData
>
(
node
);
}
collapse
(
element
:
T
):
boolean
{
...
...
@@ -262,7 +264,7 @@ export class DataTree<T extends NonNullable<any>, TFilterData = void> implements
getSelection
():
T
[]
{
const
nodes
=
this
.
tree
.
getSelection
();
return
nodes
.
map
(
n
=>
n
.
element
!
);
return
nodes
.
map
(
n
=>
n
!
.
element
!
);
}
setFocus
(
elements
:
T
[],
browserEvent
?:
UIEvent
):
void
{
...
...
@@ -296,7 +298,7 @@ export class DataTree<T extends NonNullable<any>, TFilterData = void> implements
getFocus
():
T
[]
{
const
nodes
=
this
.
tree
.
getFocus
();
return
nodes
.
map
(
n
=>
n
.
element
!
);
return
nodes
.
map
(
n
=>
n
!
.
element
!
);
}
open
(
elements
:
T
[]):
void
{
...
...
@@ -320,12 +322,14 @@ export class DataTree<T extends NonNullable<any>, TFilterData = void> implements
}
getFirstElementChild
(
element
:
T
|
null
=
null
):
T
|
null
{
const
node
=
this
.
tree
.
getFirstElementChild
(
this
.
getDataNode
(
element
));
const
dataNode
=
this
.
getDataNode
(
element
);
const
node
=
this
.
tree
.
getFirstElementChild
(
dataNode
===
this
.
root
?
null
:
dataNode
);
return
node
&&
node
.
element
;
}
getLastElementAncestor
(
element
:
T
|
null
=
null
):
T
|
null
{
const
node
=
this
.
tree
.
getLastElementAncestor
(
this
.
getDataNode
(
element
));
const
dataNode
=
this
.
getDataNode
(
element
);
const
node
=
this
.
tree
.
getLastElementAncestor
(
dataNode
===
this
.
root
?
null
:
dataNode
);
return
node
&&
node
.
element
;
}
...
...
src/vs/base/browser/ui/tree/objectTree.ts
浏览文件 @
9b6928ca
...
...
@@ -9,7 +9,7 @@ import { ISpliceable } from 'vs/base/common/sequence';
import
{
ITreeNode
,
ITreeModel
,
ITreeElement
}
from
'
vs/base/browser/ui/tree/tree
'
;
import
{
ObjectTreeModel
}
from
'
vs/base/browser/ui/tree/objectTreeModel
'
;
export
class
ObjectTree
<
T
extends
NonNullable
<
any
>
,
TFilterData
=
void
>
extends
AbstractTree
<
T
,
TFilterData
,
T
>
{
export
class
ObjectTree
<
T
extends
NonNullable
<
any
>
,
TFilterData
=
void
>
extends
AbstractTree
<
T
|
null
,
TFilterData
,
T
|
null
>
{
protected
model
:
ObjectTreeModel
<
T
,
TFilterData
>
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录