Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
6f4de8b5
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,发现更多精彩内容 >>
提交
6f4de8b5
编写于
10月 04, 2016
作者:
P
Pine Wu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove isChildrenResolved from ITreeNode
上级
10af4d75
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
30 addition
and
29 deletion
+30
-29
src/vs/vscode.d.ts
src/vs/vscode.d.ts
+0
-1
src/vs/workbench/api/node/extHostExplorers.ts
src/vs/workbench/api/node/extHostExplorers.ts
+1
-1
src/vs/workbench/api/node/mainThreadExplorers.ts
src/vs/workbench/api/node/mainThreadExplorers.ts
+2
-1
src/vs/workbench/parts/explorers/browser/views/treeView.ts
src/vs/workbench/parts/explorers/browser/views/treeView.ts
+2
-4
src/vs/workbench/parts/explorers/browser/views/treeViewer.ts
src/vs/workbench/parts/explorers/browser/views/treeViewer.ts
+10
-14
src/vs/workbench/parts/explorers/common/treeViewModel.ts
src/vs/workbench/parts/explorers/common/treeViewModel.ts
+15
-8
未找到文件。
src/vs/vscode.d.ts
浏览文件 @
6f4de8b5
...
...
@@ -1357,7 +1357,6 @@ declare module 'vscode' {
label
:
string
;
isExpanded
:
boolean
;
children
:
ITreeNode
[];
isChildrenResolved
:
boolean
;
}
/**
...
...
src/vs/workbench/api/node/extHostExplorers.ts
浏览文件 @
6f4de8b5
...
...
@@ -25,7 +25,7 @@ export class ExtHostExplorers extends ExtHostExplorersShape {
this
.
_treeContentProviders
=
Object
.
create
(
null
);
}
public
registerTreeContentProvider
(
providerId
:
string
,
provider
:
vscode
.
TreeContentProvider
):
vscode
.
Disposable
{
registerTreeContentProvider
(
providerId
:
string
,
provider
:
vscode
.
TreeContentProvider
):
vscode
.
Disposable
{
this
.
_proxy
.
$registerTreeContentProvider
(
providerId
);
this
.
_treeContentProviders
[
providerId
]
=
provider
;
...
...
src/vs/workbench/api/node/mainThreadExplorers.ts
浏览文件 @
6f4de8b5
...
...
@@ -4,11 +4,12 @@
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
ITreeNode
}
from
'
vscode
'
;
import
{
ITreeNode
}
from
'
vscode
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IThreadService
}
from
'
vs/workbench/services/thread/common/threadService
'
;
import
{
ExtHostContext
,
MainThreadExplorersShape
,
ExtHostExplorersShape
}
from
'
./extHost.protocol
'
;
import
{
ITreeExplorerViewletService
}
from
'
vs/workbench/parts/explorers/browser/treeExplorerViewletService
'
;
import
{
TreeViewNode
}
from
'
vs/workbench/parts/explorers/common/treeViewModel
'
;
export
class
MainThreadExplorers
extends
MainThreadExplorersShape
{
private
_proxy
:
ExtHostExplorersShape
;
...
...
src/vs/workbench/parts/explorers/browser/views/treeView.ts
浏览文件 @
6f4de8b5
...
...
@@ -68,9 +68,7 @@ export class TreeView extends CollapsibleViewletView {
DOM
.
addClass
(
this
.
treeContainer
,
'
tree-explorer-viewlet-tree-view
'
);
this
.
tree
=
this
.
createViewer
(
$
(
this
.
treeContainer
));
this
.
treeExplorerViewletService
.
provideTreeContent
(
'
pineTree
'
).
then
(
tree
=>
{
this
.
tree
.
setInput
(
tree
);
});
this
.
updateInput
();
}
getActions
():
IAction
[]
{
...
...
@@ -109,7 +107,7 @@ export class TreeView extends CollapsibleViewletView {
private
updateInput
():
TPromise
<
void
>
{
return
this
.
treeExplorerViewletService
.
provideTreeContent
(
'
pineTree
'
).
then
(
tree
=>
{
this
.
tree
.
setInput
(
tree
);
this
.
tree
.
setInput
(
TreeViewNode
.
create
(
tree
)
);
})
}
...
...
src/vs/workbench/parts/explorers/browser/views/treeViewer.ts
浏览文件 @
6f4de8b5
...
...
@@ -26,25 +26,21 @@ export class TreeDataSource implements IDataSource {
}
public
getId
(
tree
:
ITree
,
node
:
vscode
.
ITree
Node
):
string
{
return
node
.
label
;
getId
(
tree
:
ITree
,
node
:
TreeView
Node
):
string
{
return
node
.
id
.
toString
()
;
}
public
hasChildren
(
tree
:
ITree
,
node
:
vscode
.
ITreeNode
):
boolean
{
if
(
node
.
isChildrenResolved
)
{
return
node
.
children
&&
node
.
children
.
length
>
0
;
}
else
{
return
true
;
}
hasChildren
(
tree
:
ITree
,
node
:
TreeViewNode
):
boolean
{
return
node
.
hasChildren
;
}
public
getChildren
(
tree
:
ITree
,
node
:
vscode
.
ITreeNode
):
TPromise
<
vscode
.
ITree
Node
[]
>
{
getChildren
(
tree
:
ITree
,
node
:
TreeViewNode
):
TPromise
<
TreeView
Node
[]
>
{
if
(
node
.
isChildrenResolved
)
{
return
TPromise
.
as
(
node
.
children
);
}
else
{
return
this
.
treeExplorerViewletService
.
resolveChildren
(
providerId
,
node
).
then
(
children
=>
{
children
.
forEach
(
child
=>
{
node
.
children
.
push
(
child
);
node
.
children
.
push
(
TreeViewNode
.
create
(
child
)
);
});
node
.
isChildrenResolved
=
true
;
return
node
.
children
;
...
...
@@ -52,7 +48,7 @@ export class TreeDataSource implements IDataSource {
}
}
public
getParent
(
tree
:
ITree
,
node
:
TreeViewNode
):
TPromise
<
TreeViewNode
>
{
getParent
(
tree
:
ITree
,
node
:
TreeViewNode
):
TPromise
<
TreeViewNode
>
{
return
TPromise
.
as
(
null
);
}
}
...
...
@@ -73,11 +69,11 @@ export class TreeRenderer extends ActionsRenderer implements IRenderer {
});
}
public
getContentHeight
(
tree
:
ITree
,
element
:
any
):
number
{
getContentHeight
(
tree
:
ITree
,
element
:
any
):
number
{
return
22
;
}
public
renderContents
(
tree
:
ITree
,
node
:
TreeViewNode
,
domElement
:
HTMLElement
,
previousCleanupFn
:
IElementCallback
):
IElementCallback
{
renderContents
(
tree
:
ITree
,
node
:
TreeViewNode
,
domElement
:
HTMLElement
,
previousCleanupFn
:
IElementCallback
):
IElementCallback
{
const
el
=
$
(
domElement
).
clearChildren
();
const
item
=
$
(
'
.custom-viewlet-tree-node-item
'
);
item
.
appendTo
(
el
);
...
...
@@ -100,7 +96,7 @@ export class TreeController extends DefaultController {
// super({ clickBehavior: ClickBehavior.ON_MOUSE_UP /* do not change to not break DND */ });
}
public
onLeftClick
(
tree
:
ITree
,
node
:
TreeViewNode
,
event
:
IMouseEvent
,
origin
:
string
=
'
mouse
'
):
boolean
{
onLeftClick
(
tree
:
ITree
,
node
:
TreeViewNode
,
event
:
IMouseEvent
,
origin
:
string
=
'
mouse
'
):
boolean
{
super
.
onLeftClick
(
tree
,
node
,
event
,
origin
);
return
true
;
...
...
src/vs/workbench/parts/explorers/common/treeViewModel.ts
浏览文件 @
6f4de8b5
export
class
TreeViewNode
implements
vscode
.
ITreeNode
{
import
{
ITreeNode
}
from
'
vscode
'
;
export
class
TreeViewNode
implements
ITreeNode
{
static
idCounter
=
1
;
id
:
number
;
hasChildren
:
boolean
=
true
;
isChildrenResolved
:
boolean
=
false
;
constructor
(
public
id
:
number
,
public
label
:
string
,
public
isExpanded
:
boolean
=
true
,
public
parent
:
TreeViewNode
=
null
,
public
children
:
TreeViewNode
[]
=
[],
public
isChildrenResolved
:
boolean
=
true
)
{
public
children
:
TreeViewNode
[]
=
[]
)
{
this
.
id
=
TreeViewNode
.
idCounter
++
;
}
addChild
(
child
:
TreeViewNode
)
{
this
.
children
.
push
(
child
);
child
.
parent
=
this
;
public
static
create
(
node
:
ITreeNode
):
TreeViewNode
{
const
children
=
node
.
children
.
map
(
TreeViewNode
.
create
);
return
new
TreeViewNode
(
node
.
label
,
node
.
isExpanded
,
children
)
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录