Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
86cb707a
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,发现更多精彩内容 >>
提交
86cb707a
编写于
5月 05, 2020
作者:
S
SteVen Batten
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixes #97007
上级
b2d07859
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
96 addition
and
13 deletion
+96
-13
src/vs/workbench/browser/parts/compositeBar.ts
src/vs/workbench/browser/parts/compositeBar.ts
+12
-5
src/vs/workbench/browser/parts/panel/media/panelpart.css
src/vs/workbench/browser/parts/panel/media/panelpart.css
+16
-0
src/vs/workbench/browser/parts/panel/panelPart.ts
src/vs/workbench/browser/parts/panel/panelPart.ts
+68
-8
未找到文件。
src/vs/workbench/browser/parts/compositeBar.ts
浏览文件 @
86cb707a
...
...
@@ -41,7 +41,7 @@ export class CompositeDragAndDrop implements ICompositeDragAndDrop {
private
moveComposite
:
(
from
:
string
,
to
:
string
,
before
?:
Before2D
)
=>
void
,
)
{
}
drop
(
data
:
CompositeDragAndDropData
,
targetCompositeId
:
string
,
originalEvent
:
DragEvent
,
before
?:
Before2D
):
void
{
drop
(
data
:
CompositeDragAndDropData
,
targetCompositeId
:
string
|
undefined
,
originalEvent
:
DragEvent
,
before
?:
Before2D
):
void
{
const
dragData
=
data
.
getData
();
if
(
dragData
.
type
===
'
composite
'
)
{
...
...
@@ -50,7 +50,9 @@ export class CompositeDragAndDrop implements ICompositeDragAndDrop {
// ... on the same composite bar
if
(
currentLocation
===
this
.
targetContainerLocation
)
{
this
.
moveComposite
(
dragData
.
id
,
targetCompositeId
,
before
);
if
(
targetCompositeId
)
{
this
.
moveComposite
(
dragData
.
id
,
targetCompositeId
,
before
);
}
}
// ... on a different composite bar
else
{
...
...
@@ -60,7 +62,10 @@ export class CompositeDragAndDrop implements ICompositeDragAndDrop {
}
this
.
viewDescriptorService
.
moveViewContainerToLocation
(
currentContainer
,
this
.
targetContainerLocation
);
this
.
moveComposite
(
currentContainer
.
id
,
targetCompositeId
,
before
);
if
(
targetCompositeId
)
{
this
.
moveComposite
(
currentContainer
.
id
,
targetCompositeId
,
before
);
}
this
.
openComposite
(
currentContainer
.
id
,
true
);
}
...
...
@@ -74,7 +79,9 @@ export class CompositeDragAndDrop implements ICompositeDragAndDrop {
const
newContainer
=
this
.
viewDescriptorService
.
getViewContainerByViewId
(
viewToMove
.
id
)
!
;
this
.
moveComposite
(
newContainer
.
id
,
targetCompositeId
,
before
);
if
(
targetCompositeId
)
{
this
.
moveComposite
(
newContainer
.
id
,
targetCompositeId
,
before
);
}
this
.
openComposite
(
newContainer
.
id
,
true
).
then
(
composite
=>
{
if
(
composite
)
{
...
...
@@ -530,7 +537,7 @@ export class CompositeBar extends Widget implements ICompositeBar {
});
// Add overflow action as needed
if
((
visibleCompositesChange
&&
overflows
)
||
compositeSwitcherBar
.
length
()
===
0
)
{
if
((
visibleCompositesChange
&&
overflows
))
{
this
.
compositeOverflowAction
=
this
.
instantiationService
.
createInstance
(
CompositeOverflowActivityAction
,
()
=>
{
if
(
this
.
compositeOverflowActionViewItem
)
{
this
.
compositeOverflowActionViewItem
.
showMenu
();
...
...
src/vs/workbench/browser/parts/panel/media/panelpart.css
浏览文件 @
86cb707a
...
...
@@ -62,6 +62,22 @@
}
.monaco-workbench
.part.panel
.empty-panel-message-area
{
position
:
absolute
;
display
:
none
;
top
:
0px
;
height
:
100%
;
width
:
100%
;
z-index
:
10
;
}
.monaco-workbench
.part.panel
.empty-panel-message-area.visible
{
display
:
flex
;
align-items
:
center
;
align-content
:
center
;
justify-content
:
center
;
}
.monaco-workbench
.part.panel
>
.composite.title
>
.composite-bar-excess
{
width
:
100px
;
}
...
...
src/vs/workbench/browser/parts/panel/panelPart.ts
浏览文件 @
86cb707a
...
...
@@ -20,13 +20,13 @@ import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
ClosePanelAction
,
PanelActivityAction
,
ToggleMaximizedPanelAction
,
TogglePanelAction
,
PlaceHolderPanelActivityAction
,
PlaceHolderToggleCompositePinnedAction
,
PositionPanelActionConfigs
,
SetPanelPositionAction
}
from
'
vs/workbench/browser/parts/panel/panelActions
'
;
import
{
IThemeService
,
registerThemingParticipant
,
IColorTheme
,
ICssStyleCollector
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
PANEL_BACKGROUND
,
PANEL_BORDER
,
PANEL_ACTIVE_TITLE_FOREGROUND
,
PANEL_INACTIVE_TITLE_FOREGROUND
,
PANEL_ACTIVE_TITLE_BORDER
,
PANEL_DRAG_AND_DROP_BACKGROUND
,
PANEL_INPUT_BORDER
}
from
'
vs/workbench/common/theme
'
;
import
{
PANEL_BACKGROUND
,
PANEL_BORDER
,
PANEL_ACTIVE_TITLE_FOREGROUND
,
PANEL_INACTIVE_TITLE_FOREGROUND
,
PANEL_ACTIVE_TITLE_BORDER
,
PANEL_DRAG_AND_DROP_BACKGROUND
,
PANEL_INPUT_BORDER
,
EDITOR_DRAG_AND_DROP_BACKGROUND
}
from
'
vs/workbench/common/theme
'
;
import
{
activeContrastBorder
,
focusBorder
,
contrastBorder
,
editorBackground
,
badgeBackground
,
badgeForeground
}
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
CompositeBar
,
ICompositeBarItem
,
CompositeDragAndDrop
}
from
'
vs/workbench/browser/parts/compositeBar
'
;
import
{
ToggleCompositePinnedAction
}
from
'
vs/workbench/browser/parts/compositeBarActions
'
;
import
{
IBadge
}
from
'
vs/workbench/services/activity/common/activity
'
;
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
import
{
Dimension
,
trackFocus
}
from
'
vs/base/browser/dom
'
;
import
{
Dimension
,
trackFocus
,
addClass
,
toggleClass
,
EventHelper
}
from
'
vs/base/browser/dom
'
;
import
{
localize
}
from
'
vs/nls
'
;
import
{
IDisposable
,
DisposableStore
}
from
'
vs/base/common/lifecycle
'
;
import
{
IContextKey
,
IContextKeyService
,
ContextKeyExpr
}
from
'
vs/platform/contextkey/common/contextkey
'
;
...
...
@@ -38,7 +38,7 @@ import { MenuId } from 'vs/platform/actions/common/actions';
import
{
ViewMenuActions
}
from
'
vs/workbench/browser/parts/views/viewMenuActions
'
;
import
{
IPaneComposite
}
from
'
vs/workbench/common/panecomposite
'
;
import
{
IStorageKeysSyncRegistryService
}
from
'
vs/platform/userDataSync/common/storageKeys
'
;
import
{
Before2D
}
from
'
vs/workbench/browser/dnd
'
;
import
{
Before2D
,
CompositeDragAndDropObserver
,
ICompositeDragAndDrop
}
from
'
vs/workbench/browser/dnd
'
;
import
{
IActivity
}
from
'
vs/workbench/common/activity
'
;
interface
ICachedPanel
{
...
...
@@ -96,6 +96,8 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
private
panelRegistry
:
PanelRegistry
;
private
dndHandler
:
ICompositeDragAndDrop
;
constructor
(
@
INotificationService
notificationService
:
INotificationService
,
@
IStorageService
storageService
:
IStorageService
,
...
...
@@ -132,6 +134,11 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
this
.
panelRegistry
=
Registry
.
as
<
PanelRegistry
>
(
PanelExtensions
.
Panels
);
storageKeysSyncRegistryService
.
registerStorageKey
({
key
:
PanelPart
.
PINNED_PANELS
,
version
:
1
});
this
.
dndHandler
=
new
CompositeDragAndDrop
(
this
.
viewDescriptorService
,
ViewContainerLocation
.
Panel
,
(
id
:
string
,
focus
?:
boolean
)
=>
(
this
.
openPanel
(
id
,
focus
)
as
Promise
<
IPaneComposite
|
undefined
>
).
then
(
panel
=>
panel
||
null
),
(
from
:
string
,
to
:
string
,
before
?:
Before2D
)
=>
this
.
compositeBar
.
move
(
from
,
to
,
before
?.
horizontallyBefore
)
);
this
.
compositeBar
=
this
.
_register
(
this
.
instantiationService
.
createInstance
(
CompositeBar
,
this
.
getCachedPanels
(),
{
icon
:
false
,
orientation
:
ActionsOrientation
.
HORIZONTAL
,
...
...
@@ -149,10 +156,7 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
getContextMenuActionsForComposite
:
(
compositeId
:
string
)
=>
this
.
getContextMenuActionsForComposite
(
compositeId
)
as
Action
[],
getDefaultCompositeId
:
()
=>
this
.
panelRegistry
.
getDefaultPanelId
(),
hidePart
:
()
=>
this
.
layoutService
.
setPanelHidden
(
true
),
dndHandler
:
new
CompositeDragAndDrop
(
this
.
viewDescriptorService
,
ViewContainerLocation
.
Panel
,
(
id
:
string
,
focus
?:
boolean
)
=>
(
this
.
openPanel
(
id
,
focus
)
as
Promise
<
IPaneComposite
|
undefined
>
).
then
(
panel
=>
panel
||
null
),
(
from
:
string
,
to
:
string
,
before
?:
Before2D
)
=>
this
.
compositeBar
.
move
(
from
,
to
,
before
?.
horizontallyBefore
)
),
dndHandler
:
this
.
dndHandler
,
compositeSize
:
0
,
overflowActionSize
:
44
,
colors
:
(
theme
:
IColorTheme
)
=>
({
...
...
@@ -192,7 +196,7 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
for
(
const
panel
of
panels
)
{
const
cachedPanel
=
this
.
getCachedPanels
().
filter
(({
id
})
=>
id
===
panel
.
id
)[
0
];
const
activePanel
=
this
.
getActivePanel
();
const
isActive
=
activePanel
?.
getId
()
===
panel
.
id
;
const
isActive
=
activePanel
?.
getId
()
===
panel
.
id
||
(
!
activePanel
&&
this
.
getLastActivePanelId
()
===
panel
.
id
)
;
if
(
isActive
||
!
this
.
shouldBeHidden
(
panel
.
id
,
cachedPanel
))
{
this
.
compositeBar
.
addComposite
(
panel
);
...
...
@@ -203,6 +207,10 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
}
if
(
isActive
)
{
if
(
!
activePanel
)
{
this
.
doOpenPanel
(
panel
.
id
);
}
this
.
compositeBar
.
activateComposite
(
panel
.
id
);
}
}
...
...
@@ -352,6 +360,7 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
}
this
.
layoutCompositeBar
();
// Need to relayout composite bar since different panels have different action bar width
this
.
layoutEmptyMessage
();
}
private
onPanelClose
(
panel
:
IPanel
):
void
{
...
...
@@ -362,6 +371,7 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
}
this
.
compositeBar
.
deactivateComposite
(
panel
.
getId
());
this
.
layoutEmptyMessage
();
}
create
(
parent
:
HTMLElement
):
void
{
...
...
@@ -369,11 +379,51 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
super
.
create
(
parent
);
this
.
createEmptyPanelMessage
();
const
focusTracker
=
this
.
_register
(
trackFocus
(
parent
));
this
.
_register
(
focusTracker
.
onDidFocus
(()
=>
this
.
panelFocusContextKey
.
set
(
true
)));
this
.
_register
(
focusTracker
.
onDidBlur
(()
=>
this
.
panelFocusContextKey
.
set
(
false
)));
}
private
createEmptyPanelMessage
():
void
{
this
.
emptyPanelMessageElement
=
document
.
createElement
(
'
div
'
);
addClass
(
this
.
emptyPanelMessageElement
,
'
empty-panel-message-area
'
);
const
messageElement
=
document
.
createElement
(
'
div
'
);
addClass
(
messageElement
,
'
empty-panel-message
'
);
messageElement
.
innerText
=
localize
(
'
panel.emptyMessage
'
,
"
No panels to display. Drag a view into the panel.
"
);
this
.
emptyPanelMessageElement
.
appendChild
(
messageElement
);
this
.
element
.
appendChild
(
this
.
emptyPanelMessageElement
);
this
.
_register
(
CompositeDragAndDropObserver
.
INSTANCE
.
registerTarget
(
this
.
emptyPanelMessageElement
,
{
onDragOver
:
(
e
)
=>
{
EventHelper
.
stop
(
e
.
eventData
,
true
);
},
onDragEnter
:
(
e
)
=>
{
EventHelper
.
stop
(
e
.
eventData
,
true
);
const
validDropTarget
=
this
.
dndHandler
.
onDragEnter
(
e
.
dragAndDropData
,
undefined
,
e
.
eventData
);
this
.
emptyPanelMessageElement
!
.
style
.
backgroundColor
=
validDropTarget
?
this
.
theme
.
getColor
(
EDITOR_DRAG_AND_DROP_BACKGROUND
)?.
toString
()
||
''
:
''
;
},
onDragLeave
:
(
e
)
=>
{
EventHelper
.
stop
(
e
.
eventData
,
true
);
this
.
emptyPanelMessageElement
!
.
style
.
backgroundColor
=
''
;
},
onDragEnd
:
(
e
)
=>
{
EventHelper
.
stop
(
e
.
eventData
,
true
);
this
.
emptyPanelMessageElement
!
.
style
.
backgroundColor
=
''
;
},
onDrop
:
(
e
)
=>
{
EventHelper
.
stop
(
e
.
eventData
,
true
);
this
.
emptyPanelMessageElement
!
.
style
.
backgroundColor
=
''
;
this
.
dndHandler
.
drop
(
e
.
dragAndDropData
,
undefined
,
e
.
eventData
);
},
}));
}
updateStyles
():
void
{
super
.
updateStyles
();
...
...
@@ -508,6 +558,9 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
// Layout composite bar
this
.
layoutCompositeBar
();
// Add empty panel message
this
.
layoutEmptyMessage
();
}
private
layoutCompositeBar
():
void
{
...
...
@@ -521,6 +574,13 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
}
}
private
emptyPanelMessageElement
:
HTMLElement
|
undefined
;
private
layoutEmptyMessage
():
void
{
if
(
this
.
emptyPanelMessageElement
)
{
toggleClass
(
this
.
emptyPanelMessageElement
,
'
visible
'
,
this
.
compositeBar
.
getVisibleComposites
().
length
===
0
);
}
}
private
getCompositeActions
(
compositeId
:
string
):
{
activityAction
:
PanelActivityAction
,
pinnedAction
:
ToggleCompositePinnedAction
;
}
{
let
compositeActions
=
this
.
compositeActions
.
get
(
compositeId
);
if
(
!
compositeActions
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录