Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
0337567d
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,发现更多精彩内容 >>
提交
0337567d
编写于
6月 12, 2019
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
差异文件
Merge commit 'refs/pull/75300/head' of github.com:Microsoft/vscode into pr/75300
上级
4a3c056e
8a71ad8a
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
202 addition
and
177 deletion
+202
-177
src/vs/platform/actions/common/actions.ts
src/vs/platform/actions/common/actions.ts
+2
-1
src/vs/workbench/browser/parts/activitybar/activitybarActions.ts
...workbench/browser/parts/activitybar/activitybarActions.ts
+18
-18
src/vs/workbench/browser/parts/activitybar/activitybarPart.ts
...vs/workbench/browser/parts/activitybar/activitybarPart.ts
+21
-31
src/vs/workbench/browser/parts/activitybar/media/activitybarpart.css
...bench/browser/parts/activitybar/media/activitybarpart.css
+4
-0
src/vs/workbench/browser/parts/activitybar/media/update.svg
src/vs/workbench/browser/parts/activitybar/media/update.svg
+0
-0
src/vs/workbench/common/activity.ts
src/vs/workbench/common/activity.ts
+1
-32
src/vs/workbench/contrib/extensions/electron-browser/extensions.contribution.ts
...ib/extensions/electron-browser/extensions.contribution.ts
+9
-0
src/vs/workbench/contrib/preferences/browser/preferences.contribution.ts
...h/contrib/preferences/browser/preferences.contribution.ts
+27
-0
src/vs/workbench/contrib/quickopen/browser/quickopen.contribution.ts
...bench/contrib/quickopen/browser/quickopen.contribution.ts
+9
-0
src/vs/workbench/contrib/snippets/browser/configureSnippets.ts
...s/workbench/contrib/snippets/browser/configureSnippets.ts
+9
-0
src/vs/workbench/contrib/themes/browser/themes.contribution.ts
...s/workbench/contrib/themes/browser/themes.contribution.ts
+18
-0
src/vs/workbench/contrib/update/electron-browser/media/update.contribution.css
...rib/update/electron-browser/media/update.contribution.css
+0
-8
src/vs/workbench/contrib/update/electron-browser/update.contribution.ts
...ch/contrib/update/electron-browser/update.contribution.ts
+1
-4
src/vs/workbench/contrib/update/electron-browser/update.ts
src/vs/workbench/contrib/update/electron-browser/update.ts
+83
-83
未找到文件。
src/vs/platform/actions/common/actions.ts
浏览文件 @
0337567d
...
...
@@ -98,7 +98,8 @@ export const enum MenuId {
CommentThreadTitle
,
CommentThreadActions
,
CommentTitle
,
CommentActions
CommentActions
,
GlobalActivity
}
export
interface
IMenuActionOptions
{
...
...
src/vs/workbench/browser/parts/activitybar/activitybarActions.ts
浏览文件 @
0337567d
...
...
@@ -8,11 +8,11 @@ import * as nls from 'vs/nls';
import
*
as
DOM
from
'
vs/base/browser/dom
'
;
import
{
StandardKeyboardEvent
}
from
'
vs/base/browser/keyboardEvent
'
;
import
{
EventType
as
TouchEventType
,
GestureEvent
}
from
'
vs/base/browser/touch
'
;
import
{
Action
}
from
'
vs/base/common/actions
'
;
import
{
Action
,
IAction
}
from
'
vs/base/common/actions
'
;
import
{
KeyCode
}
from
'
vs/base/common/keyCodes
'
;
import
{
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
SyncActionDescriptor
}
from
'
vs/platform/actions/common/actions
'
;
import
{
SyncActionDescriptor
,
IMenuService
,
MenuId
}
from
'
vs/platform/actions/common/actions
'
;
import
{
IContextMenuService
}
from
'
vs/platform/contextview/browser/contextView
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
...
...
@@ -21,11 +21,13 @@ import { ICssStyleCollector, ITheme, IThemeService, registerThemingParticipant }
import
{
ActivityAction
,
ActivityActionViewItem
,
ICompositeBar
,
ICompositeBarColors
,
ToggleCompositePinnedAction
}
from
'
vs/workbench/browser/parts/compositeBarActions
'
;
import
{
ViewletDescriptor
}
from
'
vs/workbench/browser/viewlet
'
;
import
{
Extensions
as
ActionExtensions
,
IWorkbenchActionRegistry
}
from
'
vs/workbench/common/actions
'
;
import
{
IActivity
,
IGlobalActivity
}
from
'
vs/workbench/common/activity
'
;
import
{
IActivity
}
from
'
vs/workbench/common/activity
'
;
import
{
ACTIVITY_BAR_FOREGROUND
}
from
'
vs/workbench/common/theme
'
;
import
{
IActivityBarService
}
from
'
vs/workbench/services/activityBar/browser/activityBarService
'
;
import
{
IWorkbenchLayoutService
,
Parts
}
from
'
vs/workbench/services/layout/browser/layoutService
'
;
import
{
IViewletService
}
from
'
vs/workbench/services/viewlet/browser/viewlet
'
;
import
{
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
fillInActionBarActions
}
from
'
vs/platform/actions/browser/menuEntryActionViewItem
'
;
export
class
ViewletActivityAction
extends
ActivityAction
{
...
...
@@ -104,20 +106,15 @@ export class ToggleViewletAction extends Action {
}
}
export
class
GlobalActivityAction
extends
ActivityAction
{
constructor
(
activity
:
IGlobalActivity
)
{
super
(
activity
);
}
}
export
class
GlobalActivityActionViewItem
extends
ActivityActionViewItem
{
constructor
(
action
:
Global
ActivityAction
,
action
:
ActivityAction
,
colors
:
(
theme
:
ITheme
)
=>
ICompositeBarColors
,
@
IThemeService
themeService
:
IThemeService
,
@
IContextMenuService
protected
contextMenuService
:
IContextMenuService
@
IMenuService
private
readonly
menuService
:
IMenuService
,
@
IContextMenuService
protected
contextMenuService
:
IContextMenuService
,
@
IContextKeyService
private
readonly
contextKeyService
:
IContextKeyService
,
)
{
super
(
action
,
{
draggable
:
false
,
colors
,
icon
:
true
},
themeService
);
}
...
...
@@ -148,16 +145,19 @@ export class GlobalActivityActionViewItem extends ActivityActionViewItem {
}
private
showContextMenu
():
void
{
const
globalAction
=
this
.
_action
as
GlobalActivityAction
;
const
activity
=
globalAction
.
activity
as
IGlobalActivity
;
const
actions
=
activity
.
getActions
();
const
globalActivityActions
:
IAction
[]
=
[];
const
globalActivityMenu
=
this
.
menuService
.
createMenu
(
MenuId
.
GlobalActivity
,
this
.
contextKeyService
);
fillInActionBarActions
(
globalActivityMenu
,
undefined
,
{
primary
:
[],
secondary
:
globalActivityActions
});
const
containerPosition
=
DOM
.
getDomNodePagePosition
(
this
.
container
);
const
location
=
{
x
:
containerPosition
.
left
+
containerPosition
.
width
/
2
,
y
:
containerPosition
.
top
};
this
.
contextMenuService
.
showContextMenu
({
getAnchor
:
()
=>
location
,
getActions
:
()
=>
actions
,
onHide
:
()
=>
dispose
(
actions
)
getActions
:
()
=>
globalActivityActions
,
onHide
:
()
=>
{
globalActivityMenu
.
dispose
();
dispose
(
globalActivityActions
);
}
});
}
}
...
...
src/vs/workbench/browser/parts/activitybar/activitybarPart.ts
浏览文件 @
0337567d
...
...
@@ -7,10 +7,10 @@ import 'vs/css!./media/activitybarpart';
import
*
as
nls
from
'
vs/nls
'
;
import
{
illegalArgument
}
from
'
vs/base/common/errors
'
;
import
{
ActionsOrientation
,
ActionBar
}
from
'
vs/base/browser/ui/actionbar/actionbar
'
;
import
{
G
lobalActivityExtensions
,
IGlobalActivityRegistry
}
from
'
vs/workbench/common/activity
'
;
import
{
G
LOBAL_ACTIVITY_ID
}
from
'
vs/workbench/common/activity
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
Part
}
from
'
vs/workbench/browser/part
'
;
import
{
GlobalActivityActionViewItem
,
GlobalActivityAction
,
ViewletActivityAction
,
ToggleViewletAction
,
PlaceHolderToggleCompositePinnedAction
,
PlaceHolderViewletActivityAction
}
from
'
vs/workbench/browser/parts/activitybar/activitybarActions
'
;
import
{
GlobalActivityActionViewItem
,
ViewletActivityAction
,
ToggleViewletAction
,
PlaceHolderToggleCompositePinnedAction
,
PlaceHolderViewletActivityAction
}
from
'
vs/workbench/browser/parts/activitybar/activitybarActions
'
;
import
{
IViewletService
}
from
'
vs/workbench/services/viewlet/browser/viewlet
'
;
import
{
IBadge
}
from
'
vs/workbench/services/activity/common/activity
'
;
import
{
IWorkbenchLayoutService
,
Parts
,
Position
as
SideBarPosition
}
from
'
vs/workbench/services/layout/browser/layoutService
'
;
...
...
@@ -25,7 +25,7 @@ import { Dimension, addClass } from 'vs/base/browser/dom';
import
{
IStorageService
,
StorageScope
,
IWorkspaceStorageChangeEvent
}
from
'
vs/platform/storage/common/storage
'
;
import
{
IExtensionService
}
from
'
vs/workbench/services/extensions/common/extensions
'
;
import
{
URI
,
UriComponents
}
from
'
vs/base/common/uri
'
;
import
{
ToggleCompositePinnedAction
,
ICompositeBarColors
}
from
'
vs/workbench/browser/parts/compositeBarActions
'
;
import
{
ToggleCompositePinnedAction
,
ICompositeBarColors
,
ActivityAction
}
from
'
vs/workbench/browser/parts/compositeBarActions
'
;
import
{
ViewletDescriptor
}
from
'
vs/workbench/browser/viewlet
'
;
import
{
IViewsService
,
IViewContainersRegistry
,
Extensions
as
ViewContainerExtensions
,
ViewContainer
,
TEST_VIEW_CONTAINER_ID
,
IViewDescriptorCollection
}
from
'
vs/workbench/common/views
'
;
import
{
IContextKeyService
,
ContextKeyExpr
}
from
'
vs/platform/contextkey/common/contextkey
'
;
...
...
@@ -60,8 +60,8 @@ export class ActivitybarPart extends Part implements IActivityBarService {
//#endregion
private
globalActi
onBar
:
ActionBar
;
private
globalActivity
IdToActions
:
Map
<
string
,
GlobalActivityAction
>
=
new
Map
()
;
private
globalActi
vityAction
:
ActivityAction
;
private
globalActivity
ActionBar
:
ActionBar
;
private
cachedViewlets
:
ICachedViewlet
[]
=
[];
...
...
@@ -163,22 +163,16 @@ export class ActivitybarPart extends Part implements IActivityBarService {
return
this
.
compositeBar
.
showActivity
(
viewletOrActionId
,
badge
,
clazz
,
priority
);
}
return
this
.
showGlobalActivity
(
viewletOrActionId
,
badge
,
clazz
);
}
private
showGlobalActivity
(
globalActivityId
:
string
,
badge
:
IBadge
,
clazz
?:
string
):
IDisposable
{
if
(
!
badge
)
{
throw
illegalArgument
(
'
badge
'
);
}
const
action
=
this
.
globalActivityIdToActions
.
get
(
globalActivityId
);
if
(
!
action
)
{
throw
illegalArgument
(
'
globalActivityId
'
);
if
(
viewletOrActionId
===
GLOBAL_ACTIVITY_ID
)
{
return
this
.
showGlobalActivity
(
badge
,
clazz
);
}
action
.
setBadge
(
badge
,
clazz
);
throw
illegalArgument
(
'
globalActivityId
'
);
}
return
toDisposable
(()
=>
action
.
setBadge
(
undefined
));
private
showGlobalActivity
(
badge
:
IBadge
,
clazz
?:
string
):
IDisposable
{
this
.
globalActivityAction
.
setBadge
(
badge
,
clazz
);
return
toDisposable
(()
=>
this
.
globalActivityAction
.
setBadge
(
undefined
));
}
createContentArea
(
parent
:
HTMLElement
):
HTMLElement
{
...
...
@@ -232,23 +226,19 @@ export class ActivitybarPart extends Part implements IActivityBarService {
}
private
createGlobalActivityActionBar
(
container
:
HTMLElement
):
void
{
const
activityRegistry
=
Registry
.
as
<
IGlobalActivityRegistry
>
(
GlobalActivityExtensions
);
const
descriptors
=
activityRegistry
.
getActivities
();
const
actions
=
descriptors
.
map
(
d
=>
this
.
instantiationService
.
createInstance
(
d
))
.
map
(
a
=>
new
GlobalActivityAction
(
a
));
this
.
globalActionBar
=
this
.
_register
(
new
ActionBar
(
container
,
{
this
.
globalActivityActionBar
=
this
.
_register
(
new
ActionBar
(
container
,
{
actionViewItemProvider
:
a
=>
this
.
instantiationService
.
createInstance
(
GlobalActivityActionViewItem
,
a
,
(
theme
:
ITheme
)
=>
this
.
getActivitybarItemColors
(
theme
)),
orientation
:
ActionsOrientation
.
VERTICAL
,
ariaLabel
:
nls
.
localize
(
'
globalActions
'
,
"
Global Actions
"
),
ariaLabel
:
nls
.
localize
(
'
manage
'
,
"
Manage
"
),
animated
:
false
}));
actions
.
forEach
(
a
=>
{
this
.
globalActivityIdToActions
.
set
(
a
.
id
,
a
);
this
.
globalActionBar
.
push
(
a
);
this
.
globalActivityAction
=
new
ActivityAction
({
id
:
'
workbench.actions.manage
'
,
name
:
nls
.
localize
(
'
manage
'
,
"
Manage
"
),
cssClass
:
'
update-activity
'
});
this
.
globalActivityActionBar
.
push
(
this
.
globalActivityAction
);
}
private
getCompositeActions
(
compositeId
:
string
):
{
activityAction
:
ViewletActivityAction
,
pinnedAction
:
ToggleCompositePinnedAction
}
{
...
...
@@ -382,8 +372,8 @@ export class ActivitybarPart extends Part implements IActivityBarService {
// Layout composite bar
let
availableHeight
=
contentAreaSize
.
height
;
if
(
this
.
globalActionBar
)
{
availableHeight
-=
(
this
.
globalActionBar
.
viewItems
.
length
*
ActivitybarPart
.
ACTION_HEIGHT
);
// adjust height for global actions showing
if
(
this
.
globalActi
vityActi
onBar
)
{
availableHeight
-=
(
this
.
globalActi
vityActi
onBar
.
viewItems
.
length
*
ActivitybarPart
.
ACTION_HEIGHT
);
// adjust height for global actions showing
}
this
.
compositeBar
.
layout
(
new
Dimension
(
width
,
availableHeight
));
}
...
...
src/vs/workbench/browser/parts/activitybar/media/activitybarpart.css
浏览文件 @
0337567d
...
...
@@ -25,4 +25,8 @@
.monaco-workbench
.activitybar
>
.content
>
.composite-bar
>
.monaco-action-bar
.action-label.toggle-more
{
-webkit-mask
:
url('ellipsis-global.svg')
no-repeat
50%
50%
;
}
.monaco-workbench
.activitybar
.global-activity
.monaco-action-bar
.action-label.update-activity
{
-webkit-mask
:
url('update.svg')
no-repeat
50%
50%
;
}
\ No newline at end of file
src/vs/workbench/
contrib/update/electron-browse
r/media/update.svg
→
src/vs/workbench/
browser/parts/activityba
r/media/update.svg
浏览文件 @
0337567d
文件已移动
src/vs/workbench/common/activity.ts
浏览文件 @
0337567d
...
...
@@ -3,10 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
IAction
}
from
'
vs/base/common/actions
'
;
import
{
IConstructorSignature0
}
from
'
vs/platform/instantiation/common/instantiation
'
;
export
interface
IActivity
{
id
:
string
;
name
:
string
;
...
...
@@ -14,31 +10,4 @@ export interface IActivity {
cssClass
?:
string
;
}
export
interface
IGlobalActivity
extends
IActivity
{
getActions
():
IAction
[];
}
export
const
GlobalActivityExtensions
=
'
workbench.contributions.globalActivities
'
;
export
interface
IGlobalActivityRegistry
{
registerActivity
(
descriptor
:
IConstructorSignature0
<
IGlobalActivity
>
):
void
;
getActivities
():
IConstructorSignature0
<
IGlobalActivity
>
[];
}
export
class
GlobalActivityRegistry
implements
IGlobalActivityRegistry
{
private
readonly
activityDescriptors
=
new
Set
<
IConstructorSignature0
<
IGlobalActivity
>>
();
registerActivity
(
descriptor
:
IConstructorSignature0
<
IGlobalActivity
>
):
void
{
this
.
activityDescriptors
.
add
(
descriptor
);
}
getActivities
():
IConstructorSignature0
<
IGlobalActivity
>
[]
{
const
result
:
IConstructorSignature0
<
IGlobalActivity
>
[]
=
[];
this
.
activityDescriptors
.
forEach
(
d
=>
result
.
push
(
d
));
return
result
;
}
}
Registry
.
add
(
GlobalActivityExtensions
,
new
GlobalActivityRegistry
());
\ No newline at end of file
export
const
GLOBAL_ACTIVITY_ID
=
'
workbench.action.globalActivity
'
;
\ No newline at end of file
src/vs/workbench/contrib/extensions/electron-browser/extensions.contribution.ts
浏览文件 @
0337567d
...
...
@@ -439,4 +439,13 @@ CommandsRegistry.registerCommand({
onUnexpectedError
(
e
);
}
}
});
MenuRegistry
.
appendMenuItem
(
MenuId
.
GlobalActivity
,
{
group
:
'
2_configuration
'
,
command
:
{
id
:
VIEWLET_ID
,
title
:
localize
(
'
showExtensions
'
,
"
Extensions
"
)
},
order
:
3
});
\ No newline at end of file
src/vs/workbench/contrib/preferences/browser/preferences.contribution.ts
浏览文件 @
0337567d
...
...
@@ -757,6 +757,15 @@ MenuRegistry.appendMenuItem(MenuId.MenubarPreferencesMenu, {
order
:
1
});
MenuRegistry
.
appendMenuItem
(
MenuId
.
GlobalActivity
,
{
group
:
'
2_configuration
'
,
command
:
{
id
:
SETTINGS_COMMAND_OPEN_SETTINGS
,
title
:
nls
.
localize
(
'
settings
'
,
"
Settings
"
)
},
order
:
1
});
MenuRegistry
.
appendMenuItem
(
MenuId
.
MenubarPreferencesMenu
,
{
group
:
'
1_settings
'
,
command
:
{
...
...
@@ -766,6 +775,15 @@ MenuRegistry.appendMenuItem(MenuId.MenubarPreferencesMenu, {
order
:
2
});
MenuRegistry
.
appendMenuItem
(
MenuId
.
GlobalActivity
,
{
group
:
'
2_configuration
'
,
command
:
{
id
:
SETTINGS_EDITOR_COMMAND_FILTER_ONLINE
,
title
:
nls
.
localize
(
'
onlineServices
'
,
"
Online Services Settings
"
)
},
order
:
2
});
MenuRegistry
.
appendMenuItem
(
MenuId
.
MenubarPreferencesMenu
,
{
group
:
'
2_keybindings
'
,
command
:
{
...
...
@@ -775,6 +793,15 @@ MenuRegistry.appendMenuItem(MenuId.MenubarPreferencesMenu, {
order
:
1
});
MenuRegistry
.
appendMenuItem
(
MenuId
.
GlobalActivity
,
{
group
:
'
2_configuration
'
,
command
:
{
id
:
OpenGlobalKeybindingsAction
.
ID
,
title
:
nls
.
localize
(
'
keyboardShortcuts
'
,
"
Keyboard Shortcuts
"
)
},
order
:
4
});
// Editor tool items
MenuRegistry
.
appendMenuItem
(
MenuId
.
EditorTitle
,
{
...
...
src/vs/workbench/contrib/quickopen/browser/quickopen.contribution.ts
浏览文件 @
0337567d
...
...
@@ -182,4 +182,13 @@ MenuRegistry.appendMenuItem(MenuId.MenubarGoMenu, {
title
:
nls
.
localize
({
key
:
'
miGotoLine
'
,
comment
:
[
'
&& denotes a mnemonic
'
]
},
"
Go to &&Line/Column...
"
)
},
order
:
1
});
MenuRegistry
.
appendMenuItem
(
MenuId
.
GlobalActivity
,
{
group
:
'
1_command
'
,
command
:
{
id
:
ShowAllCommandsAction
.
ID
,
title
:
nls
.
localize
(
'
commandPalette
'
,
"
Command Palette...
"
)
},
order
:
1
});
\ No newline at end of file
src/vs/workbench/contrib/snippets/browser/configureSnippets.ts
浏览文件 @
0337567d
...
...
@@ -272,3 +272,12 @@ MenuRegistry.appendMenuItem(MenuId.MenubarPreferencesMenu, {
},
order
:
1
});
MenuRegistry
.
appendMenuItem
(
MenuId
.
GlobalActivity
,
{
group
:
'
3_snippets
'
,
command
:
{
id
,
title
:
nls
.
localize
(
'
userSnippets
'
,
"
User Snippets
"
)
},
order
:
1
});
src/vs/workbench/contrib/themes/browser/themes.contribution.ts
浏览文件 @
0337567d
...
...
@@ -271,3 +271,21 @@ MenuRegistry.appendMenuItem(MenuId.MenubarPreferencesMenu, {
},
order
:
2
});
MenuRegistry
.
appendMenuItem
(
MenuId
.
GlobalActivity
,
{
group
:
'
4_themes
'
,
command
:
{
id
:
SelectColorThemeAction
.
ID
,
title
:
localize
(
'
selectTheme.label
'
,
"
Color Theme
"
)
},
order
:
1
});
MenuRegistry
.
appendMenuItem
(
MenuId
.
GlobalActivity
,
{
group
:
'
4_themes
'
,
command
:
{
id
:
SelectIconThemeAction
.
ID
,
title
:
localize
(
'
themes.selectIconTheme.label
'
,
"
File Icon Theme
"
)
},
order
:
2
});
\ No newline at end of file
src/vs/workbench/contrib/update/electron-browser/media/update.contribution.css
已删除
100644 → 0
浏览文件 @
4a3c056e
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
.update-activity
{
-webkit-mask
:
url('update.svg')
no-repeat
50%
50%
;
}
src/vs/workbench/contrib/update/electron-browser/update.contribution.ts
浏览文件 @
0337567d
...
...
@@ -3,12 +3,10 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
'
vs/css!./media/update.contribution
'
;
import
'
vs/platform/update/node/update.config.contribution
'
;
import
*
as
platform
from
'
vs/base/common/platform
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
IWorkbenchContributionsRegistry
,
Extensions
as
WorkbenchExtensions
}
from
'
vs/workbench/common/contributions
'
;
import
{
IGlobalActivityRegistry
,
GlobalActivityExtensions
}
from
'
vs/workbench/common/activity
'
;
import
{
IWorkbenchActionRegistry
,
Extensions
as
ActionExtensions
}
from
'
vs/workbench/common/actions
'
;
import
{
SyncActionDescriptor
}
from
'
vs/platform/actions/common/actions
'
;
import
{
ShowCurrentReleaseNotesAction
,
ProductContribution
,
UpdateContribution
,
Win3264BitContribution
}
from
'
./update
'
;
...
...
@@ -24,8 +22,7 @@ if (platform.isWindows) {
}
}
Registry
.
as
<
IGlobalActivityRegistry
>
(
GlobalActivityExtensions
)
.
registerActivity
(
UpdateContribution
);
workbench
.
registerWorkbenchContribution
(
UpdateContribution
,
LifecyclePhase
.
Restored
);
// Editor
Registry
.
as
<
IWorkbenchActionRegistry
>
(
ActionExtensions
.
WorkbenchActions
)
...
...
src/vs/workbench/contrib/update/electron-browser/update.ts
浏览文件 @
0337567d
...
...
@@ -5,17 +5,15 @@
import
*
as
nls
from
'
vs/nls
'
;
import
severity
from
'
vs/base/common/severity
'
;
import
{
IAction
,
Action
}
from
'
vs/base/common/actions
'
;
import
{
Action
}
from
'
vs/base/common/actions
'
;
import
{
IDisposable
,
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
Separator
}
from
'
vs/base/browser/ui/actionbar/actionbar
'
;
import
pkg
from
'
vs/platform/product/node/package
'
;
import
product
from
'
vs/platform/product/node/product
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
IActivityService
,
NumberBadge
,
IBadge
,
ProgressBadge
}
from
'
vs/workbench/services/activity/common/activity
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IGlobalActivity
}
from
'
vs/workbench/common/activity
'
;
import
{
GLOBAL_ACTIVITY_ID
}
from
'
vs/workbench/common/activity
'
;
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
,
State
as
UpdateState
,
StateType
,
IUpdate
}
from
'
vs/platform/update/common/update
'
;
...
...
@@ -27,6 +25,11 @@ import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/
import
{
ReleaseNotesManager
}
from
'
./releaseNotesEditor
'
;
import
{
isWindows
}
from
'
vs/base/common/platform
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
RawContextKey
,
IContextKey
,
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
MenuRegistry
,
MenuId
}
from
'
vs/platform/actions/common/actions
'
;
import
{
CommandsRegistry
}
from
'
vs/platform/commands/common/commands
'
;
export
const
CONTEXT_UPDATE_STATE
=
new
RawContextKey
<
string
>
(
'
updateStateContext
'
,
''
);
let
releaseNotesManager
:
ReleaseNotesManager
|
undefined
=
undefined
;
...
...
@@ -212,47 +215,25 @@ export class Win3264BitContribution implements IWorkbenchContribution {
}
}
class
CommandAction
extends
Action
{
constructor
(
commandId
:
string
,
label
:
string
,
@
ICommandService
commandService
:
ICommandService
)
{
super
(
`command-action:
${
commandId
}
`
,
label
,
undefined
,
true
,
()
=>
commandService
.
executeCommand
(
commandId
));
}
}
export
class
UpdateContribution
extends
Disposable
implements
IGlobalActivity
{
private
static
readonly
showCommandsId
=
'
workbench.action.showCommands
'
;
private
static
readonly
openSettingsId
=
'
workbench.action.openSettings
'
;
private
static
readonly
openKeybindingsId
=
'
workbench.action.openGlobalKeybindings
'
;
private
static
readonly
openUserSnippets
=
'
workbench.action.openSnippets
'
;
private
static
readonly
selectColorThemeId
=
'
workbench.action.selectTheme
'
;
private
static
readonly
selectIconThemeId
=
'
workbench.action.selectIconTheme
'
;
private
static
readonly
showExtensionsId
=
'
workbench.view.extensions
'
;
private
static
readonly
showOnlineSettingsId
=
'
settings.filterByOnline
'
;
get
id
()
{
return
'
vs.update
'
;
}
get
name
()
{
return
nls
.
localize
(
'
manage
'
,
"
Manage
"
);
}
get
cssClass
()
{
return
'
update-activity
'
;
}
export
class
UpdateContribution
extends
Disposable
implements
IWorkbenchContribution
{
private
state
:
UpdateState
;
private
badgeDisposable
:
IDisposable
=
Disposable
.
None
;
private
updateStateContextKey
:
IContextKey
<
string
>
;
constructor
(
@
IStorageService
private
readonly
storageService
:
IStorageService
,
@
ICommandService
private
readonly
commandService
:
ICommandService
,
@
IInstantiationService
private
readonly
instantiationService
:
IInstantiationService
,
@
INotificationService
private
readonly
notificationService
:
INotificationService
,
@
IDialogService
private
readonly
dialogService
:
IDialogService
,
@
IUpdateService
private
readonly
updateService
:
IUpdateService
,
@
IActivityService
private
readonly
activityService
:
IActivityService
,
@
IWorkbenchEnvironmentService
private
readonly
environmentService
:
IWorkbenchEnvironmentService
@
IWorkbenchEnvironmentService
private
readonly
environmentService
:
IWorkbenchEnvironmentService
,
@
IContextKeyService
private
readonly
contextKeyService
:
IContextKeyService
)
{
super
();
this
.
state
=
updateService
.
state
;
this
.
updateStateContextKey
=
CONTEXT_UPDATE_STATE
.
bindTo
(
this
.
contextKeyService
);
this
.
_register
(
updateService
.
onStateChange
(
this
.
onUpdateStateChange
,
this
));
this
.
onUpdateStateChange
(
this
.
updateService
.
state
);
...
...
@@ -273,9 +254,12 @@ export class UpdateContribution extends Disposable implements IGlobalActivity {
this
.
storageService
.
remove
(
'
update/lastKnownVersion
'
,
StorageScope
.
GLOBAL
);
this
.
storageService
.
remove
(
'
update/updateNotificationTime
'
,
StorageScope
.
GLOBAL
);
}
this
.
registerGlobalActivityActions
();
}
private
onUpdateStateChange
(
state
:
UpdateState
):
void
{
this
.
updateStateContextKey
.
set
(
state
.
type
);
switch
(
state
.
type
)
{
case
StateType
.
Idle
:
if
(
state
.
error
)
{
...
...
@@ -315,7 +299,7 @@ export class UpdateContribution extends Disposable implements IGlobalActivity {
this
.
badgeDisposable
.
dispose
();
if
(
badge
)
{
this
.
badgeDisposable
=
this
.
activityService
.
showActivity
(
this
.
id
,
badge
,
clazz
);
this
.
badgeDisposable
=
this
.
activityService
.
showActivity
(
GLOBAL_ACTIVITY_ID
,
badge
,
clazz
);
}
this
.
state
=
state
;
...
...
@@ -472,62 +456,78 @@ export class UpdateContribution extends Disposable implements IGlobalActivity {
return
diffDays
>
5
;
}
getActions
():
IAction
[]
{
const
result
:
IAction
[]
=
[
new
CommandAction
(
UpdateContribution
.
showCommandsId
,
nls
.
localize
(
'
commandPalette
'
,
"
Command Palette...
"
),
this
.
commandService
),
new
Separator
(),
new
CommandAction
(
UpdateContribution
.
openSettingsId
,
nls
.
localize
(
'
settings
'
,
"
Settings
"
),
this
.
commandService
),
new
CommandAction
(
UpdateContribution
.
showOnlineSettingsId
,
nls
.
localize
(
'
onlineServices
'
,
"
Online Services Settings
"
),
this
.
commandService
),
new
CommandAction
(
UpdateContribution
.
showExtensionsId
,
nls
.
localize
(
'
showExtensions
'
,
"
Extensions
"
),
this
.
commandService
),
new
CommandAction
(
UpdateContribution
.
openKeybindingsId
,
nls
.
localize
(
'
keyboardShortcuts
'
,
"
Keyboard Shortcuts
"
),
this
.
commandService
),
new
Separator
(),
new
CommandAction
(
UpdateContribution
.
openUserSnippets
,
nls
.
localize
(
'
userSnippets
'
,
"
User Snippets
"
),
this
.
commandService
),
new
Separator
(),
new
CommandAction
(
UpdateContribution
.
selectColorThemeId
,
nls
.
localize
(
'
selectTheme.label
'
,
"
Color Theme
"
),
this
.
commandService
),
new
CommandAction
(
UpdateContribution
.
selectIconThemeId
,
nls
.
localize
(
'
themes.selectIconTheme.label
'
,
"
File Icon Theme
"
),
this
.
commandService
)
];
const
updateAction
=
this
.
getUpdateAction
();
if
(
updateAction
)
{
result
.
push
(
new
Separator
(),
updateAction
);
}
return
result
;
}
private
getUpdateAction
():
IAction
|
null
{
const
state
=
this
.
updateService
.
state
;
switch
(
state
.
type
)
{
case
StateType
.
Uninitialized
:
return
null
;
case
StateType
.
Idle
:
const
windowId
=
this
.
environmentService
.
configuration
.
windowId
;
return
new
Action
(
'
update.check
'
,
nls
.
localize
(
'
checkForUpdates
'
,
"
Check for Updates...
"
),
undefined
,
true
,
()
=>
this
.
updateService
.
checkForUpdates
({
windowId
}));
private
registerGlobalActivityActions
():
void
{
CommandsRegistry
.
registerCommand
(
'
update.check
'
,
()
=>
this
.
updateService
.
checkForUpdates
({
windowId
:
this
.
environmentService
.
configuration
.
windowId
}));
MenuRegistry
.
appendMenuItem
(
MenuId
.
GlobalActivity
,
{
group
:
'
5_update
'
,
command
:
{
id
:
'
update.check
'
,
title
:
nls
.
localize
(
'
checkForUpdates
'
,
"
Check for Updates...
"
)
},
when
:
CONTEXT_UPDATE_STATE
.
isEqualTo
(
StateType
.
Idle
),
});
case
StateType
.
CheckingForUpdates
:
return
new
Action
(
'
update.checking
'
,
nls
.
localize
(
'
checkingForUpdates
'
,
"
Checking For Updates...
"
),
undefined
,
false
);
CommandsRegistry
.
registerCommand
(
'
update.checking
'
,
()
=>
{
});
MenuRegistry
.
appendMenuItem
(
MenuId
.
GlobalActivity
,
{
group
:
'
5_update
'
,
command
:
{
id
:
'
update.checking
'
,
title
:
nls
.
localize
(
'
checkingForUpdates
'
,
"
Checking For Updates...
"
),
precondition
:
CONTEXT_UPDATE_STATE
.
isEqualTo
(
''
)
},
when
:
CONTEXT_UPDATE_STATE
.
isEqualTo
(
StateType
.
CheckingForUpdates
),
});
case
StateType
.
AvailableForDownload
:
return
new
Action
(
'
update.downloadNow
'
,
nls
.
localize
(
'
download now
'
,
"
Download Now
"
),
undefined
,
true
,
()
=>
this
.
updateService
.
downloadUpdate
());
CommandsRegistry
.
registerCommand
(
'
update.downloadNow
'
,
()
=>
this
.
updateService
.
downloadUpdate
());
MenuRegistry
.
appendMenuItem
(
MenuId
.
GlobalActivity
,
{
group
:
'
5_update
'
,
command
:
{
id
:
'
update.downloadNow
'
,
title
:
nls
.
localize
(
'
download now
'
,
"
Download Now
"
)
},
when
:
CONTEXT_UPDATE_STATE
.
isEqualTo
(
StateType
.
AvailableForDownload
),
});
case
StateType
.
Downloading
:
return
new
Action
(
'
update.downloading
'
,
nls
.
localize
(
'
DownloadingUpdate
'
,
"
Downloading Update...
"
),
undefined
,
false
);
CommandsRegistry
.
registerCommand
(
'
update.downloading
'
,
()
=>
{
});
MenuRegistry
.
appendMenuItem
(
MenuId
.
GlobalActivity
,
{
group
:
'
5_update
'
,
command
:
{
id
:
'
update.downloading
'
,
title
:
nls
.
localize
(
'
DownloadingUpdate
'
,
"
Downloading Update...
"
),
precondition
:
CONTEXT_UPDATE_STATE
.
isEqualTo
(
''
)
},
when
:
CONTEXT_UPDATE_STATE
.
isEqualTo
(
StateType
.
Downloading
),
});
case
StateType
.
Downloaded
:
return
new
Action
(
'
update.install
'
,
nls
.
localize
(
'
installUpdate...
'
,
"
Install Update...
"
),
undefined
,
true
,
()
=>
this
.
updateService
.
applyUpdate
());
CommandsRegistry
.
registerCommand
(
'
update.install
'
,
()
=>
this
.
updateService
.
applyUpdate
());
MenuRegistry
.
appendMenuItem
(
MenuId
.
GlobalActivity
,
{
group
:
'
5_update
'
,
command
:
{
id
:
'
update.install
'
,
title
:
nls
.
localize
(
'
installUpdate...
'
,
"
Install Update...
"
)
},
when
:
CONTEXT_UPDATE_STATE
.
isEqualTo
(
StateType
.
Downloaded
),
});
case
StateType
.
Updating
:
return
new
Action
(
'
update.updating
'
,
nls
.
localize
(
'
installingUpdate
'
,
"
Installing Update...
"
),
undefined
,
false
);
CommandsRegistry
.
registerCommand
(
'
update.updating
'
,
()
=>
{
});
MenuRegistry
.
appendMenuItem
(
MenuId
.
GlobalActivity
,
{
group
:
'
5_update
'
,
command
:
{
id
:
'
update.updating
'
,
title
:
nls
.
localize
(
'
installingUpdate
'
,
"
Installing Update...
"
),
precondition
:
CONTEXT_UPDATE_STATE
.
isEqualTo
(
''
)
},
when
:
CONTEXT_UPDATE_STATE
.
isEqualTo
(
StateType
.
Updating
),
});
case
StateType
.
Ready
:
return
new
Action
(
'
update.restart
'
,
nls
.
localize
(
'
restartToUpdate
'
,
"
Restart to Update
"
),
undefined
,
true
,
()
=>
this
.
updateService
.
quitAndInstall
());
}
CommandsRegistry
.
registerCommand
(
'
update.restart
'
,
()
=>
this
.
updateService
.
quitAndInstall
());
MenuRegistry
.
appendMenuItem
(
MenuId
.
GlobalActivity
,
{
group
:
'
5_update
'
,
command
:
{
id
:
'
update.restart
'
,
title
:
nls
.
localize
(
'
restartToUpdate
'
,
"
Restart to Update
"
)
},
when
:
CONTEXT_UPDATE_STATE
.
isEqualTo
(
StateType
.
Ready
),
});
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录