Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
b557d59b
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,发现更多精彩内容 >>
提交
b557d59b
编写于
12月 14, 2018
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
tree model: cleanup interface
上级
94ee300f
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
20 addition
and
33 deletion
+20
-33
src/vs/base/browser/ui/tree/abstractTree.ts
src/vs/base/browser/ui/tree/abstractTree.ts
+2
-2
src/vs/base/browser/ui/tree/indexTreeModel.ts
src/vs/base/browser/ui/tree/indexTreeModel.ts
+10
-16
src/vs/base/browser/ui/tree/objectTreeModel.ts
src/vs/base/browser/ui/tree/objectTreeModel.ts
+7
-13
src/vs/base/browser/ui/tree/tree.ts
src/vs/base/browser/ui/tree/tree.ts
+1
-2
未找到文件。
src/vs/base/browser/ui/tree/abstractTree.ts
浏览文件 @
b557d59b
...
...
@@ -321,11 +321,11 @@ export abstract class AbstractTree<T, TFilterData, TRef> implements IDisposable
}
expandAll
():
void
{
this
.
model
.
expandAll
(
);
this
.
model
.
setCollapsed
(
this
.
model
.
rootRef
,
false
,
true
);
}
collapseAll
():
void
{
this
.
model
.
collapseAll
(
);
this
.
model
.
setCollapsed
(
this
.
model
.
rootRef
,
true
,
true
);
}
isCollapsible
(
location
:
TRef
):
boolean
{
...
...
src/vs/base/browser/ui/tree/indexTreeModel.ts
浏览文件 @
b557d59b
...
...
@@ -45,6 +45,8 @@ export interface IIndexTreeModelOptions<T, TFilterData> {
export
class
IndexTreeModel
<
T
extends
Exclude
<
any
,
undefined
>
,
TFilterData
=
void
>
implements
ITreeModel
<
T
,
TFilterData
,
number
[]
>
{
readonly
rootRef
=
[];
private
root
:
IMutableTreeNode
<
T
,
TFilterData
>
;
private
eventBufferer
=
new
EventBufferer
();
// TODO@joao is this really necessary
...
...
@@ -123,6 +125,14 @@ export class IndexTreeModel<T extends Exclude<any, undefined>, TFilterData = voi
return
this
.
getTreeNodeWithListIndex
(
location
).
listIndex
;
}
isCollapsible
(
location
:
number
[]):
boolean
{
return
this
.
getTreeNode
(
location
).
collapsible
;
}
isCollapsed
(
location
:
number
[]):
boolean
{
return
this
.
getTreeNode
(
location
).
collapsed
;
}
setCollapsed
(
location
:
number
[],
collapsed
?:
boolean
,
recursive
=
false
):
boolean
{
const
{
node
,
listIndex
,
revealed
}
=
this
.
getTreeNodeWithListIndex
(
location
);
...
...
@@ -167,22 +177,6 @@ export class IndexTreeModel<T extends Exclude<any, undefined>, TFilterData = voi
return
result
;
}
expandAll
():
void
{
this
.
setCollapsed
([],
false
,
true
);
}
collapseAll
():
void
{
this
.
setCollapsed
([],
true
,
true
);
}
isCollapsible
(
location
:
number
[]):
boolean
{
return
this
.
getTreeNode
(
location
).
collapsible
;
}
isCollapsed
(
location
:
number
[]):
boolean
{
return
this
.
getTreeNode
(
location
).
collapsed
;
}
refilter
():
void
{
const
previousRenderNodeCount
=
this
.
root
.
renderNodeCount
;
const
toInsert
=
this
.
updateNodeAfterFilterChange
(
this
.
root
);
...
...
src/vs/base/browser/ui/tree/objectTreeModel.ts
浏览文件 @
b557d59b
...
...
@@ -13,6 +13,8 @@ export interface IObjectTreeModelOptions<T, TFilterData> extends IIndexTreeModel
export
class
ObjectTreeModel
<
T
extends
NonNullable
<
any
>
,
TFilterData
extends
NonNullable
<
any
>
=
void
>
implements
ITreeModel
<
T
|
null
,
TFilterData
,
T
|
null
>
{
readonly
rootRef
=
null
;
private
model
:
IndexTreeModel
<
T
|
null
,
TFilterData
>
;
private
nodes
=
new
Map
<
T
|
null
,
ITreeNode
<
T
,
TFilterData
>>
();
...
...
@@ -106,19 +108,6 @@ export class ObjectTreeModel<T extends NonNullable<any>, TFilterData extends Non
return
this
.
model
.
getListIndex
(
location
);
}
setCollapsed
(
element
:
T
,
collapsed
:
boolean
):
boolean
{
const
location
=
this
.
getElementLocation
(
element
);
return
this
.
model
.
setCollapsed
(
location
,
collapsed
);
}
expandAll
():
void
{
this
.
model
.
expandAll
();
}
collapseAll
():
void
{
this
.
model
.
collapseAll
();
}
isCollapsible
(
element
:
T
):
boolean
{
const
location
=
this
.
getElementLocation
(
element
);
return
this
.
model
.
isCollapsible
(
location
);
...
...
@@ -129,6 +118,11 @@ export class ObjectTreeModel<T extends NonNullable<any>, TFilterData extends Non
return
this
.
model
.
isCollapsed
(
location
);
}
setCollapsed
(
element
:
T
,
collapsed
:
boolean
):
boolean
{
const
location
=
this
.
getElementLocation
(
element
);
return
this
.
model
.
setCollapsed
(
location
,
collapsed
);
}
refilter
():
void
{
this
.
model
.
refilter
();
}
...
...
src/vs/base/browser/ui/tree/tree.ts
浏览文件 @
b557d59b
...
...
@@ -86,6 +86,7 @@ export interface ITreeNode<T, TFilterData = void> {
}
export
interface
ITreeModel
<
T
,
TFilterData
,
TRef
>
{
readonly
rootRef
:
TRef
;
readonly
onDidChangeCollapseState
:
Event
<
ITreeNode
<
T
,
TFilterData
>>
;
readonly
onDidChangeRenderNodeCount
:
Event
<
ITreeNode
<
T
,
TFilterData
>>
;
...
...
@@ -101,8 +102,6 @@ export interface ITreeModel<T, TFilterData, TRef> {
isCollapsible
(
location
:
TRef
):
boolean
;
isCollapsed
(
location
:
TRef
):
boolean
;
setCollapsed
(
location
:
TRef
,
collapsed
?:
boolean
,
recursive
?:
boolean
):
boolean
;
expandAll
():
void
;
collapseAll
():
void
;
refilter
():
void
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录