Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
c4db36ea
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 搜索 >>
提交
c4db36ea
编写于
1月 17, 2017
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
viewlet progress shows progress bar and activity badge
上级
aa522145
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
56 addition
and
51 deletion
+56
-51
src/vs/platform/progress/common/progress.ts
src/vs/platform/progress/common/progress.ts
+2
-0
src/vs/workbench/browser/parts/compositePart.ts
src/vs/workbench/browser/parts/compositePart.ts
+4
-0
src/vs/workbench/browser/parts/sidebar/sidebarPart.ts
src/vs/workbench/browser/parts/sidebar/sidebarPart.ts
+1
-10
src/vs/workbench/services/progress/browser/progressService2.ts
...s/workbench/services/progress/browser/progressService2.ts
+28
-35
src/vs/workbench/services/viewlet/browser/viewlet.ts
src/vs/workbench/services/viewlet/browser/viewlet.ts
+7
-1
src/vs/workbench/services/viewlet/browser/viewletService.ts
src/vs/workbench/services/viewlet/browser/viewletService.ts
+9
-4
src/vs/workbench/test/browser/services.test.ts
src/vs/workbench/test/browser/services.test.ts
+5
-1
未找到文件。
src/vs/platform/progress/common/progress.ts
浏览文件 @
c4db36ea
...
...
@@ -35,6 +35,8 @@ export interface IProgress<T> {
report
(
item
:
T
):
void
;
}
export
const
emptyProgress
:
IProgress
<
any
>
=
Object
.
freeze
({
report
()
{
}
});
export
class
Progress
<
T
>
implements
IProgress
<
T
>
{
private
_callback
:
()
=>
void
;
...
...
src/vs/workbench/browser/parts/compositePart.ts
浏览文件 @
c4db36ea
...
...
@@ -464,6 +464,10 @@ export abstract class CompositePart<T extends Composite> extends Part {
this
.
messageService
.
show
(
Severity
.
Error
,
types
.
isString
(
error
)
?
new
Error
(
error
)
:
error
);
}
public
getProgressIndicator
(
id
:
string
):
IProgressService
{
return
this
.
mapProgressServiceToComposite
[
id
];
}
protected
getActions
():
IAction
[]
{
return
[];
}
...
...
src/vs/workbench/browser/parts/sidebar/sidebarPart.ts
浏览文件 @
c4db36ea
...
...
@@ -25,16 +25,7 @@ import { KeyMod, KeyCode } from 'vs/base/common/keyCodes';
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
Event
from
'
vs/base/common/event
'
;
export
interface
ISidebar
{
onDidViewletOpen
:
Event
<
IViewlet
>
;
onDidViewletClose
:
Event
<
IViewlet
>
;
openViewlet
(
id
:
string
,
focus
?:
boolean
):
TPromise
<
IViewlet
>
;
getActiveViewlet
():
IViewlet
;
getLastActiveViewletId
():
string
;
hideActiveViewlet
():
TPromise
<
void
>
;
}
export
class
SidebarPart
extends
CompositePart
<
Viewlet
>
implements
ISidebar
{
export
class
SidebarPart
extends
CompositePart
<
Viewlet
>
{
public
static
activeViewletSettingsKey
=
'
workbench.sidebar.activeviewletid
'
;
...
...
src/vs/workbench/services/progress/browser/progressService2.ts
浏览文件 @
c4db36ea
...
...
@@ -5,39 +5,16 @@
'
use strict
'
;
import
'
vs/css!vs/workbench/services/progress/browser/media/progressService2
'
;
import
{
always
}
from
'
vs/base/common/async
'
;
import
*
as
dom
from
'
vs/base/browser/dom
'
;
import
{
IActivityBarService
,
ProgressBadge
}
from
'
vs/workbench/services/activity/common/activityBarService
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
Registry
}
from
'
vs/platform/platform
'
;
import
{
I
ProgressService2
,
IProgress
,
Progress
}
from
'
vs/platform/progress/common/progress
'
;
import
{
IProgressService2
,
IProgress
,
Progress
,
emptyProgress
}
from
'
vs/platform/progress/common/progress
'
;
import
{
I
ViewletService
}
from
'
vs/workbench/services/viewlet/browser/viewlet
'
;
import
{
OcticonLabel
}
from
'
vs/base/browser/ui/octiconLabel/octiconLabel
'
;
import
{
Registry
}
from
'
vs/platform/platform
'
;
import
{
StatusbarAlignment
,
IStatusbarRegistry
,
StatusbarItemDescriptor
,
Extensions
,
IStatusbarItem
}
from
'
vs/workbench/browser/parts/statusbar/statusbar
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IActivityBarService
,
ProgressBadge
}
from
'
vs/workbench/services/activity/common/activityBarService
'
;
import
*
as
dom
from
'
vs/base/browser/dom
'
;
class
ActivityBarProgress
implements
IProgress
<
number
>
{
private
_handle
:
IDisposable
;
constructor
(
private
_activityBar
:
IActivityBarService
,
private
_viewletId
:
string
)
{
}
dispose
():
void
{
if
(
this
.
_handle
)
{
this
.
_handle
.
dispose
();
this
.
_handle
=
undefined
;
}
}
report
(
n
:
number
):
void
{
if
(
!
this
.
_handle
)
{
this
.
_handle
=
this
.
_activityBar
.
showActivity
(
this
.
_viewletId
,
new
ProgressBadge
(()
=>
'
...
'
),
'
progress-badge
'
);
}
}
}
import
{
always
}
from
'
vs/base/common/async
'
;
class
WindowProgressItem
implements
IStatusbarItem
{
...
...
@@ -79,7 +56,8 @@ export class ProgressService2 implements IProgressService2 {
private
_stack
:
Progress
<
string
>
[]
=
[];
constructor
(
@
IActivityBarService
private
_activityBar
:
IActivityBarService
@
IActivityBarService
private
_activityBar
:
IActivityBarService
,
@
IViewletService
private
_viewletService
:
IViewletService
)
{
//
}
...
...
@@ -98,11 +76,6 @@ export class ProgressService2 implements IProgressService2 {
});
}
withViewletProgress
(
viewletId
:
string
,
task
:
(
progress
:
IProgress
<
number
>
)
=>
TPromise
<
any
>
):
void
{
const
progress
=
new
ActivityBarProgress
(
this
.
_activityBar
,
viewletId
);
always
(
task
(
progress
),
()
=>
progress
.
dispose
());
}
private
_updateProgress
()
{
if
(
this
.
_stack
.
length
===
0
)
{
WindowProgressItem
.
Instance
.
hide
();
...
...
@@ -111,6 +84,26 @@ export class ProgressService2 implements IProgressService2 {
WindowProgressItem
.
Instance
.
text
=
this
.
_stack
[
0
].
value
;
}
}
withViewletProgress
(
viewletId
:
string
,
task
:
(
progress
:
IProgress
<
number
>
)
=>
TPromise
<
any
>
):
void
{
const
promise
=
task
(
emptyProgress
);
// show in viewlet
const
viewletProgress
=
this
.
_viewletService
.
getProgressIndicator
(
viewletId
);
viewletProgress
.
showWhile
(
promise
);
// show activity bar
const
activityProgress
=
this
.
_activityBar
.
showActivity
(
viewletId
,
new
ProgressBadge
(()
=>
'
...
'
),
'
progress-badge
'
);
always
(
promise
,
()
=>
{
activityProgress
.
dispose
();
});
}
}
...
...
src/vs/workbench/services/viewlet/browser/viewlet.ts
浏览文件 @
c4db36ea
...
...
@@ -9,6 +9,7 @@ import { IViewlet } from 'vs/workbench/common/viewlet';
import
{
createDecorator
,
ServiceIdentifier
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
Event
from
'
vs/base/common/event
'
;
import
{
ViewletDescriptor
}
from
'
vs/workbench/browser/viewlet
'
;
import
{
IProgressService
}
from
'
vs/platform/progress/common/progress
'
;
export
const
IViewletService
=
createDecorator
<
IViewletService
>
(
'
viewletService
'
);
...
...
@@ -42,4 +43,9 @@ export interface IViewletService {
* Returns all registered viewlets
*/
getViewlets
():
ViewletDescriptor
[];
/**
*
*/
getProgressIndicator
(
id
:
string
):
IProgressService
;
}
src/vs/workbench/services/viewlet/browser/viewletService.ts
浏览文件 @
c4db36ea
...
...
@@ -8,16 +8,17 @@ import { TPromise, ValueCallback } from 'vs/base/common/winjs.base';
import
{
IViewlet
}
from
'
vs/workbench/common/viewlet
'
;
import
{
IViewletService
}
from
'
vs/workbench/services/viewlet/browser/viewlet
'
;
import
Event
from
'
vs/base/common/event
'
;
import
{
ISidebar
}
from
'
vs/workbench/browser/parts/sidebar/sidebarPart
'
;
import
{
SidebarPart
}
from
'
vs/workbench/browser/parts/sidebar/sidebarPart
'
;
import
{
Registry
}
from
'
vs/platform/platform
'
;
import
{
ViewletDescriptor
,
ViewletRegistry
,
Extensions
as
ViewletExtensions
}
from
'
vs/workbench/browser/viewlet
'
;
import
{
IExtensionService
}
from
'
vs/platform/extensions/common/extensions
'
;
import
{
IProgressService
}
from
'
vs/platform/progress/common/progress
'
;
export
class
ViewletService
implements
IViewletService
{
public
_serviceBrand
:
any
;
private
sidebarPart
:
ISidebar
;
private
sidebarPart
:
SidebarPart
;
private
viewletRegistry
:
ViewletRegistry
;
private
extensionViewlets
:
ViewletDescriptor
[];
...
...
@@ -28,7 +29,7 @@ export class ViewletService implements IViewletService {
public
get
onDidViewletClose
():
Event
<
IViewlet
>
{
return
this
.
sidebarPart
.
onDidViewletClose
;
};
constructor
(
sidebarPart
:
ISidebar
,
sidebarPart
:
SidebarPart
,
@
IExtensionService
private
extensionService
:
IExtensionService
)
{
this
.
sidebarPart
=
sidebarPart
;
...
...
@@ -99,4 +100,8 @@ export class ViewletService implements IViewletService {
public
getViewlet
(
id
:
string
):
ViewletDescriptor
{
return
this
.
getViewlets
().
filter
(
viewlet
=>
viewlet
.
id
===
id
)[
0
];
}
public
getProgressIndicator
(
id
:
string
):
IProgressService
{
return
this
.
sidebarPart
.
getProgressIndicator
(
id
);
}
}
src/vs/workbench/test/browser/services.test.ts
浏览文件 @
c4db36ea
...
...
@@ -126,6 +126,10 @@ class TestViewletService implements IViewletService {
public
getViewlet
(
id
:
string
):
ViewletDescriptor
{
return
null
;
}
public
getProgressIndicator
(
id
:
string
)
{
return
null
;
}
}
class
TestPanelService
implements
IPanelService
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录