Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
540cfbd4
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,发现更多精彩内容 >>
提交
540cfbd4
编写于
3月 15, 2017
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
use correct theme
上级
fec6d40d
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
36 addition
and
27 deletion
+36
-27
src/vs/workbench/browser/part.ts
src/vs/workbench/browser/part.ts
+5
-3
src/vs/workbench/common/component.ts
src/vs/workbench/common/component.ts
+12
-8
src/vs/workbench/test/browser/part.test.ts
src/vs/workbench/test/browser/part.test.ts
+1
-15
src/vs/workbench/test/workbenchTestServices.ts
src/vs/workbench/test/workbenchTestServices.ts
+18
-1
未找到文件。
src/vs/workbench/browser/part.ts
浏览文件 @
540cfbd4
...
...
@@ -8,7 +8,7 @@
import
'
vs/css!./media/part
'
;
import
{
Dimension
,
Builder
}
from
'
vs/base/browser/builder
'
;
import
{
WorkbenchComponent
}
from
'
vs/workbench/common/component
'
;
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
IThemeService
,
ITheme
,
ICssStyleCollector
}
from
'
vs/platform/theme/common/themeService
'
;
export
interface
IPartOptions
{
hasTitle
?:
boolean
;
...
...
@@ -32,9 +32,11 @@ export abstract class Part extends WorkbenchComponent {
super
(
id
,
themeService
);
}
protected
onThemeChange
():
void
{
protected
onThemeChange
(
theme
:
ITheme
,
collector
:
ICssStyleCollector
):
void
{
// only call if our create() method has been called
if
(
this
.
parent
)
{
this
.
updateStyles
();
// only call if our create() method has been called
super
.
onThemeChange
(
theme
,
collector
);
}
}
...
...
src/vs/workbench/common/component.ts
浏览文件 @
540cfbd4
...
...
@@ -7,7 +7,7 @@
import
{
IDisposable
,
dispose
,
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
Scope
,
Memento
}
from
'
vs/workbench/common/memento
'
;
import
{
IStorageService
}
from
'
vs/platform/storage/common/storage
'
;
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
IThemeService
,
ITheme
,
ICssStyleCollector
}
from
'
vs/platform/theme/common/themeService
'
;
/**
* Base class of any core/ui component in the workbench. Examples include services, extensions, parts, viewlets and quick open.
...
...
@@ -39,6 +39,7 @@ export class WorkbenchComponent extends Disposable implements IWorkbenchComponen
private
_toUnbind
:
IDisposable
[];
private
id
:
string
;
private
componentMemento
:
Memento
;
private
theme
:
ITheme
;
constructor
(
id
:
string
,
...
...
@@ -49,23 +50,26 @@ export class WorkbenchComponent extends Disposable implements IWorkbenchComponen
this
.
_toUnbind
=
[];
this
.
id
=
id
;
this
.
componentMemento
=
new
Memento
(
this
.
id
);
this
.
theme
=
themeService
.
getTheme
();
// Hook up to theme changes
this
.
toUnbind
.
push
(
this
.
themeService
.
onThemeChange
((
)
=>
this
.
onThemeChange
(
)));
this
.
toUnbind
.
push
(
this
.
themeService
.
onThemeChange
((
theme
,
collector
)
=>
this
.
onThemeChange
(
theme
,
collector
)));
}
protected
getColor
(
id
:
string
):
string
{
return
this
.
themeService
.
getTheme
().
getColor
(
id
).
toString
();
}
protected
onThemeChange
(
theme
:
ITheme
,
collector
:
ICssStyleCollector
):
void
{
this
.
theme
=
theme
;
protected
onThemeChange
():
void
{
this
.
updateStyles
();
this
.
updateStyles
(
collector
);
}
protected
updateStyles
():
void
{
protected
updateStyles
(
collector
:
ICssStyleCollector
):
void
{
// Subclasses to override
}
protected
getColor
(
id
:
string
):
string
{
return
this
.
theme
.
getColor
(
id
).
toString
();
}
protected
get
toUnbind
()
{
return
this
.
_toUnbind
;
}
...
...
src/vs/workbench/test/browser/part.test.ts
浏览文件 @
540cfbd4
...
...
@@ -13,21 +13,7 @@ import { IWorkspaceContextService, WorkspaceContextService } from 'vs/platform/w
import
{
IStorageService
}
from
'
vs/platform/storage/common/storage
'
;
import
{
StorageService
,
InMemoryLocalStorage
}
from
'
vs/platform/storage/common/storageService
'
;
import
{
TestWorkspace
}
from
'
vs/platform/workspace/test/common/testWorkspace
'
;
import
{
IThemeService
,
ITheme
,
IThemingParticipant
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
class
TestThemeService
implements
IThemeService
{
_serviceBrand
:
any
;
getTheme
():
ITheme
{
throw
new
Error
(
'
Method not implemented.
'
);
}
onThemeChange
(
participant
:
IThemingParticipant
):
IDisposable
{
return
{
dispose
:
()
=>
{
}
};
}
}
import
{
TestThemeService
}
from
'
vs/workbench/test/workbenchTestServices
'
;
class
MyPart
extends
Part
{
...
...
src/vs/workbench/test/workbenchTestServices.ts
浏览文件 @
540cfbd4
...
...
@@ -52,6 +52,7 @@ import { RawTextSource, IRawTextSource } from 'vs/editor/common/model/textSource
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
IThemeService
,
ITheme
,
IThemingParticipant
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
Color
}
from
"
vs/base/common/color
"
;
export
function
createFileInput
(
instantiationService
:
IInstantiationService
,
resource
:
URI
):
FileEditorInput
{
return
instantiationService
.
createInstance
(
FileEditorInput
,
resource
,
void
0
);
...
...
@@ -973,12 +974,28 @@ export class TestWindowsService implements IWindowsService {
}
}
export
class
TestTheme
implements
ITheme
{
selector
:
string
;
label
:
string
;
type
:
'
light
'
|
'
dark
'
|
'
hc
'
;
getColor
(
color
:
string
,
useDefault
?:
boolean
):
Color
{
throw
new
Error
(
'
Method not implemented.
'
);
}
isDefault
(
color
:
string
):
boolean
{
throw
new
Error
(
'
Method not implemented.
'
);
}
}
const
testTheme
=
new
TestTheme
();
export
class
TestThemeService
implements
IThemeService
{
_serviceBrand
:
any
;
getTheme
():
ITheme
{
throw
new
Error
(
'
Method not implemented.
'
)
;
return
testTheme
;
}
onThemeChange
(
participant
:
IThemingParticipant
):
IDisposable
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录