Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
d310662a
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,发现更多精彩内容 >>
提交
d310662a
编写于
5月 23, 2017
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
LightUpdateContribution
上级
0722ad47
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
58 addition
and
54 deletion
+58
-54
src/vs/workbench/parts/update/electron-browser/update.contribution.ts
...ench/parts/update/electron-browser/update.contribution.ts
+12
-9
src/vs/workbench/parts/update/electron-browser/update.ts
src/vs/workbench/parts/update/electron-browser/update.ts
+46
-45
未找到文件。
src/vs/workbench/parts/update/electron-browser/update.contribution.ts
浏览文件 @
d310662a
...
...
@@ -19,10 +19,18 @@ import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
import
{
IWorkbenchActionRegistry
,
Extensions
as
ActionExtensions
}
from
'
vs/workbench/common/actionRegistry
'
;
import
{
SyncActionDescriptor
}
from
'
vs/platform/actions/common/actions
'
;
import
{
IConfigurationRegistry
,
Extensions
as
ConfigurationExtensions
}
from
'
vs/platform/configuration/common/configurationRegistry
'
;
import
{
ShowCurrentReleaseNotesAction
,
UpdateContribution
,
UpdateContribution2
}
from
'
./update
'
;
import
{
ShowCurrentReleaseNotesAction
,
ProductContribution
,
UpdateContribution
,
LightUpdateContribution
}
from
'
./update
'
;
Registry
.
as
<
IWorkbenchContributionsRegistry
>
(
WorkbenchExtensions
.
Workbench
)
.
registerWorkbenchContribution
(
UpdateContribution
);
.
registerWorkbenchContribution
(
ProductContribution
);
if
(
isMacintosh
)
{
Registry
.
as
<
IGlobalActivityRegistry
>
(
GlobalActivityExtensions
)
.
registerActivity
(
LightUpdateContribution
);
}
else
{
Registry
.
as
<
IWorkbenchContributionsRegistry
>
(
WorkbenchExtensions
.
Workbench
)
.
registerWorkbenchContribution
(
UpdateContribution
);
}
// Editor
const
editorDescriptor
=
new
EditorDescriptor
(
...
...
@@ -35,13 +43,8 @@ const editorDescriptor = new EditorDescriptor(
Registry
.
as
<
IEditorRegistry
>
(
EditorExtensions
.
Editors
)
.
registerEditor
(
editorDescriptor
,
[
new
SyncDescriptor
(
ReleaseNotesInput
)]);
if
(
isMacintosh
)
{
Registry
.
as
<
IGlobalActivityRegistry
>
(
GlobalActivityExtensions
)
.
registerActivity
(
UpdateContribution2
);
}
else
{
Registry
.
as
<
IWorkbenchActionRegistry
>
(
ActionExtensions
.
WorkbenchActions
)
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
ShowCurrentReleaseNotesAction
,
ShowCurrentReleaseNotesAction
.
ID
,
ShowCurrentReleaseNotesAction
.
LABEL
),
'
Open Release Notes
'
);
}
Registry
.
as
<
IWorkbenchActionRegistry
>
(
ActionExtensions
.
WorkbenchActions
)
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
ShowCurrentReleaseNotesAction
,
ShowCurrentReleaseNotesAction
.
ID
,
ShowCurrentReleaseNotesAction
.
LABEL
),
'
Open Release Notes
'
);
// Configuration: Update
const
configurationRegistry
=
<
IConfigurationRegistry
>
Registry
.
as
(
ConfigurationExtensions
.
Configuration
);
...
...
src/vs/workbench/parts/update/electron-browser/update.ts
浏览文件 @
d310662a
...
...
@@ -23,9 +23,10 @@ import { asText } from 'vs/base/node/request';
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
KeybindingIO
}
from
'
vs/workbench/services/keybinding/common/keybindingIO
'
;
import
{
IOpenerService
}
from
'
vs/platform/opener/common/opener
'
;
import
{
ICommandService
}
from
'
vs/platform/commands/common/commands
'
;
import
{
IWorkbenchContribution
}
from
'
vs/workbench/common/contributions
'
;
import
{
IStorageService
,
StorageScope
}
from
'
vs/platform/storage/common/storage
'
;
import
{
IUpdateService
}
from
'
vs/platform/update/common/update
'
;
import
{
IUpdateService
,
State
as
UpdateState
}
from
'
vs/platform/update/common/update
'
;
import
*
as
semver
from
'
semver
'
;
import
{
OS
}
from
'
vs/base/common/platform
'
;
...
...
@@ -191,24 +192,22 @@ const LinkAction = (id: string, message: string, licenseUrl: string) => new Acti
()
=>
{
window
.
open
(
licenseUrl
);
return
TPromise
.
as
(
null
);
}
);
export
class
Update
Contribution
implements
IWorkbenchContribution
{
export
class
Product
Contribution
implements
IWorkbenchContribution
{
private
static
KEY
=
'
releaseNotes/lastVersion
'
;
getId
()
{
return
'
vs.
update
'
;
}
getId
()
{
return
'
vs.
product
'
;
}
constructor
(
@
IStorageService
storageService
:
IStorageService
,
@
IInstantiationService
instantiationService
:
IInstantiationService
,
@
IMessageService
messageService
:
IMessageService
,
@
IUpdateService
updateService
:
IUpdateService
,
@
IWorkbenchEditorService
editorService
:
IWorkbenchEditorService
)
{
const
lastVersion
=
storageService
.
get
(
Update
Contribution
.
KEY
,
StorageScope
.
GLOBAL
,
''
);
const
lastVersion
=
storageService
.
get
(
Product
Contribution
.
KEY
,
StorageScope
.
GLOBAL
,
''
);
// was there an update?
// was there an update?
if so, open release notes
if
(
product
.
releaseNotesUrl
&&
lastVersion
&&
pkg
.
version
!==
lastVersion
)
{
instantiationService
.
invokeFunction
(
loadReleaseNotes
,
pkg
.
version
)
.
then
(
instantiationService
.
invokeFunction
(
loadReleaseNotes
,
pkg
.
version
).
then
(
text
=>
editorService
.
openEditor
(
instantiationService
.
createInstance
(
ReleaseNotesInput
,
pkg
.
version
,
text
),
{
pinned
:
true
}),
()
=>
{
messageService
.
show
(
Severity
.
Info
,
{
...
...
@@ -232,8 +231,19 @@ export class UpdateContribution implements IWorkbenchContribution {
});
}
storageService
.
store
(
UpdateContribution
.
KEY
,
pkg
.
version
,
StorageScope
.
GLOBAL
);
storageService
.
store
(
ProductContribution
.
KEY
,
pkg
.
version
,
StorageScope
.
GLOBAL
);
}
}
export
class
UpdateContribution
implements
IWorkbenchContribution
{
getId
()
{
return
'
vs.update
'
;
}
constructor
(
@
IInstantiationService
instantiationService
:
IInstantiationService
,
@
IMessageService
messageService
:
IMessageService
,
@
IUpdateService
updateService
:
IUpdateService
)
{
updateService
.
onUpdateReady
(
update
=>
{
const
applyUpdateAction
=
instantiationService
.
createInstance
(
ApplyUpdateAction
);
const
releaseNotesAction
=
instantiationService
.
createInstance
(
ShowReleaseNotesAction
,
false
,
update
.
version
);
...
...
@@ -266,7 +276,7 @@ export class UpdateContribution implements IWorkbenchContribution {
}
}
export
class
UpdateContribution2
implements
IGlobalActivity
{
export
class
LightUpdateContribution
implements
IGlobalActivity
{
get
id
()
{
return
'
vs.update
'
;
}
get
name
()
{
return
'
VS Code
'
;
}
...
...
@@ -274,50 +284,41 @@ export class UpdateContribution2 implements IGlobalActivity {
constructor
(
@
IStorageService
storageService
:
IStorageService
,
@
ICommandService
private
commandService
:
ICommandService
,
@
IInstantiationService
instantiationService
:
IInstantiationService
,
@
IMessageService
messageService
:
IMessageService
,
@
IUpdateService
updateService
:
IUpdateService
,
@
IUpdateService
private
updateService
:
IUpdateService
,
@
IWorkbenchEditorService
editorService
:
IWorkbenchEditorService
,
@
IActivityBarService
activityBarService
:
IActivityBarService
)
{
// updateService.onUpdateReady(update => {
// const applyUpdateAction = instantiationService.createInstance(ApplyUpdateAction);
// const releaseNotesAction = instantiationService.createInstance(ShowReleaseNotesAction, false, update.version);
// messageService.show(severity.Info, {
// message: nls.localize('updateAvailable', "{0} will be updated after it restarts.", product.nameLong),
// actions: [applyUpdateAction, NotNowAction, releaseNotesAction]
// });
// });
// updateService.onUpdateAvailable(update => {
setTimeout
(()
=>
{
const
badge
=
new
DotBadge
(()
=>
'
UPDATE AVAILABLE
'
);
this
.
updateService
.
onUpdateReady
(()
=>
{
const
badge
=
new
DotBadge
(()
=>
nls
.
localize
(
'
updateIsReady
'
,
"
New update available.
"
));
activityBarService
.
showGlobalActivity
(
this
.
id
,
badge
);
},
0
);
// });
// updateService.onUpdateNotAvailable(explicit => {
// if (!explicit) {
// return;
// }
// messageService.show(severity.Info, nls.localize('noUpdatesAvailable', "There are no updates currently available."));
// });
});
updateService
.
onError
(
err
=>
messageService
.
show
(
severity
.
Error
,
err
));
this
.
updateService
.
onError
(
err
=>
messageService
.
show
(
severity
.
Error
,
err
));
}
getActions
():
IAction
[]
{
return
[
new
Action
(
'
foo
'
,
'
FOO
'
),
new
Action
(
'
bar
'
,
'
BAR
'
),
new
Action
(
'
foo
'
,
'
FOO
'
),
new
Action
(
'
bar
'
,
'
BAR
'
),
new
Action
(
'
foo
'
,
'
FOO
'
),
new
Action
(
'
bar
'
,
'
BAR
'
),
new
Action
(
'
foo
'
,
'
FOO
'
),
new
Action
(
'
bar
'
,
'
BAR
'
)
];
switch
(
this
.
updateService
.
state
)
{
case
UpdateState
.
Uninitialized
:
return
[
new
Action
(
'
update.notavailable
'
,
nls
.
localize
(
'
not available
'
,
"
Updates Not Available
"
),
undefined
,
false
)];
case
UpdateState
.
CheckingForUpdate
:
return
[
new
Action
(
'
update.checking
'
,
nls
.
localize
(
'
checkingForUpdates
'
,
"
Checking For Updates...
"
),
undefined
,
false
)];
case
UpdateState
.
UpdateAvailable
:
return
[
new
Action
(
'
update.installing
'
,
nls
.
localize
(
'
installingUpdate
'
,
"
Installing Update...
"
),
undefined
,
false
)];
case
UpdateState
.
UpdateDownloaded
:
return
[
new
Action
(
'
update.restart
'
,
nls
.
localize
(
'
restartToUpdate
'
,
"
Restart To Update...
"
),
undefined
,
true
,
()
=>
this
.
updateService
.
quitAndInstall
()
)];
default
:
return
[
new
Action
(
'
update.check
'
,
nls
.
localize
(
'
checkForUpdates
'
,
"
Check For Updates...
"
),
undefined
,
this
.
updateService
.
state
===
UpdateState
.
Idle
,
()
=>
this
.
updateService
.
checkForUpdates
(
true
)
)];
}
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录