Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
09e10dd4
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
09e10dd4
编写于
11月 25, 2016
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
extract scm menus
上级
3467231a
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
65 addition
and
23 deletion
+65
-23
src/vs/workbench/parts/scm/browser/scmMenus.ts
src/vs/workbench/parts/scm/browser/scmMenus.ts
+56
-0
src/vs/workbench/parts/scm/browser/scmViewlet.ts
src/vs/workbench/parts/scm/browser/scmViewlet.ts
+9
-23
未找到文件。
src/vs/workbench/parts/scm/browser/scmMenus.ts
0 → 100644
浏览文件 @
09e10dd4
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
'
vs/css!./media/scmViewlet
'
;
import
Event
,
{
mapEvent
}
from
'
vs/base/common/event
'
;
import
{
memoize
}
from
'
vs/base/common/decorators
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
IMenuService
,
MenuId
,
IMenu
}
from
'
vs/platform/actions/common/actions
'
;
import
{
IAction
}
from
'
vs/base/common/actions
'
;
import
{
fillInActions
}
from
'
vs/platform/actions/browser/menuItemActionItem
'
;
export
class
SCMMenus
implements
IDisposable
{
private
titleMenu
:
IMenu
;
private
_titleMenuActions
:
{
primary
:
IAction
[];
secondary
:
IAction
[]
};
private
get
cachedTitleMenuActions
()
{
if
(
!
this
.
_titleMenuActions
)
{
this
.
_titleMenuActions
=
{
primary
:
[],
secondary
:
[]
};
fillInActions
(
this
.
titleMenu
,
this
.
_titleMenuActions
);
}
return
this
.
_titleMenuActions
;
}
private
disposables
:
IDisposable
[]
=
[];
constructor
(
@
IContextKeyService
private
contextKeyService
:
IContextKeyService
,
@
IMenuService
private
menuService
:
IMenuService
)
{
this
.
titleMenu
=
menuService
.
createMenu
(
MenuId
.
SCMTitle
,
contextKeyService
);
this
.
disposables
.
push
(
this
.
titleMenu
);
}
@
memoize
get
onDidChangeTitleMenu
():
Event
<
any
>
{
return
mapEvent
(
this
.
titleMenu
.
onDidChange
,
()
=>
this
.
_titleMenuActions
=
void
0
);
}
get
titleMenuActions
():
IAction
[]
{
return
this
.
cachedTitleMenuActions
.
primary
;
}
get
titleMenuSecondaryActions
():
IAction
[]
{
return
this
.
cachedTitleMenuActions
.
secondary
;
}
dispose
():
void
{
this
.
disposables
=
dispose
(
this
.
disposables
);
}
}
src/vs/workbench/parts/scm/browser/scmViewlet.ts
浏览文件 @
09e10dd4
...
...
@@ -30,9 +30,10 @@ import { IMessageService } from 'vs/platform/message/common/message';
import
{
InputBox
}
from
'
vs/base/browser/ui/inputbox/inputBox
'
;
import
{
StandardKeyboardEvent
}
from
'
vs/base/browser/keyboardEvent
'
;
import
{
KeyCode
,
KeyMod
}
from
'
vs/base/common/keyCodes
'
;
import
{
IMenuService
,
MenuId
,
IMenu
}
from
'
vs/platform/actions/common/actions
'
;
import
{
IMenuService
}
from
'
vs/platform/actions/common/actions
'
;
import
{
IAction
,
IActionItem
}
from
'
vs/base/common/actions
'
;
import
{
createActionItem
,
fillInActions
}
from
'
vs/platform/actions/browser/menuItemActionItem
'
;
import
{
createActionItem
}
from
'
vs/platform/actions/browser/menuItemActionItem
'
;
import
{
SCMMenus
}
from
'
./scmMenus
'
;
// TODO@Joao remove
import
{
GitSCMProvider
}
from
'
vs/workbench/parts/git/browser/gitSCMProvider
'
;
...
...
@@ -119,17 +120,7 @@ export class SCMViewlet extends Viewlet {
private
inputBox
:
InputBox
;
private
listContainer
:
HTMLElement
;
private
list
:
List
<
ISCMResourceGroup
|
ISCMResource
>
;
private
titleMenu
:
IMenu
;
private
_titleMenuActions
:
{
primary
:
IAction
[];
secondary
:
IAction
[]
};
private
get
titleMenuActions
()
{
if
(
!
this
.
_titleMenuActions
)
{
this
.
_titleMenuActions
=
{
primary
:
[],
secondary
:
[]
};
fillInActions
(
this
.
titleMenu
,
this
.
_titleMenuActions
);
}
return
this
.
_titleMenuActions
;
}
private
menus
:
SCMMenus
;
private
disposables
:
IDisposable
[]
=
[];
constructor
(
...
...
@@ -147,10 +138,10 @@ export class SCMViewlet extends Viewlet {
// TODO@Joao
scmService
.
activeProvider
=
instantiationService
.
createInstance
(
GitSCMProvider
);
this
.
titleMenu
=
menuService
.
createMenu
(
MenuId
.
SCMTitle
,
contextKeyService
);
this
.
menus
=
this
.
instantiationService
.
createInstance
(
SCMMenus
);
this
.
disposables
.
push
(
this
.
menus
);
this
.
disposables
.
push
(
this
.
titleMenu
);
this
.
titleMenu
.
onDidChange
(
this
.
onTitleMenuChange
,
this
,
this
.
disposables
);
this
.
menus
.
onDidChangeTitleMenu
(
this
.
updateTitleArea
,
this
,
this
.
disposables
);
}
create
(
parent
:
Builder
):
TPromise
<
void
>
{
...
...
@@ -238,17 +229,12 @@ export class SCMViewlet extends Viewlet {
this
.
scmService
.
activeProvider
.
open
(
e
);
}
private
onTitleMenuChange
():
void
{
this
.
_titleMenuActions
=
void
0
;
this
.
updateTitleArea
();
}
getActions
():
IAction
[]
{
return
this
.
titleMenuActions
.
primary
;
return
this
.
menus
.
titleMenuActions
;
}
getSecondaryActions
():
IAction
[]
{
return
this
.
titleMenuActions
.
secondary
;
return
this
.
menus
.
titleMenuSecondaryActions
;
}
getActionItem
(
action
:
IAction
):
IActionItem
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录