Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
b284ed56
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,发现更多精彩内容 >>
提交
b284ed56
编写于
1月 19, 2016
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
panel: address Ben's feedback
上级
b19445e3
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
67 addition
and
63 deletion
+67
-63
src/vs/workbench/browser/composite.ts
src/vs/workbench/browser/composite.ts
+3
-2
src/vs/workbench/browser/panel.ts
src/vs/workbench/browser/panel.ts
+0
-48
src/vs/workbench/browser/parts/panel/panelPart.ts
src/vs/workbench/browser/parts/panel/panelPart.ts
+50
-2
src/vs/workbench/browser/workbench.ts
src/vs/workbench/browser/workbench.ts
+12
-10
src/vs/workbench/parts/debug/browser/repl.ts
src/vs/workbench/parts/debug/browser/repl.ts
+2
-1
未找到文件。
src/vs/workbench/browser/composite.ts
浏览文件 @
b284ed56
...
...
@@ -23,8 +23,9 @@ export const EventType = {
};
/**
* Composites are layed out in the sidebar part of the workbench. Only one composite can be open
* at a time. Each composite has a minimized representation that is good enough to provide some
* Composites are layed out in the sidebar and panel part of the workbench. At a time only one composite
* can be open in the sidebar, and only one composite can be open in the panel.
* Each composite has a minimized representation that is good enough to provide some
* information about the state of the composite data.
* The workbench will keep a composite alive after it has been created and show/hide it based on
* user interaction. The lifecycle of a composite goes in the order create(), setVisible(true|false),
...
...
src/vs/workbench/browser/panel.ts
浏览文件 @
b284ed56
...
...
@@ -3,17 +3,10 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
nls
=
require
(
'
vs/nls
'
);
import
{
Promise
}
from
'
vs/base/common/winjs.base
'
;
import
{
Action
}
from
'
vs/base/common/actions
'
;
import
{
KeyMod
,
KeyCode
}
from
'
vs/base/common/keyCodes
'
;
import
{
Registry
}
from
'
vs/platform/platform
'
;
import
{
SyncActionDescriptor
}
from
'
vs/platform/actions/common/actions
'
;
import
{
IPanel
}
from
'
vs/workbench/common/panel
'
;
import
{
IWorkbenchActionRegistry
,
Extensions
as
WorkbenchExtensions
}
from
'
vs/workbench/common/actionRegistry
'
;
import
{
Composite
,
CompositeDescriptor
,
CompositeRegistry
}
from
'
vs/workbench/browser/composite
'
;
import
{
IPartService
}
from
'
vs/workbench/services/part/common/partService
'
;
import
{
IWorkspaceContextService
}
from
'
vs/workbench/services/workspace/common/contextService
'
;
export
abstract
class
Panel
extends
Composite
implements
IPanel
{
}
...
...
@@ -64,44 +57,3 @@ export class PanelRegistry extends CompositeRegistry<Panel> {
export
const
Extensions
=
{
Panels
:
'
workbench.contributions.panels
'
};
export
class
ClosePanelAction
extends
Action
{
static
ID
=
'
workbench.action.closePanelAction
'
;
static
LABEL
=
nls
.
localize
(
'
closePanel
'
,
"
Close
"
);
constructor
(
id
:
string
,
name
:
string
,
@
IPartService
private
partService
:
IPartService
)
{
super
(
id
,
name
,
'
close-editor-action
'
);
}
public
run
():
Promise
{
this
.
partService
.
setPanelHidden
(
true
);
return
Promise
.
as
(
true
);
}
}
export
class
TogglePanelAction
extends
Action
{
static
ID
=
'
workbench.action.togglePanelAction
'
;
static
LABEL
=
nls
.
localize
(
'
togglePanel
'
,
"
Toggle Panel Visibility
"
);
constructor
(
id
:
string
,
name
:
string
,
@
IPartService
private
partService
:
IPartService
,
@
IWorkspaceContextService
contextService
:
IWorkspaceContextService
)
{
super
(
id
,
name
,
null
,
!!
contextService
.
getWorkspace
());
}
public
run
():
Promise
{
this
.
partService
.
setPanelHidden
(
!
this
.
partService
.
isPanelHidden
());
return
Promise
.
as
(
true
);
}
}
Registry
.
add
(
Extensions
.
Panels
,
new
PanelRegistry
());
let
actionRegistry
=
<
IWorkbenchActionRegistry
>
Registry
.
as
(
WorkbenchExtensions
.
WorkbenchActions
);
actionRegistry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
TogglePanelAction
,
TogglePanelAction
.
ID
,
TogglePanelAction
.
LABEL
,
{
primary
:
KeyMod
.
CtrlCmd
|
KeyCode
.
KEY_L
}),
nls
.
localize
(
'
view
'
,
"
View
"
));
src/vs/workbench/browser/parts/panel/panelPart.ts
浏览文件 @
b284ed56
...
...
@@ -4,10 +4,15 @@
*--------------------------------------------------------------------------------------------*/
import
'
vs/css!./media/panelPart
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
nls
=
require
(
'
vs/nls
'
);
import
{
TPromise
,
Promise
}
from
'
vs/base/common/winjs.base
'
;
import
{
KeyMod
,
KeyCode
}
from
'
vs/base/common/keyCodes
'
;
import
strings
=
require
(
'
vs/base/common/strings
'
);
import
{
Action
}
from
'
vs/base/common/actions
'
;
import
{
Builder
}
from
'
vs/base/browser/builder
'
;
import
{
Registry
}
from
'
vs/platform/platform
'
;
import
{
SyncActionDescriptor
}
from
'
vs/platform/actions/common/actions
'
;
import
{
IWorkbenchActionRegistry
,
Extensions
as
WorkbenchExtensions
}
from
'
vs/workbench/common/actionRegistry
'
;
import
{
IPanel
}
from
'
vs/workbench/common/panel
'
;
import
{
EventType
as
WorkbenchEventType
,
CompositeEvent
}
from
'
vs/workbench/common/events
'
;
import
{
CompositePart
}
from
'
vs/workbench/browser/parts/compositePart
'
;
...
...
@@ -19,6 +24,7 @@ import {IContextMenuService} from 'vs/platform/contextview/browser/contextView';
import
{
IEventService
}
from
'
vs/platform/event/common/event
'
;
import
{
IMessageService
,
Severity
}
from
'
vs/platform/message/common/message
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IWorkspaceContextService
}
from
'
vs/workbench/services/workspace/common/contextService
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybindingService
'
;
export
class
PanelPart
extends
CompositePart
<
Panel
>
implements
IPanelService
{
...
...
@@ -63,7 +69,7 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
public
createTitleArea
(
parent
:
Builder
):
Builder
{
const
result
=
super
.
createTitleArea
(
parent
);
result
.
addClass
(
'
monaco-editor-background
'
);
return
result
;
}
...
...
@@ -91,3 +97,45 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
return
this
.
hideActiveComposite
();
}
}
export
class
ClosePanelAction
extends
Action
{
static
ID
=
'
workbench.action.closePanelAction
'
;
static
LABEL
=
nls
.
localize
(
'
closePanel
'
,
"
Close
"
);
constructor
(
id
:
string
,
name
:
string
,
@
IPartService
private
partService
:
IPartService
)
{
super
(
id
,
name
,
'
close-editor-action
'
);
}
public
run
():
Promise
{
this
.
partService
.
setPanelHidden
(
true
);
return
Promise
.
as
(
true
);
}
}
export
class
TogglePanelAction
extends
Action
{
static
ID
=
'
workbench.action.togglePanelAction
'
;
static
LABEL
=
nls
.
localize
(
'
togglePanel
'
,
"
Toggle Panel Visibility
"
);
constructor
(
id
:
string
,
name
:
string
,
@
IPartService
private
partService
:
IPartService
,
@
IWorkspaceContextService
contextService
:
IWorkspaceContextService
)
{
super
(
id
,
name
,
null
,
!!
contextService
.
getWorkspace
());
}
public
run
():
Promise
{
this
.
partService
.
setPanelHidden
(
!
this
.
partService
.
isPanelHidden
());
return
Promise
.
as
(
true
);
}
}
Registry
.
add
(
PanelExtensions
.
Panels
,
new
PanelRegistry
());
let
actionRegistry
=
<
IWorkbenchActionRegistry
>
Registry
.
as
(
WorkbenchExtensions
.
WorkbenchActions
);
actionRegistry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
TogglePanelAction
,
TogglePanelAction
.
ID
,
TogglePanelAction
.
LABEL
,
{
primary
:
KeyMod
.
CtrlCmd
|
KeyCode
.
KEY_L
}),
nls
.
localize
(
'
view
'
,
"
View
"
));
src/vs/workbench/browser/workbench.ts
浏览文件 @
b284ed56
...
...
@@ -199,8 +199,8 @@ export class Workbench implements IPartService {
// Register Emitters
this
.
registerEmitters
();
// Load
viewlet
and editors in parallel
let
viewlet
AndEditorPromises
:
Promise
[]
=
[];
// Load
composits
and editors in parallel
let
composite
AndEditorPromises
:
Promise
[]
=
[];
// Show default viewlet unless sidebar is hidden or we dont have a default viewlet
let
registry
=
(
<
ViewletRegistry
>
Registry
.
as
(
ViewletExtensions
.
Viewlets
));
...
...
@@ -211,12 +211,12 @@ export class Workbench implements IPartService {
if
(
!
this
.
sideBarHidden
&&
!!
viewletId
)
{
let
viewletTimerEvent
=
timer
.
start
(
timer
.
Topic
.
STARTUP
,
strings
.
format
(
'
Opening Viewlet: {0}
'
,
viewletId
));
viewlet
AndEditorPromises
.
push
(
this
.
sidebarPart
.
openViewlet
(
viewletId
,
false
).
then
(()
=>
viewletTimerEvent
.
stop
()));
composite
AndEditorPromises
.
push
(
this
.
sidebarPart
.
openViewlet
(
viewletId
,
false
).
then
(()
=>
viewletTimerEvent
.
stop
()));
}
if
(
!
this
.
panelHidden
)
{
const
panelId
=
this
.
storageService
.
get
(
PanelPart
.
activePanelSettingsKey
,
StorageScope
.
WORKSPACE
);
viewlet
AndEditorPromises
.
push
(
this
.
panelPart
.
openPanel
(
panelId
,
false
));
composite
AndEditorPromises
.
push
(
this
.
panelPart
.
openPanel
(
panelId
,
false
));
}
// Check for configured options to open files on startup and resolve if any or open untitled for empty workbench
...
...
@@ -249,7 +249,7 @@ export class Workbench implements IPartService {
}
// Restore editor state (either from last session or with given inputs)
viewlet
AndEditorPromises
.
push
(
resolveEditorInputsPromise
.
then
((
inputs
)
=>
{
composite
AndEditorPromises
.
push
(
resolveEditorInputsPromise
.
then
((
inputs
)
=>
{
return
this
.
editorPart
.
restoreEditorState
(
inputs
,
options
).
then
(()
=>
{
this
.
onEditorOpenedOrClosed
();
// make sure we show the proper background in the editor area
editorTimerEvent
.
stop
();
...
...
@@ -257,7 +257,7 @@ export class Workbench implements IPartService {
}));
// Flag workbench as created once done
Promise
.
join
(
viewlet
AndEditorPromises
).
then
(()
=>
{
Promise
.
join
(
composite
AndEditorPromises
).
then
(()
=>
{
this
.
workbenchCreated
=
true
;
this
.
eventService
.
emit
(
EventType
.
WORKBENCH_CREATED
);
this
.
creationPromiseComplete
(
true
);
...
...
@@ -418,15 +418,17 @@ export class Workbench implements IPartService {
this
.
sideBarHidden
=
true
;
// we hide sidebar in single-file-mode
}
let
r
egistry
=
(
<
ViewletRegistry
>
Registry
.
as
(
ViewletExtensions
.
Viewlets
));
if
(
!
r
egistry
.
getDefaultViewletId
())
{
let
viewletR
egistry
=
(
<
ViewletRegistry
>
Registry
.
as
(
ViewletExtensions
.
Viewlets
));
if
(
!
viewletR
egistry
.
getDefaultViewletId
())
{
this
.
sideBarHidden
=
true
;
// can only hide sidebar if we dont have a default viewlet id
}
// Panel part visibility
let
panelRegistry
=
(
<
PanelRegistry
>
Registry
.
as
(
PanelExtensions
.
Panels
));
this
.
panelHidden
=
this
.
storageService
.
getBoolean
(
Workbench
.
panelHiddenSettingKey
,
StorageScope
.
WORKSPACE
,
true
);
if
(
!!
this
.
workbenchParams
.
options
.
singleFileMode
)
{
this
.
panelHidden
=
true
;
// we hide panel part in single-file-mode
if
(
!!
this
.
workbenchParams
.
options
.
singleFileMode
||
!
panelRegistry
.
getDefaultPanelId
())
{
// we hide panel part in single-file-mode or if there is no default panel
this
.
panelHidden
=
true
;
}
// Sidebar position
...
...
src/vs/workbench/parts/debug/browser/repl.ts
浏览文件 @
b284ed56
...
...
@@ -17,7 +17,8 @@ import viewer = require('vs/workbench/parts/debug/browser/replViewer');
import
debug
=
require
(
'
vs/workbench/parts/debug/common/debug
'
);
import
debugactions
=
require
(
'
vs/workbench/parts/debug/electron-browser/debugActions
'
);
import
replhistory
=
require
(
'
vs/workbench/parts/debug/common/replHistory
'
);
import
{
Panel
,
ClosePanelAction
}
from
'
vs/workbench/browser/panel
'
;
import
{
Panel
}
from
'
vs/workbench/browser/panel
'
;
import
{
ClosePanelAction
}
from
'
vs/workbench/browser/parts/panel/panelPart
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IContextViewService
,
IContextMenuService
}
from
'
vs/platform/contextview/browser/contextView
'
;
import
{
IInstantiationService
,
INullService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录