Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
1cc7dd40
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,发现更多精彩内容 >>
提交
1cc7dd40
编写于
10月 25, 2018
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
setVisible do not lie to the world, you are not async
上级
3dd2b19b
变更
38
隐藏空白更改
内联
并排
Showing
38 changed file
with
339 addition
and
379 deletion
+339
-379
src/vs/workbench/api/electron-browser/mainThreadOutputService.ts
...workbench/api/electron-browser/mainThreadOutputService.ts
+1
-1
src/vs/workbench/browser/actions/toggleSidebarVisibility.ts
src/vs/workbench/browser/actions/toggleSidebarVisibility.ts
+2
-1
src/vs/workbench/browser/composite.ts
src/vs/workbench/browser/composite.ts
+3
-6
src/vs/workbench/browser/layout.ts
src/vs/workbench/browser/layout.ts
+11
-13
src/vs/workbench/browser/panel.ts
src/vs/workbench/browser/panel.ts
+4
-2
src/vs/workbench/browser/parts/activitybar/activitybarActions.ts
...workbench/browser/parts/activitybar/activitybarActions.ts
+4
-2
src/vs/workbench/browser/parts/compositeBar.ts
src/vs/workbench/browser/parts/compositeBar.ts
+1
-1
src/vs/workbench/browser/parts/compositePart.ts
src/vs/workbench/browser/parts/compositePart.ts
+51
-68
src/vs/workbench/browser/parts/editor/editorActions.ts
src/vs/workbench/browser/parts/editor/editorActions.ts
+1
-2
src/vs/workbench/browser/parts/panel/panelActions.ts
src/vs/workbench/browser/parts/panel/panelActions.ts
+19
-9
src/vs/workbench/browser/parts/panel/panelPart.ts
src/vs/workbench/browser/parts/panel/panelPart.ts
+7
-9
src/vs/workbench/browser/parts/sidebar/sidebarPart.ts
src/vs/workbench/browser/parts/sidebar/sidebarPart.ts
+7
-8
src/vs/workbench/browser/parts/views/customView.ts
src/vs/workbench/browser/parts/views/customView.ts
+3
-2
src/vs/workbench/browser/parts/views/panelViewlet.ts
src/vs/workbench/browser/parts/views/panelViewlet.ts
+1
-4
src/vs/workbench/browser/parts/views/viewsViewlet.ts
src/vs/workbench/browser/parts/views/viewsViewlet.ts
+7
-9
src/vs/workbench/electron-browser/actions.ts
src/vs/workbench/electron-browser/actions.ts
+46
-52
src/vs/workbench/electron-browser/workbench.ts
src/vs/workbench/electron-browser/workbench.ts
+57
-60
src/vs/workbench/parts/debug/browser/breakpointsView.ts
src/vs/workbench/parts/debug/browser/breakpointsView.ts
+5
-6
src/vs/workbench/parts/debug/browser/debugActions.ts
src/vs/workbench/parts/debug/browser/debugActions.ts
+2
-1
src/vs/workbench/parts/debug/electron-browser/callStackView.ts
...s/workbench/parts/debug/electron-browser/callStackView.ts
+5
-6
src/vs/workbench/parts/debug/electron-browser/debugService.ts
...vs/workbench/parts/debug/electron-browser/debugService.ts
+2
-1
src/vs/workbench/parts/debug/electron-browser/variablesView.ts
...s/workbench/parts/debug/electron-browser/variablesView.ts
+5
-6
src/vs/workbench/parts/debug/electron-browser/watchExpressionsView.ts
...ench/parts/debug/electron-browser/watchExpressionsView.ts
+5
-6
src/vs/workbench/parts/extensions/electron-browser/extensionsViewlet.ts
...ch/parts/extensions/electron-browser/extensionsViewlet.ts
+6
-7
src/vs/workbench/parts/files/electron-browser/explorerViewlet.ts
...workbench/parts/files/electron-browser/explorerViewlet.ts
+2
-2
src/vs/workbench/parts/files/electron-browser/views/explorerView.ts
...kbench/parts/files/electron-browser/views/explorerView.ts
+39
-42
src/vs/workbench/parts/files/electron-browser/views/openEditorsView.ts
...nch/parts/files/electron-browser/views/openEditorsView.ts
+6
-7
src/vs/workbench/parts/markers/electron-browser/markersPanelActions.ts
...nch/parts/markers/electron-browser/markersPanelActions.ts
+3
-2
src/vs/workbench/parts/outline/electron-browser/outlinePanel.ts
.../workbench/parts/outline/electron-browser/outlinePanel.ts
+2
-3
src/vs/workbench/parts/output/electron-browser/outputServices.ts
...workbench/parts/output/electron-browser/outputServices.ts
+3
-3
src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts
src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts
+3
-6
src/vs/workbench/parts/search/browser/searchActions.ts
src/vs/workbench/parts/search/browser/searchActions.ts
+1
-1
src/vs/workbench/parts/search/browser/searchView.ts
src/vs/workbench/parts/search/browser/searchView.ts
+3
-6
src/vs/workbench/parts/terminal/common/terminalService.ts
src/vs/workbench/parts/terminal/common/terminalService.ts
+15
-16
src/vs/workbench/services/panel/common/panelService.ts
src/vs/workbench/services/panel/common/panelService.ts
+1
-2
src/vs/workbench/services/part/common/partService.ts
src/vs/workbench/services/part/common/partService.ts
+3
-4
src/vs/workbench/services/progress/test/progressService.test.ts
.../workbench/services/progress/test/progressService.test.ts
+2
-2
src/vs/workbench/services/viewlet/browser/viewletService.ts
src/vs/workbench/services/viewlet/browser/viewletService.ts
+1
-1
未找到文件。
src/vs/workbench/api/electron-browser/mainThreadOutputService.ts
浏览文件 @
1cc7dd40
...
...
@@ -92,7 +92,7 @@ export class MainThreadOutputService extends Disposable implements MainThreadOut
public
$close
(
channelId
:
string
):
Thenable
<
void
>
{
const
panel
=
this
.
_panelService
.
getActivePanel
();
if
(
panel
&&
panel
.
getId
()
===
OUTPUT_PANEL_ID
&&
channelId
===
this
.
_outputService
.
getActiveChannel
().
id
)
{
return
this
.
_partService
.
setPanelHidden
(
true
);
this
.
_partService
.
setPanelHidden
(
true
);
}
return
undefined
;
...
...
src/vs/workbench/browser/actions/toggleSidebarVisibility.ts
浏览文件 @
1cc7dd40
...
...
@@ -28,8 +28,9 @@ export class ToggleSidebarVisibilityAction extends Action {
run
():
Thenable
<
any
>
{
const
hideSidebar
=
this
.
partService
.
isVisible
(
Parts
.
SIDEBAR_PART
);
this
.
partService
.
setSideBarHidden
(
hideSidebar
);
return
this
.
partService
.
setSideBarHidden
(
hideSidebar
);
return
Promise
.
resolve
(
null
);
}
}
...
...
src/vs/workbench/browser/composite.ts
浏览文件 @
1cc7dd40
...
...
@@ -118,14 +118,11 @@ export abstract class Composite extends Component implements IComposite {
* is called more than once during workbench lifecycle depending on the user interaction.
* The composite will be on-DOM if visible is set to true and off-DOM otherwise.
*
* The returned promise is complete when the composite is visible. As such it is valid
* to do a long running operation from this call. Typically this operation should be
* fast though because setVisible might be called many times during a session.
* Typically this operation should be fast though because setVisible might be called many times during a session.
* If there is a long running opertaion it is fine to have it running in the background asyncly and return before.
*/
setVisible
(
visible
:
boolean
):
Promise
<
void
>
{
setVisible
(
visible
:
boolean
):
void
{
this
.
visible
=
visible
;
return
Promise
.
resolve
(
null
);
}
/**
...
...
src/vs/workbench/browser/layout.ts
浏览文件 @
1cc7dd40
...
...
@@ -261,7 +261,6 @@ export class WorkbenchLayout extends Disposable implements IVerticalSashLayoutPr
let
sidebarPosition
=
this
.
partService
.
getSideBarPosition
();
let
isSidebarVisible
=
this
.
partService
.
isVisible
(
Parts
.
SIDEBAR_PART
);
let
newSashWidth
=
(
sidebarPosition
===
Position
.
LEFT
)
?
startSidebarWidth
+
e
.
currentX
-
startX
:
startSidebarWidth
-
e
.
currentX
+
startX
;
let
promise
:
Thenable
<
void
>
=
Promise
.
resolve
<
void
>
(
null
);
// Sidebar visible
if
(
isSidebarVisible
)
{
...
...
@@ -269,7 +268,7 @@ export class WorkbenchLayout extends Disposable implements IVerticalSashLayoutPr
// Automatically hide side bar when a certain threshold is met
if
(
newSashWidth
+
HIDE_SIDEBAR_WIDTH_THRESHOLD
<
this
.
partLayoutInfo
.
sidebar
.
minWidth
)
{
let
dragCompensation
=
this
.
partLayoutInfo
.
sidebar
.
minWidth
-
HIDE_SIDEBAR_WIDTH_THRESHOLD
;
promise
=
this
.
partService
.
setSideBarHidden
(
true
);
this
.
partService
.
setSideBarHidden
(
true
);
startX
=
(
sidebarPosition
===
Position
.
LEFT
)
?
Math
.
max
(
this
.
activitybarWidth
,
e
.
currentX
-
dragCompensation
)
:
Math
.
min
(
e
.
currentX
+
dragCompensation
,
this
.
workbenchSize
.
width
-
this
.
activitybarWidth
);
this
.
sidebarWidth
=
startSidebarWidth
;
// when restoring sidebar, restore to the sidebar width we started from
}
...
...
@@ -287,12 +286,12 @@ export class WorkbenchLayout extends Disposable implements IVerticalSashLayoutPr
(
sidebarPosition
===
Position
.
RIGHT
&&
startX
-
e
.
currentX
>=
this
.
partLayoutInfo
.
sidebar
.
minWidth
))
{
startSidebarWidth
=
this
.
partLayoutInfo
.
sidebar
.
minWidth
-
(
sidebarPosition
===
Position
.
LEFT
?
e
.
currentX
-
startX
:
startX
-
e
.
currentX
);
this
.
sidebarWidth
=
this
.
partLayoutInfo
.
sidebar
.
minWidth
;
promise
=
this
.
partService
.
setSideBarHidden
(
false
);
this
.
partService
.
setSideBarHidden
(
false
);
}
}
if
(
doLayout
)
{
promise
.
then
(()
=>
this
.
layout
({
source
:
Parts
.
SIDEBAR_PART
})
);
this
.
layout
({
source
:
Parts
.
SIDEBAR_PART
}
);
}
}));
...
...
@@ -300,7 +299,6 @@ export class WorkbenchLayout extends Disposable implements IVerticalSashLayoutPr
let
doLayout
=
false
;
let
isPanelVisible
=
this
.
partService
.
isVisible
(
Parts
.
PANEL_PART
);
let
newSashHeight
=
startPanelHeight
-
(
e
.
currentY
-
startY
);
let
promise
:
Thenable
<
void
>
=
Promise
.
resolve
<
void
>
(
null
);
// Panel visible
if
(
isPanelVisible
)
{
...
...
@@ -308,7 +306,7 @@ export class WorkbenchLayout extends Disposable implements IVerticalSashLayoutPr
// Automatically hide panel when a certain threshold is met
if
(
newSashHeight
+
HIDE_PANEL_HEIGHT_THRESHOLD
<
this
.
partLayoutInfo
.
panel
.
minHeight
)
{
let
dragCompensation
=
this
.
partLayoutInfo
.
panel
.
minHeight
-
HIDE_PANEL_HEIGHT_THRESHOLD
;
promise
=
this
.
partService
.
setPanelHidden
(
true
);
this
.
partService
.
setPanelHidden
(
true
);
startY
=
Math
.
min
(
this
.
sidebarHeight
-
this
.
statusbarHeight
-
this
.
titlebarHeight
,
e
.
currentY
+
dragCompensation
);
this
.
panelHeight
=
startPanelHeight
;
// when restoring panel, restore to the panel height we started from
}
...
...
@@ -325,12 +323,12 @@ export class WorkbenchLayout extends Disposable implements IVerticalSashLayoutPr
if
(
startY
-
e
.
currentY
>=
this
.
partLayoutInfo
.
panel
.
minHeight
)
{
startPanelHeight
=
0
;
this
.
panelHeight
=
this
.
partLayoutInfo
.
panel
.
minHeight
;
promise
=
this
.
partService
.
setPanelHidden
(
false
);
this
.
partService
.
setPanelHidden
(
false
);
}
}
if
(
doLayout
)
{
promise
.
then
(()
=>
this
.
layout
({
source
:
Parts
.
PANEL_PART
})
);
this
.
layout
({
source
:
Parts
.
PANEL_PART
}
);
}
}));
...
...
@@ -338,7 +336,6 @@ export class WorkbenchLayout extends Disposable implements IVerticalSashLayoutPr
let
doLayout
=
false
;
let
isPanelVisible
=
this
.
partService
.
isVisible
(
Parts
.
PANEL_PART
);
let
newSashWidth
=
startPanelWidth
-
(
e
.
currentX
-
startXTwo
);
let
promise
:
Thenable
<
void
>
=
Promise
.
resolve
<
void
>
(
null
);
// Panel visible
if
(
isPanelVisible
)
{
...
...
@@ -346,7 +343,7 @@ export class WorkbenchLayout extends Disposable implements IVerticalSashLayoutPr
// Automatically hide panel when a certain threshold is met
if
(
newSashWidth
+
HIDE_PANEL_WIDTH_THRESHOLD
<
this
.
partLayoutInfo
.
panel
.
minWidth
)
{
let
dragCompensation
=
this
.
partLayoutInfo
.
panel
.
minWidth
-
HIDE_PANEL_WIDTH_THRESHOLD
;
promise
=
this
.
partService
.
setPanelHidden
(
true
);
this
.
partService
.
setPanelHidden
(
true
);
startXTwo
=
Math
.
min
(
this
.
workbenchSize
.
width
-
this
.
activitybarWidth
,
e
.
currentX
+
dragCompensation
);
this
.
panelWidth
=
startPanelWidth
;
// when restoring panel, restore to the panel height we started from
}
...
...
@@ -363,12 +360,12 @@ export class WorkbenchLayout extends Disposable implements IVerticalSashLayoutPr
if
(
startXTwo
-
e
.
currentX
>=
this
.
partLayoutInfo
.
panel
.
minWidth
)
{
startPanelWidth
=
0
;
this
.
panelWidth
=
this
.
partLayoutInfo
.
panel
.
minWidth
;
promise
=
this
.
partService
.
setPanelHidden
(
false
);
this
.
partService
.
setPanelHidden
(
false
);
}
}
if
(
doLayout
)
{
promise
.
then
(()
=>
this
.
layout
({
source
:
Parts
.
PANEL_PART
})
);
this
.
layout
({
source
:
Parts
.
PANEL_PART
}
);
}
}));
...
...
@@ -397,7 +394,8 @@ export class WorkbenchLayout extends Disposable implements IVerticalSashLayoutPr
this
.
sidebarWidth
=
Math
.
max
(
optimalWidth
,
DEFAULT_SIDEBAR_PART_WIDTH
);
this
.
storageService
.
store
(
WorkbenchLayout
.
sashXOneWidthSettingsKey
,
this
.
sidebarWidth
,
StorageScope
.
GLOBAL
);
this
.
partService
.
setSideBarHidden
(
false
).
then
(()
=>
this
.
layout
());
this
.
partService
.
setSideBarHidden
(
false
);
this
.
layout
();
}));
this
.
_register
(
this
.
sashXTwo
.
onDidReset
(()
=>
{
...
...
src/vs/workbench/browser/panel.ts
浏览文件 @
1cc7dd40
...
...
@@ -77,10 +77,12 @@ export abstract class TogglePanelAction extends Action {
run
():
Thenable
<
any
>
{
if
(
this
.
isPanelFocused
())
{
return
this
.
partService
.
setPanelHidden
(
true
);
this
.
partService
.
setPanelHidden
(
true
);
}
else
{
this
.
panelService
.
openPanel
(
this
.
panelId
,
true
);
}
return
this
.
panelService
.
openPanel
(
this
.
panelId
,
true
);
return
Promise
.
resolve
(
null
);
}
private
isPanelActive
():
boolean
{
...
...
src/vs/workbench/browser/parts/activitybar/activitybarActions.ts
浏览文件 @
1cc7dd40
...
...
@@ -62,7 +62,8 @@ export class ViewletActivityAction extends ActivityAction {
// Hide sidebar if selected viewlet already visible
if
(
sideBarVisible
&&
activeViewlet
&&
activeViewlet
.
getId
()
===
this
.
activity
.
id
)
{
this
.
logAction
(
'
hide
'
);
return
this
.
partService
.
setSideBarHidden
(
true
);
this
.
partService
.
setSideBarHidden
(
true
);
return
Promise
.
resolve
(
null
);
}
this
.
logAction
(
'
show
'
);
...
...
@@ -96,7 +97,8 @@ export class ToggleViewletAction extends Action {
// Hide sidebar if selected viewlet already visible
if
(
sideBarVisible
&&
activeViewlet
&&
activeViewlet
.
getId
()
===
this
.
_viewlet
.
id
)
{
return
this
.
partService
.
setSideBarHidden
(
true
);
this
.
partService
.
setSideBarHidden
(
true
);
return
Promise
.
resolve
(
null
);
}
return
this
.
viewletService
.
openViewlet
(
this
.
_viewlet
.
id
,
true
);
...
...
src/vs/workbench/browser/parts/compositeBar.ts
浏览文件 @
1cc7dd40
...
...
@@ -35,7 +35,7 @@ export interface ICompositeBarOptions {
getContextMenuActions
:
()
=>
Action
[];
openComposite
:
(
compositeId
:
string
)
=>
TPromise
<
any
>
;
getDefaultCompositeId
:
()
=>
string
;
hidePart
:
()
=>
TPromise
<
any
>
;
hidePart
:
()
=>
void
;
}
export
class
CompositeBar
extends
Widget
implements
ICompositeBar
{
...
...
src/vs/workbench/browser/parts/compositePart.ts
浏览文件 @
1cc7dd40
...
...
@@ -6,11 +6,9 @@
import
'
vs/css!./media/compositepart
'
;
import
*
as
nls
from
'
vs/nls
'
;
import
{
defaultGenerator
}
from
'
vs/base/common/idGenerator
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
*
as
strings
from
'
vs/base/common/strings
'
;
import
{
Emitter
}
from
'
vs/base/common/event
'
;
import
*
as
types
from
'
vs/base/common/types
'
;
import
*
as
errors
from
'
vs/base/common/errors
'
;
import
{
ToolBar
}
from
'
vs/base/browser/ui/toolbar/toolbar
'
;
import
{
IActionItem
,
ActionsOrientation
}
from
'
vs/base/browser/ui/actionbar/actionbar
'
;
...
...
@@ -96,7 +94,7 @@ export abstract class CompositePart<T extends Composite> extends Part {
this
.
lastActiveCompositeId
=
storageService
.
get
(
activeCompositeSettingsKey
,
StorageScope
.
WORKSPACE
,
this
.
defaultCompositeId
);
}
protected
openComposite
(
id
:
string
,
focus
?:
boolean
):
TPromise
<
Composite
>
{
protected
openComposite
(
id
:
string
,
focus
?:
boolean
):
Composite
{
// Check if composite already visible and just focus in that case
if
(
this
.
activeComposite
&&
this
.
activeComposite
.
getId
()
===
id
)
{
if
(
focus
)
{
...
...
@@ -104,66 +102,57 @@ export abstract class CompositePart<T extends Composite> extends Part {
}
// Fullfill promise with composite that is being opened
return
Promise
.
resolve
(
this
.
activeComposite
)
;
return
this
.
activeComposite
;
}
// Open
return
this
.
doOpenComposite
(
id
,
focus
);
}
private
doOpenComposite
(
id
:
string
,
focus
?:
boolean
):
TPromise
<
Composite
>
{
private
doOpenComposite
(
id
:
string
,
focus
?:
boolean
):
Composite
{
// Use a generated token to avoid race conditions from long running promises
const
currentCompositeOpenToken
=
defaultGenerator
.
nextId
();
this
.
currentCompositeOpenToken
=
currentCompositeOpenToken
;
// Hide current
let
hidePromise
:
TPromise
<
Composite
>
;
if
(
this
.
activeComposite
)
{
hidePromise
=
this
.
hideActiveComposite
();
}
else
{
hidePromise
=
Promise
.
resolve
(
null
);
this
.
hideActiveComposite
();
}
return
hidePromise
.
then
(()
=>
{
// Update Title
this
.
updateTitle
(
id
);
// Update Titl
e
this
.
updateTitle
(
id
);
// Create composit
e
const
composite
=
this
.
createComposite
(
id
,
true
);
// Create composite
const
composite
=
this
.
createComposite
(
id
,
true
);
// Check if another composite opened meanwhile and return in that case
if
((
this
.
currentCompositeOpenToken
!==
currentCompositeOpenToken
)
||
(
this
.
activeComposite
&&
this
.
activeComposite
.
getId
()
!==
composite
.
getId
()))
{
return
undefined
;
}
// Check if another composite opened meanwhile and return in that case
if
((
this
.
currentCompositeOpenToken
!==
currentCompositeOpenToken
)
||
(
this
.
activeComposite
&&
this
.
activeComposite
.
getId
()
!==
composite
.
getId
()))
{
return
Promise
.
resolve
(
null
);
// Check if composite already visible and just focus in that case
if
(
this
.
activeComposite
&&
this
.
activeComposite
.
getId
()
===
composite
.
getId
())
{
if
(
focus
)
{
composite
.
focus
();
}
// Check if composite already visible and just focus in that case
if
(
this
.
activeComposite
&&
this
.
activeComposite
.
getId
()
===
composite
.
getId
())
{
if
(
focus
)
{
composite
.
focus
();
}
this
.
_onDidCompositeOpen
.
fire
({
composite
,
focus
});
return
composite
;
}
// Fullfill promise with composite that is being opened
return
Promise
.
resolve
(
composite
);
}
// Show Composite and Focus
this
.
showComposite
(
composite
);
if
(
focus
)
{
composite
.
focus
();
}
// Show Composite and Focus
return
this
.
showComposite
(
composite
).
then
(()
=>
{
if
(
focus
)
{
composite
.
focus
();
}
// Fullfill promise with composite that is being opened
return
composite
;
});
}).
then
(
composite
=>
{
if
(
composite
)
{
this
.
_onDidCompositeOpen
.
fire
({
composite
,
focus
});
}
// Return with the composite that is being opened
if
(
composite
)
{
this
.
_onDidCompositeOpen
.
fire
({
composite
,
focus
});
}
return
composite
;
});
return
composite
;
}
protected
createComposite
(
id
:
string
,
isActive
?:
boolean
):
Composite
{
...
...
@@ -196,7 +185,7 @@ export abstract class CompositePart<T extends Composite> extends Part {
throw
new
Error
(
strings
.
format
(
'
Unable to find composite with id {0}
'
,
id
));
}
protected
showComposite
(
composite
:
Composite
):
TPromise
<
void
>
{
protected
showComposite
(
composite
:
Composite
):
void
{
// Remember Composite
this
.
activeComposite
=
composite
;
...
...
@@ -287,18 +276,17 @@ export abstract class CompositePart<T extends Composite> extends Part {
});
// Indicate to composite that it is now visible
return
composite
.
setVisible
(
true
).
then
(()
=>
{
composite
.
setVisible
(
true
);
// Make sure that the user meanwhile did not open another composite or closed the part containing the composite
if
(
!
this
.
activeComposite
||
composite
.
getId
()
!==
this
.
activeComposite
.
getId
())
{
return
;
}
// Make sure that the user meanwhile did not open another composite or closed the part containing the composite
if
(
!
this
.
activeComposite
||
composite
.
getId
()
!==
this
.
activeComposite
.
getId
())
{
return
;
}
// Make sure the composite is layed out
if
(
this
.
contentAreaSize
)
{
composite
.
layout
(
this
.
contentAreaSize
);
}
},
error
=>
this
.
onError
(
error
));
// Make sure the composite is layed out
if
(
this
.
contentAreaSize
)
{
composite
.
layout
(
this
.
contentAreaSize
);
}
}
protected
onTitleAreaUpdate
(
compositeId
:
string
):
void
{
...
...
@@ -360,9 +348,9 @@ export abstract class CompositePart<T extends Composite> extends Part {
return
this
.
lastActiveCompositeId
;
}
protected
hideActiveComposite
():
TPromise
<
Composite
>
{
protected
hideActiveComposite
():
Composite
{
if
(
!
this
.
activeComposite
)
{
return
Promise
.
resolve
(
null
)
;
// Nothing to do
return
undefined
;
// Nothing to do
}
const
composite
=
this
.
activeComposite
;
...
...
@@ -371,21 +359,20 @@ export abstract class CompositePart<T extends Composite> extends Part {
const
compositeContainer
=
this
.
mapCompositeToCompositeContainer
[
composite
.
getId
()];
// Indicate to Composite
return
composite
.
setVisible
(
false
).
then
(()
=>
{
composite
.
setVisible
(
false
);
// Take Container Off-DOM and hide
compositeContainer
.
remove
();
hide
(
compositeContainer
);
// Take Container Off-DOM and hide
compositeContainer
.
remove
();
hide
(
compositeContainer
);
// Clear any running Progress
this
.
progressBar
.
stop
().
hide
();
// Clear any running Progress
this
.
progressBar
.
stop
().
hide
();
// Empty Actions
this
.
toolBar
.
setActions
([])();
this
.
_onDidCompositeClose
.
fire
(
composite
);
// Empty Actions
this
.
toolBar
.
setActions
([])();
this
.
_onDidCompositeClose
.
fire
(
composite
);
return
composite
;
});
return
composite
;
}
createTitleArea
(
parent
:
HTMLElement
):
HTMLElement
{
...
...
@@ -454,10 +441,6 @@ export abstract class CompositePart<T extends Composite> extends Part {
return
contentContainer
;
}
private
onError
(
error
:
any
):
void
{
this
.
notificationService
.
error
(
types
.
isString
(
error
)
?
new
Error
(
error
)
:
error
);
}
getProgressIndicator
(
id
:
string
):
IProgressService
{
return
this
.
mapProgressServiceToComposite
[
id
];
}
...
...
src/vs/workbench/browser/parts/editor/editorActions.ts
浏览文件 @
1cc7dd40
...
...
@@ -897,8 +897,7 @@ export class MaximizeGroupAction extends Action {
run
():
Thenable
<
any
>
{
if
(
this
.
editorService
.
activeEditor
)
{
this
.
editorGroupService
.
arrangeGroups
(
GroupsArrangement
.
MINIMIZE_OTHERS
);
return
this
.
partService
.
setSideBarHidden
(
true
);
this
.
partService
.
setSideBarHidden
(
true
);
}
return
Promise
.
resolve
(
false
);
...
...
src/vs/workbench/browser/parts/panel/panelActions.ts
浏览文件 @
1cc7dd40
...
...
@@ -30,7 +30,8 @@ export class ClosePanelAction extends Action {
}
run
():
Thenable
<
any
>
{
return
this
.
partService
.
setPanelHidden
(
true
);
this
.
partService
.
setPanelHidden
(
true
);
return
Promise
.
resolve
(
null
);
}
}
...
...
@@ -48,7 +49,8 @@ export class TogglePanelAction extends Action {
}
run
():
Thenable
<
any
>
{
return
this
.
partService
.
setPanelHidden
(
this
.
partService
.
isVisible
(
Parts
.
PANEL_PART
));
this
.
partService
.
setPanelHidden
(
this
.
partService
.
isVisible
(
Parts
.
PANEL_PART
));
return
Promise
.
resolve
(
null
);
}
}
...
...
@@ -70,7 +72,8 @@ class FocusPanelAction extends Action {
// Show panel
if
(
!
this
.
partService
.
isVisible
(
Parts
.
PANEL_PART
))
{
return
this
.
partService
.
setPanelHidden
(
false
);
this
.
partService
.
setPanelHidden
(
false
);
return
Promise
.
resolve
(
null
);
}
// Focus into active panel
...
...
@@ -79,7 +82,7 @@ class FocusPanelAction extends Action {
panel
.
focus
();
}
return
Promise
.
resolve
(
true
);
return
Promise
.
resolve
(
null
);
}
}
...
...
@@ -116,7 +119,8 @@ export class TogglePanelPositionAction extends Action {
run
():
Thenable
<
any
>
{
const
position
=
this
.
partService
.
getPanelPosition
();
return
this
.
partService
.
setPanelPosition
(
position
===
Position
.
BOTTOM
?
Position
.
RIGHT
:
Position
.
BOTTOM
);
this
.
partService
.
setPanelPosition
(
position
===
Position
.
BOTTOM
?
Position
.
RIGHT
:
Position
.
BOTTOM
);
return
Promise
.
resolve
(
null
);
}
dispose
():
void
{
...
...
@@ -153,9 +157,12 @@ export class ToggleMaximizedPanelAction extends Action {
}
run
():
Thenable
<
any
>
{
const
promise
:
Thenable
<
void
>
=
!
this
.
partService
.
isVisible
(
Parts
.
PANEL_PART
)
?
this
.
partService
.
setPanelHidden
(
false
)
:
Promise
.
resolve
(
null
);
if
(
!
this
.
partService
.
isVisible
(
Parts
.
PANEL_PART
))
{
this
.
partService
.
setPanelHidden
(
false
);
}
return
promise
.
then
(()
=>
this
.
partService
.
toggleMaximizedPanel
());
this
.
partService
.
toggleMaximizedPanel
();
return
Promise
.
resolve
(
null
);
}
dispose
():
void
{
...
...
@@ -175,7 +182,9 @@ export class PanelActivityAction extends ActivityAction {
}
run
(
event
:
any
):
Thenable
<
any
>
{
return
this
.
panelService
.
openPanel
(
this
.
activity
.
id
,
true
).
then
(()
=>
this
.
activate
());
this
.
panelService
.
openPanel
(
this
.
activity
.
id
,
true
);
this
.
activate
();
return
Promise
.
resolve
(
null
);
}
}
...
...
@@ -202,7 +211,8 @@ export class SwitchPanelViewAction extends Action {
break
;
}
}
return
this
.
panelService
.
openPanel
(
targetPanelId
,
true
);
this
.
panelService
.
openPanel
(
targetPanelId
,
true
);
return
Promise
.
resolve
(
null
);
}
}
...
...
src/vs/workbench/browser/parts/panel/panelPart.ts
浏览文件 @
1cc7dd40
...
...
@@ -4,7 +4,6 @@
*--------------------------------------------------------------------------------------------*/
import
'
vs/css!./media/panelpart
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IAction
}
from
'
vs/base/common/actions
'
;
import
{
Event
,
mapEvent
}
from
'
vs/base/common/event
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
...
...
@@ -86,7 +85,7 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
icon
:
false
,
storageId
:
PanelPart
.
PINNED_PANELS
,
orientation
:
ActionsOrientation
.
HORIZONTAL
,
openComposite
:
(
compositeId
:
string
)
=>
this
.
openPanel
(
compositeId
,
true
),
openComposite
:
(
compositeId
:
string
)
=>
Promise
.
resolve
(
this
.
openPanel
(
compositeId
,
true
)
),
getActivityAction
:
(
compositeId
:
string
)
=>
this
.
getCompositeActions
(
compositeId
).
activityAction
,
getCompositePinnedAction
:
(
compositeId
:
string
)
=>
this
.
getCompositeActions
(
compositeId
).
pinnedAction
,
getOnCompositeClickAction
:
(
compositeId
:
string
)
=>
this
.
instantiationService
.
createInstance
(
PanelActivityAction
,
this
.
getPanel
(
compositeId
)),
...
...
@@ -180,23 +179,22 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
title
.
style
.
borderTopColor
=
this
.
getColor
(
PANEL_BORDER
)
||
this
.
getColor
(
contrastBorder
);
}
openPanel
(
id
:
string
,
focus
?:
boolean
):
TPromise
<
Panel
>
{
openPanel
(
id
:
string
,
focus
?:
boolean
):
Panel
{
if
(
this
.
blockOpeningPanel
)
{
return
Promise
.
resolve
(
null
)
;
// Workaround against a potential race condition
return
null
;
// Workaround against a potential race condition
}
// First check if panel is hidden and show if so
let
promise
=
TPromise
.
wrap
(
null
);
if
(
!
this
.
partService
.
isVisible
(
Parts
.
PANEL_PART
))
{
try
{
this
.
blockOpeningPanel
=
true
;
promise
=
this
.
partService
.
setPanelHidden
(
false
);
this
.
partService
.
setPanelHidden
(
false
);
}
finally
{
this
.
blockOpeningPanel
=
false
;
}
}
return
promise
.
then
(()
=>
this
.
openComposite
(
id
,
focus
)
);
return
this
.
openComposite
(
id
,
focus
);
}
showActivity
(
panelId
:
string
,
badge
:
IBadge
,
clazz
?:
string
):
IDisposable
{
...
...
@@ -247,8 +245,8 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
return
this
.
getLastActiveCompositetId
();
}
hideActivePanel
():
TPromise
<
void
>
{
return
this
.
hideActiveComposite
().
then
(
composite
=>
void
0
);
hideActivePanel
():
void
{
this
.
hideActiveComposite
(
);
}
protected
createTitleLabel
(
parent
:
HTMLElement
):
ICompositeTitleLabel
{
...
...
src/vs/workbench/browser/parts/sidebar/sidebarPart.ts
浏览文件 @
1cc7dd40
...
...
@@ -124,23 +124,22 @@ export class SidebarPart extends CompositePart<Viewlet> {
container
.
style
.
borderLeftColor
=
!
isPositionLeft
?
borderColor
:
null
;
}
openViewlet
(
id
:
string
,
focus
?:
boolean
):
TPromise
<
Viewlet
>
{
openViewlet
(
id
:
string
,
focus
?:
boolean
):
Viewlet
{
if
(
this
.
blockOpeningViewlet
)
{
return
Promise
.
resolve
(
null
)
;
// Workaround against a potential race condition
return
null
;
// Workaround against a potential race condition
}
// First check if sidebar is hidden and show if so
let
promise
=
TPromise
.
wrap
<
void
>
(
null
);
if
(
!
this
.
partService
.
isVisible
(
Parts
.
SIDEBAR_PART
))
{
try
{
this
.
blockOpeningViewlet
=
true
;
promise
=
this
.
partService
.
setSideBarHidden
(
false
);
this
.
partService
.
setSideBarHidden
(
false
);
}
finally
{
this
.
blockOpeningViewlet
=
false
;
}
}
return
promise
.
then
(()
=>
this
.
openComposite
(
id
,
focus
))
as
TPromise
<
Viewlet
>
;
return
this
.
openComposite
(
id
,
focus
)
as
Viewlet
;
}
getActiveViewlet
():
IViewlet
{
...
...
@@ -151,8 +150,8 @@ export class SidebarPart extends CompositePart<Viewlet> {
return
this
.
getLastActiveCompositetId
();
}
hideActiveViewlet
():
TPromise
<
void
>
{
return
this
.
hideActiveComposite
().
then
(
composite
=>
void
0
);
hideActiveViewlet
():
void
{
this
.
hideActiveComposite
(
);
}
layout
(
dimension
:
Dimension
):
Dimension
[]
{
...
...
@@ -198,7 +197,7 @@ class FocusSideBarAction extends Action {
// Show side bar
if
(
!
this
.
partService
.
isVisible
(
Parts
.
SIDEBAR_PART
))
{
return
this
.
partService
.
setSideBarHidden
(
false
);
return
Promise
.
resolve
(
this
.
partService
.
setSideBarHidden
(
false
)
);
}
// Focus into active viewlet
...
...
src/vs/workbench/browser/parts/views/customView.ts
浏览文件 @
1cc7dd40
...
...
@@ -59,8 +59,9 @@ export class CustomTreeViewPanel extends ViewletPanel {
this
.
updateTreeVisibility
();
}
setVisible
(
visible
:
boolean
):
TPromise
<
void
>
{
return
super
.
setVisible
(
visible
).
then
(()
=>
this
.
updateTreeVisibility
());
setVisible
(
visible
:
boolean
):
void
{
super
.
setVisible
(
visible
);
this
.
updateTreeVisibility
();
}
focus
():
void
{
...
...
src/vs/workbench/browser/parts/views/panelViewlet.ts
浏览文件 @
1cc7dd40
...
...
@@ -5,7 +5,6 @@
import
'
vs/css!./media/panelviewlet
'
;
import
*
as
nls
from
'
vs/nls
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
Event
,
Emitter
,
filterEvent
}
from
'
vs/base/common/event
'
;
import
{
ColorIdentifier
}
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
attachStyler
,
IColorMapping
}
from
'
vs/platform/theme/common/styler
'
;
...
...
@@ -77,12 +76,10 @@ export abstract class ViewletPanel extends Panel implements IView {
this
.
actionRunner
=
options
.
actionRunner
;
}
setVisible
(
visible
:
boolean
):
TPromise
<
void
>
{
setVisible
(
visible
:
boolean
):
void
{
if
(
this
.
_isVisible
!==
visible
)
{
this
.
_isVisible
=
visible
;
}
return
TPromise
.
wrap
(
null
);
}
isVisible
():
boolean
{
...
...
src/vs/workbench/browser/parts/views/viewsViewlet.ts
浏览文件 @
1cc7dd40
...
...
@@ -42,12 +42,11 @@ export abstract class TreeViewsViewletPanel extends ViewletPanel {
}
}
setVisible
(
visible
:
boolean
):
TPromise
<
void
>
{
setVisible
(
visible
:
boolean
):
void
{
if
(
this
.
isVisible
()
!==
visible
)
{
return
super
.
setVisible
(
visible
)
.
then
(()
=>
this
.
updateTreeVisibility
(
this
.
tree
,
visible
&&
this
.
isExpanded
()
));
super
.
setVisible
(
visible
);
this
.
updateTreeVisibility
(
this
.
tree
,
visible
&&
this
.
isExpanded
(
));
}
return
TPromise
.
wrap
(
null
);
}
focus
():
void
{
...
...
@@ -189,11 +188,10 @@ export abstract class ViewContainerViewlet extends PanelViewlet implements IView
return
result
;
}
setVisible
(
visible
:
boolean
):
Promise
<
void
>
{
return
super
.
setVisible
(
visible
)
.
then
(()
=>
Promise
.
all
(
this
.
panels
.
filter
(
view
=>
view
.
isVisible
()
!==
visible
)
.
map
((
view
)
=>
view
.
setVisible
(
visible
))))
.
then
(()
=>
void
0
);
setVisible
(
visible
:
boolean
):
void
{
super
.
setVisible
(
visible
);
this
.
panels
.
filter
(
view
=>
view
.
isVisible
()
!==
visible
)
.
map
((
view
)
=>
view
.
setVisible
(
visible
));
}
openView
(
id
:
string
,
focus
?:
boolean
):
TPromise
<
IView
>
{
...
...
src/vs/workbench/electron-browser/actions.ts
浏览文件 @
1cc7dd40
...
...
@@ -735,7 +735,7 @@ export abstract class BaseNavigationAction extends Action {
}
if
(
isSidebarFocus
)
{
return
this
.
navigateOnSidebarFocus
(
isSidebarPositionLeft
,
isPanelPositionDown
);
return
Promise
.
resolve
(
this
.
navigateOnSidebarFocus
(
isSidebarPositionLeft
,
isPanelPositionDown
)
);
}
return
Promise
.
resolve
(
false
);
...
...
@@ -749,13 +749,13 @@ export abstract class BaseNavigationAction extends Action {
return
Promise
.
resolve
(
true
);
}
protected
navigateOnSidebarFocus
(
_isSidebarPositionLeft
:
boolean
,
_isPanelPositionDown
:
boolean
):
Thenable
<
boolean
|
IViewlet
>
{
return
Promise
.
resolve
(
true
)
;
protected
navigateOnSidebarFocus
(
_isSidebarPositionLeft
:
boolean
,
_isPanelPositionDown
:
boolean
):
boolean
|
IViewlet
{
return
true
;
}
protected
navigateToPanel
():
Thenable
<
IPanel
|
boolean
>
{
protected
navigateToPanel
():
IPanel
|
boolean
{
if
(
!
this
.
partService
.
isVisible
(
Parts
.
PANEL_PART
))
{
return
Promise
.
resolve
(
false
)
;
return
false
;
}
const
activePanelId
=
this
.
panelService
.
getActivePanel
().
getId
();
...
...
@@ -773,23 +773,23 @@ export abstract class BaseNavigationAction extends Action {
return
this
.
viewletService
.
openViewlet
(
activeViewletId
,
true
);
}
protected
navigateAcrossEditorGroup
(
direction
:
GroupDirection
):
Promise
<
boolean
>
{
protected
navigateAcrossEditorGroup
(
direction
:
GroupDirection
):
boolean
{
return
this
.
doNavigateToEditorGroup
({
direction
});
}
protected
navigateToEditorGroup
(
location
:
GroupLocation
):
Promise
<
boolean
>
{
protected
navigateToEditorGroup
(
location
:
GroupLocation
):
boolean
{
return
this
.
doNavigateToEditorGroup
({
location
});
}
private
doNavigateToEditorGroup
(
scope
:
IFindGroupScope
):
Promise
<
boolean
>
{
private
doNavigateToEditorGroup
(
scope
:
IFindGroupScope
):
boolean
{
const
targetGroup
=
this
.
editorGroupService
.
findGroup
(
scope
,
this
.
editorGroupService
.
activeGroup
);
if
(
targetGroup
)
{
targetGroup
.
focus
();
return
Promise
.
resolve
(
true
)
;
return
true
;
}
return
Promise
.
resolve
(
false
)
;
return
false
;
}
}
...
...
@@ -809,19 +809,17 @@ export class NavigateLeftAction extends BaseNavigationAction {
super
(
id
,
label
,
editorGroupService
,
panelService
,
partService
,
viewletService
);
}
protected
navigateOnEditorFocus
(
isSidebarPositionLeft
:
boolean
,
_isPanelPositionDown
:
boolean
):
Promise
<
boolean
|
IViewlet
>
{
return
this
.
navigateAcrossEditorGroup
(
GroupDirection
.
LEFT
)
.
then
(
didNavigate
=>
{
if
(
didNavigate
)
{
return
Promise
.
resolve
(
true
);
}
protected
navigateOnEditorFocus
(
isSidebarPositionLeft
:
boolean
,
_isPanelPositionDown
:
boolean
):
Thenable
<
boolean
|
IViewlet
>
{
const
didNavigate
=
this
.
navigateAcrossEditorGroup
(
GroupDirection
.
LEFT
);
if
(
didNavigate
)
{
return
Promise
.
resolve
(
true
);
}
if
(
isSidebarPositionLeft
)
{
return
this
.
navigateToSidebar
();
}
if
(
isSidebarPositionLeft
)
{
return
this
.
navigateToSidebar
();
}
return
Promise
.
resolve
(
false
);
});
return
Promise
.
resolve
(
false
);
}
protected
navigateOnPanelFocus
(
isSidebarPositionLeft
:
boolean
,
isPanelPositionDown
:
boolean
):
Thenable
<
boolean
|
IViewlet
>
{
...
...
@@ -830,18 +828,18 @@ export class NavigateLeftAction extends BaseNavigationAction {
}
if
(
!
isPanelPositionDown
)
{
return
this
.
navigateToEditorGroup
(
GroupLocation
.
LAST
);
return
Promise
.
resolve
(
this
.
navigateToEditorGroup
(
GroupLocation
.
LAST
)
);
}
return
Promise
.
resolve
(
false
);
}
protected
navigateOnSidebarFocus
(
isSidebarPositionLeft
:
boolean
,
_isPanelPositionDown
:
boolean
):
Promise
<
boolean
>
{
protected
navigateOnSidebarFocus
(
isSidebarPositionLeft
:
boolean
,
_isPanelPositionDown
:
boolean
):
boolean
{
if
(
!
isSidebarPositionLeft
)
{
return
this
.
navigateToEditorGroup
(
GroupLocation
.
LAST
);
}
return
Promise
.
resolve
(
false
)
;
return
false
;
}
}
...
...
@@ -861,23 +859,21 @@ export class NavigateRightAction extends BaseNavigationAction {
super
(
id
,
label
,
editorGroupService
,
panelService
,
partService
,
viewletService
);
}
protected
navigateOnEditorFocus
(
isSidebarPositionLeft
:
boolean
,
isPanelPositionDown
:
boolean
):
Promise
<
boolean
|
IViewlet
|
IPanel
>
{
return
this
.
navigateAcrossEditorGroup
(
GroupDirection
.
RIGHT
)
.
then
(
didNavigate
=>
{
if
(
didNavigate
)
{
return
Promise
.
resolve
(
true
);
}
protected
navigateOnEditorFocus
(
isSidebarPositionLeft
:
boolean
,
isPanelPositionDown
:
boolean
):
Thenable
<
boolean
|
IViewlet
|
IPanel
>
{
const
didNavigate
=
this
.
navigateAcrossEditorGroup
(
GroupDirection
.
RIGHT
);
if
(
didNavigate
)
{
return
Promise
.
resolve
(
true
);
}
if
(
!
isPanelPositionDown
)
{
return
this
.
navigateToPanel
(
);
}
if
(
!
isPanelPositionDown
)
{
return
Promise
.
resolve
(
this
.
navigateToPanel
()
);
}
if
(
!
isSidebarPositionLeft
)
{
return
this
.
navigateToSidebar
();
}
if
(
!
isSidebarPositionLeft
)
{
return
this
.
navigateToSidebar
();
}
return
Promise
.
resolve
(
false
);
});
return
Promise
.
resolve
(
false
);
}
protected
navigateOnPanelFocus
(
isSidebarPositionLeft
:
boolean
,
_isPanelPositionDown
:
boolean
):
Thenable
<
boolean
|
IViewlet
>
{
...
...
@@ -888,12 +884,12 @@ export class NavigateRightAction extends BaseNavigationAction {
return
Promise
.
resolve
(
false
);
}
protected
navigateOnSidebarFocus
(
isSidebarPositionLeft
:
boolean
,
_isPanelPositionDown
:
boolean
):
Promise
<
boolean
>
{
protected
navigateOnSidebarFocus
(
isSidebarPositionLeft
:
boolean
,
_isPanelPositionDown
:
boolean
):
boolean
{
if
(
isSidebarPositionLeft
)
{
return
this
.
navigateToEditorGroup
(
GroupLocation
.
FIRST
);
}
return
Promise
.
resolve
(
false
)
;
return
false
;
}
}
...
...
@@ -914,12 +910,12 @@ export class NavigateUpAction extends BaseNavigationAction {
}
protected
navigateOnEditorFocus
(
_isSidebarPositionLeft
:
boolean
,
_isPanelPositionDown
:
boolean
):
Promise
<
boolean
>
{
return
this
.
navigateAcrossEditorGroup
(
GroupDirection
.
UP
);
return
Promise
.
resolve
(
this
.
navigateAcrossEditorGroup
(
GroupDirection
.
UP
)
);
}
protected
navigateOnPanelFocus
(
_isSidebarPositionLeft
:
boolean
,
isPanelPositionDown
:
boolean
):
Promise
<
boolean
>
{
if
(
isPanelPositionDown
)
{
return
this
.
navigateToEditorGroup
(
GroupLocation
.
LAST
);
return
Promise
.
resolve
(
this
.
navigateToEditorGroup
(
GroupLocation
.
LAST
)
);
}
return
Promise
.
resolve
(
false
);
...
...
@@ -943,18 +939,16 @@ export class NavigateDownAction extends BaseNavigationAction {
}
protected
navigateOnEditorFocus
(
_isSidebarPositionLeft
:
boolean
,
isPanelPositionDown
:
boolean
):
Promise
<
boolean
|
IPanel
>
{
return
this
.
navigateAcrossEditorGroup
(
GroupDirection
.
DOWN
)
.
then
(
didNavigate
=>
{
if
(
didNavigate
)
{
return
Promise
.
resolve
(
true
);
}
const
didNavigate
=
this
.
navigateAcrossEditorGroup
(
GroupDirection
.
DOWN
);
if
(
didNavigate
)
{
return
Promise
.
resolve
(
true
);
}
if
(
isPanelPositionDown
)
{
return
this
.
navigateToPanel
(
);
}
if
(
isPanelPositionDown
)
{
return
Promise
.
resolve
(
this
.
navigateToPanel
()
);
}
return
Promise
.
resolve
(
false
);
});
return
Promise
.
resolve
(
false
);
}
}
...
...
src/vs/workbench/electron-browser/workbench.ts
浏览文件 @
1cc7dd40
...
...
@@ -757,7 +757,8 @@ export class Workbench extends Disposable implements IPartService {
perf
.
mark
(
'
willRestorePanel
'
);
const
isPanelToRestoreEnabled
=
!!
this
.
panelPart
.
getPanels
().
filter
(
p
=>
p
.
id
===
panelId
).
length
;
const
panelIdToRestore
=
isPanelToRestoreEnabled
?
panelId
:
panelRegistry
.
getDefaultPanelId
();
restorePromises
.
push
(
this
.
panelPart
.
openPanel
(
panelIdToRestore
,
false
).
then
(()
=>
perf
.
mark
(
'
didRestorePanel
'
)));
this
.
panelPart
.
openPanel
(
panelIdToRestore
,
false
);
perf
.
mark
(
'
didRestorePanel
'
);
}
// Restore Zen Mode if active
...
...
@@ -1371,7 +1372,7 @@ export class Workbench extends Disposable implements IPartService {
}
}
setSideBarHidden
(
hidden
:
boolean
,
skipLayout
?:
boolean
):
TPromise
<
void
>
{
setSideBarHidden
(
hidden
:
boolean
,
skipLayout
?:
boolean
):
void
{
this
.
sideBarHidden
=
hidden
;
this
.
sideBarVisibleContext
.
set
(
!
hidden
);
...
...
@@ -1383,47 +1384,45 @@ export class Workbench extends Disposable implements IPartService {
}
// If sidebar becomes hidden, also hide the current active Viewlet if any
let
promise
=
TPromise
.
wrap
<
any
>
(
null
);
if
(
hidden
&&
this
.
sidebarPart
.
getActiveViewlet
())
{
promise
=
this
.
sidebarPart
.
hideActiveViewlet
().
then
(()
=>
{
const
activePanel
=
this
.
panelPart
.
getActivePanel
();
// Pass Focus to Editor or Panel if Sidebar is now hidden
if
(
this
.
hasFocus
(
Parts
.
PANEL_PART
)
&&
activePanel
)
{
activePanel
.
focus
();
}
else
{
this
.
editorGroupService
.
activeGroup
.
focus
();
}
});
this
.
sidebarPart
.
hideActiveViewlet
();
const
activePanel
=
this
.
panelPart
.
getActivePanel
();
// Pass Focus to Editor or Panel if Sidebar is now hidden
if
(
this
.
hasFocus
(
Parts
.
PANEL_PART
)
&&
activePanel
)
{
activePanel
.
focus
();
}
else
{
this
.
editorGroupService
.
activeGroup
.
focus
();
}
}
// If sidebar becomes visible, show last active Viewlet or default viewlet
else
if
(
!
hidden
&&
!
this
.
sidebarPart
.
getActiveViewlet
())
{
const
viewletToOpen
=
this
.
sidebarPart
.
getLastActiveViewletId
();
if
(
viewletToOpen
)
{
promise
=
this
.
viewletService
.
openViewlet
(
viewletToOpen
,
true
)
.
then
(
viewlet
=>
viewlet
||
this
.
viewletService
.
openViewlet
(
this
.
viewletService
.
getDefaultViewletId
(),
true
));
const
viewlet
=
this
.
viewletService
.
openViewlet
(
viewletToOpen
,
true
);
if
(
!
viewlet
)
{
this
.
viewletService
.
openViewlet
(
this
.
viewletService
.
getDefaultViewletId
(),
true
);
}
}
}
return
promise
.
then
(()
=>
{
// Remember in settings
const
defaultHidden
=
this
.
contextService
.
getWorkbenchState
()
===
WorkbenchState
.
EMPTY
;
if
(
hidden
!==
defaultHidden
)
{
this
.
storageService
.
store
(
Workbench
.
sidebarHiddenStorageKey
,
hidden
?
'
true
'
:
'
false
'
,
StorageScope
.
WORKSPACE
);
}
else
{
this
.
storageService
.
remove
(
Workbench
.
sidebarHiddenStorageKey
,
StorageScope
.
WORKSPACE
);
}
// Remember in settings
const
defaultHidden
=
this
.
contextService
.
getWorkbenchState
()
===
WorkbenchState
.
EMPTY
;
if
(
hidden
!==
defaultHidden
)
{
this
.
storageService
.
store
(
Workbench
.
sidebarHiddenStorageKey
,
hidden
?
'
true
'
:
'
false
'
,
StorageScope
.
WORKSPACE
);
}
else
{
this
.
storageService
.
remove
(
Workbench
.
sidebarHiddenStorageKey
,
StorageScope
.
WORKSPACE
);
}
// Layout
if
(
!
skipLayout
)
{
this
.
workbenchLayout
.
layout
();
}
});
// Layout
if
(
!
skipLayout
)
{
this
.
workbenchLayout
.
layout
();
}
}
setPanelHidden
(
hidden
:
boolean
,
skipLayout
?:
boolean
):
TPromise
<
void
>
{
setPanelHidden
(
hidden
:
boolean
,
skipLayout
?:
boolean
):
void
{
this
.
panelHidden
=
hidden
;
// Adjust CSS
...
...
@@ -1434,35 +1433,31 @@ export class Workbench extends Disposable implements IPartService {
}
// If panel part becomes hidden, also hide the current active panel if any
let
promise
=
TPromise
.
wrap
<
any
>
(
null
);
if
(
hidden
&&
this
.
panelPart
.
getActivePanel
())
{
promise
=
this
.
panelPart
.
hideActivePanel
().
then
(()
=>
{
this
.
editorGroupService
.
activeGroup
.
focus
();
// Pass focus to editor group if panel part is now hidden
});
this
.
panelPart
.
hideActivePanel
();
this
.
editorGroupService
.
activeGroup
.
focus
();
// Pass focus to editor group if panel part is now hidden
}
// If panel part becomes visible, show last active panel or default panel
else
if
(
!
hidden
&&
!
this
.
panelPart
.
getActivePanel
())
{
const
panelToOpen
=
this
.
panelPart
.
getLastActivePanelId
();
if
(
panelToOpen
)
{
promise
=
this
.
panelPart
.
openPanel
(
panelToOpen
,
true
);
this
.
panelPart
.
openPanel
(
panelToOpen
,
true
);
}
}
return
promise
.
then
(()
=>
{
// Remember in settings
if
(
!
hidden
)
{
this
.
storageService
.
store
(
Workbench
.
panelHiddenStorageKey
,
'
false
'
,
StorageScope
.
WORKSPACE
);
}
else
{
this
.
storageService
.
remove
(
Workbench
.
panelHiddenStorageKey
,
StorageScope
.
WORKSPACE
);
}
// Remember in settings
if
(
!
hidden
)
{
this
.
storageService
.
store
(
Workbench
.
panelHiddenStorageKey
,
'
false
'
,
StorageScope
.
WORKSPACE
);
}
else
{
this
.
storageService
.
remove
(
Workbench
.
panelHiddenStorageKey
,
StorageScope
.
WORKSPACE
);
}
// Layout
if
(
!
skipLayout
)
{
this
.
workbenchLayout
.
layout
();
}
});
// Layout
if
(
!
skipLayout
)
{
this
.
workbenchLayout
.
layout
();
}
}
toggleMaximizedPanel
():
void
{
...
...
@@ -1518,23 +1513,25 @@ export class Workbench extends Disposable implements IPartService {
return
this
.
panelPosition
;
}
setPanelPosition
(
position
:
Position
):
TPromise
<
void
>
{
return
(
this
.
panelHidden
?
this
.
setPanelHidden
(
false
,
true
/* Skip Layout */
)
:
TPromise
.
as
(
undefined
)).
then
(()
=>
{
const
newPositionValue
=
(
position
===
Position
.
BOTTOM
)
?
'
bottom
'
:
'
right
'
;
const
oldPositionValue
=
(
this
.
panelPosition
===
Position
.
BOTTOM
)
?
'
bottom
'
:
'
right
'
;
this
.
panelPosition
=
position
;
this
.
storageService
.
store
(
Workbench
.
panelPositionStorageKey
,
PositionToString
(
this
.
panelPosition
).
toLowerCase
(),
StorageScope
.
WORKSPACE
);
setPanelPosition
(
position
:
Position
):
void
{
if
(
this
.
panelHidden
)
{
this
.
setPanelHidden
(
false
,
true
/* Skip Layout */
);
}
// Adjust CSS
DOM
.
removeClass
(
this
.
panelPart
.
getContainer
(),
oldPositionValue
);
DOM
.
addClass
(
this
.
panelPart
.
getContainer
(),
newPositionValue
);
const
newPositionValue
=
(
position
===
Position
.
BOTTOM
)
?
'
bottom
'
:
'
right
'
;
const
oldPositionValue
=
(
this
.
panelPosition
===
Position
.
BOTTOM
)
?
'
bottom
'
:
'
right
'
;
this
.
panelPosition
=
position
;
this
.
storageService
.
store
(
Workbench
.
panelPositionStorageKey
,
PositionToString
(
this
.
panelPosition
).
toLowerCase
(),
StorageScope
.
WORKSPACE
);
// Update Styles
this
.
panelPart
.
updateStyles
();
// Adjust CSS
DOM
.
removeClass
(
this
.
panelPart
.
getContainer
(),
oldPositionValue
);
DOM
.
addClass
(
this
.
panelPart
.
getContainer
(),
newPositionValue
);
// Layout
this
.
workbenchLayout
.
layout
();
});
// Update Styles
this
.
panelPart
.
updateStyles
();
// Layout
this
.
workbenchLayout
.
layout
();
}
//#endregion
...
...
src/vs/workbench/parts/debug/browser/breakpointsView.ts
浏览文件 @
1cc7dd40
...
...
@@ -192,12 +192,11 @@ export class BreakpointsView extends ViewletPanel {
}
}
public
setVisible
(
visible
:
boolean
):
TPromise
<
void
>
{
return
super
.
setVisible
(
visible
).
then
(()
=>
{
if
(
visible
&&
this
.
needsRefresh
)
{
this
.
onBreakpointsChange
();
}
});
public
setVisible
(
visible
:
boolean
):
void
{
super
.
setVisible
(
visible
);
if
(
visible
&&
this
.
needsRefresh
)
{
this
.
onBreakpointsChange
();
}
}
private
onBreakpointsChange
():
void
{
...
...
src/vs/workbench/parts/debug/browser/debugActions.ts
浏览文件 @
1cc7dd40
...
...
@@ -717,7 +717,8 @@ export class FocusReplAction extends Action {
}
public
run
():
TPromise
<
any
>
{
return
this
.
panelService
.
openPanel
(
REPL_ID
,
true
);
this
.
panelService
.
openPanel
(
REPL_ID
,
true
);
return
Promise
.
resolve
(
null
);
}
}
...
...
src/vs/workbench/parts/debug/electron-browser/callStackView.ts
浏览文件 @
1cc7dd40
...
...
@@ -217,12 +217,11 @@ export class CallStackView extends TreeViewsViewletPanel {
});
}
public
setVisible
(
visible
:
boolean
):
TPromise
<
void
>
{
return
super
.
setVisible
(
visible
).
then
(()
=>
{
if
(
visible
&&
this
.
needsRefresh
)
{
this
.
onCallStackChangeScheduler
.
schedule
();
}
});
public
setVisible
(
visible
:
boolean
):
void
{
super
.
setVisible
(
visible
);
if
(
visible
&&
this
.
needsRefresh
)
{
this
.
onCallStackChangeScheduler
.
schedule
();
}
}
}
...
...
src/vs/workbench/parts/debug/electron-browser/debugService.ts
浏览文件 @
1cc7dd40
...
...
@@ -681,7 +681,8 @@ export class DebugService implements IDebugService {
:
nls
.
localize
(
'
preLaunchTaskExitCode
'
,
"
The preLaunchTask '{0}' terminated with exit code {1}.
"
,
taskLabel
,
taskSummary
.
exitCode
);
const
showErrorsAction
=
new
Action
(
'
debug.showErrors
'
,
nls
.
localize
(
'
showErrors
'
,
"
Show Errors
"
),
undefined
,
true
,
()
=>
{
return
this
.
panelService
.
openPanel
(
Constants
.
MARKERS_PANEL_ID
).
then
(()
=>
TaskRunResult
.
Failure
);
this
.
panelService
.
openPanel
(
Constants
.
MARKERS_PANEL_ID
);
return
Promise
.
resolve
(
TaskRunResult
.
Failure
);
});
return
this
.
showError
(
message
,
[
debugAnywayAction
,
showErrorsAction
]);
...
...
src/vs/workbench/parts/debug/electron-browser/variablesView.ts
浏览文件 @
1cc7dd40
...
...
@@ -139,12 +139,11 @@ export class VariablesView extends TreeViewsViewletPanel {
}
}
public
setVisible
(
visible
:
boolean
):
TPromise
<
void
>
{
return
super
.
setVisible
(
visible
).
then
(()
=>
{
if
(
visible
&&
this
.
needsRefresh
)
{
this
.
onFocusStackFrameScheduler
.
schedule
();
}
});
public
setVisible
(
visible
:
boolean
):
void
{
super
.
setVisible
(
visible
);
if
(
visible
&&
this
.
needsRefresh
)
{
this
.
onFocusStackFrameScheduler
.
schedule
();
}
}
}
...
...
src/vs/workbench/parts/debug/electron-browser/watchExpressionsView.ts
浏览文件 @
1cc7dd40
...
...
@@ -122,12 +122,11 @@ export class WatchExpressionsView extends TreeViewsViewletPanel {
}
}
public
setVisible
(
visible
:
boolean
):
TPromise
<
void
>
{
return
super
.
setVisible
(
visible
).
then
(()
=>
{
if
(
visible
&&
this
.
needsRefresh
)
{
this
.
onWatchExpressionsUpdatedScheduler
.
schedule
();
}
});
public
setVisible
(
visible
:
boolean
):
void
{
super
.
setVisible
(
visible
);
if
(
visible
&&
this
.
needsRefresh
)
{
this
.
onWatchExpressionsUpdatedScheduler
.
schedule
();
}
}
}
...
...
src/vs/workbench/parts/extensions/electron-browser/extensionsViewlet.ts
浏览文件 @
1cc7dd40
...
...
@@ -361,15 +361,14 @@ export class ExtensionsViewlet extends ViewContainerViewlet implements IExtensio
super
.
create
(
this
.
extensionsBox
);
}
setVisible
(
visible
:
boolean
):
Promise
<
void
>
{
setVisible
(
visible
:
boolean
):
void
{
const
isVisibilityChanged
=
this
.
isVisible
()
!==
visible
;
return
super
.
setVisible
(
visible
).
then
(()
=>
{
if
(
isVisibilityChanged
)
{
if
(
visible
)
{
this
.
searchBox
.
focus
();
}
super
.
setVisible
(
visible
);
if
(
isVisibilityChanged
)
{
if
(
visible
)
{
this
.
searchBox
.
focus
();
}
}
);
}
}
focus
():
void
{
...
...
src/vs/workbench/parts/files/electron-browser/explorerViewlet.ts
浏览文件 @
1cc7dd40
...
...
@@ -234,9 +234,9 @@ export class ExplorerViewlet extends ViewContainerViewlet implements IExplorerVi
return
<
EmptyView
>
this
.
getView
(
EmptyView
.
ID
);
}
public
setVisible
(
visible
:
boolean
):
Promise
<
void
>
{
public
setVisible
(
visible
:
boolean
):
void
{
this
.
viewletVisibleContextKey
.
set
(
visible
);
return
super
.
setVisible
(
visible
);
super
.
setVisible
(
visible
);
}
public
getActionRunner
():
IActionRunner
{
...
...
src/vs/workbench/parts/files/electron-browser/views/explorerView.ts
浏览文件 @
1cc7dd40
...
...
@@ -322,57 +322,54 @@ export class ExplorerView extends TreeViewsViewletPanel implements IExplorerView
}
}
public
setVisible
(
visible
:
boolean
):
TPromise
<
void
>
{
return
super
.
setVisible
(
visible
).
then
(()
=>
{
public
setVisible
(
visible
:
boolean
):
void
{
super
.
setVisible
(
visible
);
// Show
if
(
visible
)
{
// Show
if
(
visible
)
{
// If a refresh was requested and we are now visible, run it
let
refreshPromise
:
Thenable
<
void
>
=
TPromise
.
as
(
null
);
if
(
this
.
shouldRefresh
)
{
refreshPromise
=
this
.
doRefresh
();
this
.
shouldRefresh
=
false
;
// Reset flag
}
if
(
!
this
.
autoReveal
)
{
return
refreshPromise
;
// do not react to setVisible call if autoReveal === false
}
// Always select the current navigated file in explorer if input is file editor input
// unless autoReveal is set to false
const
activeFile
=
this
.
getActiveFile
();
if
(
activeFile
)
{
return
refreshPromise
.
then
(()
=>
{
return
this
.
select
(
activeFile
);
});
}
// If a refresh was requested and we are now visible, run it
let
refreshPromise
:
Thenable
<
void
>
=
TPromise
.
as
(
null
);
if
(
this
.
shouldRefresh
)
{
refreshPromise
=
this
.
doRefresh
();
this
.
shouldRefresh
=
false
;
// Reset flag
}
// Return now if the workbench has not yet been created - in this case the workbench takes care of restoring last used editors
if
(
!
this
.
partService
.
isCreated
())
{
return
Promise
.
resolve
(
null
);
}
if
(
!
this
.
autoReveal
)
{
return
;
// do not react to setVisible call if autoReveal === false
}
// Otherwise restore last used file: By lastActiveFileResource
let
lastActiveFileResource
:
URI
;
if
(
this
.
viewState
[
ExplorerView
.
MEMENTO_LAST_ACTIVE_FILE_RESOURCE
])
{
lastActiveFileResource
=
URI
.
parse
(
this
.
viewState
[
ExplorerView
.
MEMENTO_LAST_ACTIVE_FILE_RESOURCE
]);
}
// Always select the current navigated file in explorer if input is file editor input
// unless autoReveal is set to false
const
activeFile
=
this
.
getActiveFile
();
if
(
activeFile
)
{
refreshPromise
.
then
(()
=>
{
this
.
select
(
activeFile
);
});
return
;
}
if
(
lastActiveFileResource
&&
this
.
isCreated
&&
this
.
model
.
findClosest
(
lastActiveFileResource
))
{
this
.
editorService
.
openEditor
({
resource
:
lastActiveFileResource
,
options
:
{
revealIfVisible
:
true
}
});
// Return now if the workbench has not yet been created - in this case the workbench takes care of restoring last used editors
if
(
!
this
.
partService
.
isCreated
())
{
return
;
}
return
refreshPromise
;
}
// Otherwise restore last used file: By lastActiveFileResource
let
lastActiveFileResource
:
URI
;
if
(
this
.
viewState
[
ExplorerView
.
MEMENTO_LAST_ACTIVE_FILE_RESOURCE
])
{
lastActiveFileResource
=
URI
.
parse
(
this
.
viewState
[
ExplorerView
.
MEMENTO_LAST_ACTIVE_FILE_RESOURCE
]);
}
// Otherwise restore last used file: By Explorer selection
return
refreshPromise
.
then
(()
=>
{
this
.
openFocusedElement
();
});
if
(
lastActiveFileResource
&&
this
.
isCreated
&&
this
.
model
.
findClosest
(
lastActiveFileResource
))
{
this
.
editorService
.
openEditor
({
resource
:
lastActiveFileResource
,
options
:
{
revealIfVisible
:
true
}
});
return
;
}
return
void
0
;
});
// Otherwise restore last used file: By Explorer selection
refreshPromise
.
then
(()
=>
{
this
.
openFocusedElement
();
});
}
}
private
openFocusedElement
(
preserveFocus
?:
boolean
):
void
{
...
...
src/vs/workbench/parts/files/electron-browser/views/openEditorsView.ts
浏览文件 @
1cc7dd40
...
...
@@ -297,13 +297,12 @@ export class OpenEditorsView extends ViewletPanel {
}
}
public
setVisible
(
visible
:
boolean
):
TPromise
<
void
>
{
return
super
.
setVisible
(
visible
).
then
(()
=>
{
this
.
updateListVisibility
(
visible
&&
this
.
isExpanded
());
if
(
visible
&&
this
.
needsRefresh
)
{
this
.
listRefreshScheduler
.
schedule
(
0
);
}
});
public
setVisible
(
visible
:
boolean
):
void
{
super
.
setVisible
(
visible
);
this
.
updateListVisibility
(
visible
&&
this
.
isExpanded
());
if
(
visible
&&
this
.
needsRefresh
)
{
this
.
listRefreshScheduler
.
schedule
(
0
);
}
}
public
focus
():
void
{
...
...
src/vs/workbench/parts/markers/electron-browser/markersPanelActions.ts
浏览文件 @
1cc7dd40
...
...
@@ -70,7 +70,8 @@ export class ShowProblemsPanelAction extends Action {
}
public
run
():
TPromise
<
any
>
{
return
this
.
panelService
.
openPanel
(
Constants
.
MARKERS_PANEL_ID
,
true
);
this
.
panelService
.
openPanel
(
Constants
.
MARKERS_PANEL_ID
,
true
);
return
Promise
.
resolve
(
null
);
}
}
...
...
@@ -415,4 +416,4 @@ export class QuickFixActionItem extends ActionItem {
});
}
}
\ No newline at end of file
}
src/vs/workbench/parts/outline/electron-browser/outlinePanel.ts
浏览文件 @
1cc7dd40
...
...
@@ -21,7 +21,6 @@ import { dispose, IDisposable, toDisposable } from 'vs/base/common/lifecycle';
import
{
LRUCache
}
from
'
vs/base/common/map
'
;
import
{
escape
}
from
'
vs/base/common/strings
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
ITree
}
from
'
vs/base/parts/tree/browser/tree
'
;
import
'
vs/css!./outlinePanel
'
;
import
{
ICodeEditor
,
isCodeEditor
,
isDiffEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
...
...
@@ -383,12 +382,12 @@ export class OutlinePanel extends ViewletPanel {
}
}
setVisible
(
visible
:
boolean
):
TPromise
<
void
>
{
setVisible
(
visible
:
boolean
):
void
{
if
(
visible
&&
this
.
isExpanded
()
&&
!
this
.
_requestOracle
)
{
// workaround for https://github.com/Microsoft/vscode/issues/60011
this
.
setExpanded
(
true
);
}
return
super
.
setVisible
(
visible
);
super
.
setVisible
(
visible
);
}
setExpanded
(
expanded
:
boolean
):
void
{
...
...
src/vs/workbench/parts/output/electron-browser/outputServices.ts
浏览文件 @
1cc7dd40
...
...
@@ -494,10 +494,10 @@ export class OutputService extends Disposable implements IOutputService, ITextMo
this
.
activeChannel
=
channel
;
let
promise
:
TPromise
<
void
>
=
TPromise
.
as
(
null
);
if
(
this
.
isPanelShown
())
{
this
.
doShowChannel
(
channel
,
preserveFocus
);
promise
=
this
.
doShowChannel
(
channel
,
preserveFocus
);
}
else
{
promise
=
this
.
panelService
.
openPanel
(
OUTPUT_PANEL_ID
)
.
then
(()
=>
this
.
doShowChannel
(
this
.
activeChannel
,
preserveFocus
)
);
this
.
panelService
.
openPanel
(
OUTPUT_PANEL_ID
);
promise
=
this
.
doShowChannel
(
this
.
activeChannel
,
preserveFocus
);
}
return
promise
.
then
(()
=>
this
.
_onActiveOutputChannel
.
fire
(
id
));
}
...
...
src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts
浏览文件 @
1cc7dd40
...
...
@@ -1184,9 +1184,8 @@ export class SCMViewlet extends PanelViewlet implements IViewModel, IViewsViewle
return
(
this
.
mainPanel
?
1
:
0
)
+
this
.
repositoryPanels
.
length
;
}
setVisible
(
visible
:
boolean
):
Promise
<
void
>
{
const
promises
:
TPromise
<
any
>
[]
=
[];
promises
.
push
(
super
.
setVisible
(
visible
));
setVisible
(
visible
:
boolean
):
void
{
super
.
setVisible
(
visible
);
if
(
!
visible
)
{
this
.
cachedMainPanelHeight
=
this
.
getPanelSize
(
this
.
mainPanel
);
...
...
@@ -1198,10 +1197,8 @@ export class SCMViewlet extends PanelViewlet implements IViewModel, IViewsViewle
for
(
let
i
=
0
;
i
<
this
.
contributedViews
.
visibleViewDescriptors
.
length
;
i
++
)
{
const
panel
=
this
.
panels
[
start
+
i
]
as
ViewletPanel
;
p
romises
.
push
(
panel
.
setVisible
(
visible
)
);
p
anel
.
setVisible
(
visible
);
}
return
Promise
.
all
(
promises
).
then
(()
=>
null
);
}
getOptimalWidth
():
number
{
...
...
src/vs/workbench/parts/search/browser/searchActions.ts
浏览文件 @
1cc7dd40
...
...
@@ -50,7 +50,7 @@ export function openSearchView(viewletService: IViewletService, panelService: IP
return
viewletService
.
openViewlet
(
VIEW_ID
,
focus
).
then
(
viewlet
=>
<
SearchView
>
viewlet
);
}
return
panelService
.
openPanel
(
VIEW_ID
,
focus
).
then
(
panel
=>
<
SearchView
>
panel
);
return
Promise
.
resolve
(
panelService
.
openPanel
(
VIEW_ID
,
focus
)
as
SearchView
);
}
export
function
getSearchView
(
viewletService
:
IViewletService
,
panelService
:
IPanelService
):
SearchView
{
...
...
src/vs/workbench/parts/search/browser/searchView.ts
浏览文件 @
1cc7dd40
...
...
@@ -651,8 +651,7 @@ export class SearchView extends Viewlet implements IViewlet, IPanel {
}
}
public
setVisible
(
visible
:
boolean
):
Promise
<
void
>
{
let
promise
:
Promise
<
void
>
;
public
setVisible
(
visible
:
boolean
):
void
{
this
.
viewletVisible
.
set
(
visible
);
if
(
visible
)
{
if
(
this
.
changedWhileHidden
)
{
...
...
@@ -661,11 +660,11 @@ export class SearchView extends Viewlet implements IViewlet, IPanel {
this
.
changedWhileHidden
=
false
;
}
promise
=
super
.
setVisible
(
visible
);
super
.
setVisible
(
visible
);
this
.
tree
.
onVisible
();
}
else
{
this
.
tree
.
onHidden
();
promise
=
super
.
setVisible
(
visible
);
super
.
setVisible
(
visible
);
}
// Enable highlights if there are searchresults
...
...
@@ -680,8 +679,6 @@ export class SearchView extends Viewlet implements IViewlet, IPanel {
this
.
onFocus
(
focus
,
true
);
}
}
return
promise
;
}
public
moveFocusToResults
():
void
{
...
...
src/vs/workbench/parts/terminal/common/terminalService.ts
浏览文件 @
1cc7dd40
...
...
@@ -298,22 +298,21 @@ export abstract class TerminalService implements ITerminalService {
return
new
Promise
<
void
>
((
complete
)
=>
{
const
panel
=
this
.
_panelService
.
getActivePanel
();
if
(
!
panel
||
panel
.
getId
()
!==
TERMINAL_PANEL_ID
)
{
return
this
.
_panelService
.
openPanel
(
TERMINAL_PANEL_ID
,
focus
).
then
(()
=>
{
if
(
focus
)
{
// Do the focus call asynchronously as going through the
// command palette will force editor focus
setTimeout
(()
=>
{
const
instance
=
this
.
getActiveInstance
();
if
(
instance
)
{
instance
.
focusWhenReady
(
true
).
then
(()
=>
complete
(
void
0
));
}
else
{
complete
(
void
0
);
}
},
0
);
}
else
{
complete
(
void
0
);
}
});
this
.
_panelService
.
openPanel
(
TERMINAL_PANEL_ID
,
focus
);
if
(
focus
)
{
// Do the focus call asynchronously as going through the
// command palette will force editor focus
setTimeout
(()
=>
{
const
instance
=
this
.
getActiveInstance
();
if
(
instance
)
{
instance
.
focusWhenReady
(
true
).
then
(()
=>
complete
(
void
0
));
}
else
{
complete
(
void
0
);
}
},
0
);
}
else
{
complete
(
void
0
);
}
}
else
{
if
(
focus
)
{
// Do the focus call asynchronously as going through the
...
...
src/vs/workbench/services/panel/common/panelService.ts
浏览文件 @
1cc7dd40
...
...
@@ -4,7 +4,6 @@
*--------------------------------------------------------------------------------------------*/
import
{
Event
}
from
'
vs/base/common/event
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IPanel
}
from
'
vs/workbench/common/panel
'
;
import
{
createDecorator
,
ServiceIdentifier
}
from
'
vs/platform/instantiation/common/instantiation
'
;
...
...
@@ -26,7 +25,7 @@ export interface IPanelService {
/**
* Opens a panel with the given identifier and pass keyboard focus to it if specified.
*/
openPanel
(
id
:
string
,
focus
?:
boolean
):
TPromise
<
IPanel
>
;
openPanel
(
id
:
string
,
focus
?:
boolean
):
IPanel
;
/**
* Returns the current active panel or null if none
...
...
src/vs/workbench/services/part/common/partService.ts
浏览文件 @
1cc7dd40
...
...
@@ -3,7 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
createDecorator
,
ServiceIdentifier
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
Event
}
from
'
vs/base/common/event
'
;
import
{
MenuBarVisibility
}
from
'
vs/platform/windows/common/windows
'
;
...
...
@@ -89,12 +88,12 @@ export interface IPartService {
/**
* Set sidebar hidden or not
*/
setSideBarHidden
(
hidden
:
boolean
):
TPromise
<
void
>
;
setSideBarHidden
(
hidden
:
boolean
):
void
;
/**
* Set panel part hidden or not
*/
setPanelHidden
(
hidden
:
boolean
):
TPromise
<
void
>
;
setPanelHidden
(
hidden
:
boolean
):
void
;
/**
* Maximizes the panel height if the panel is not already maximized.
...
...
@@ -125,7 +124,7 @@ export interface IPartService {
/**
* Sets the panel position.
*/
setPanelPosition
(
position
:
Position
):
TPromise
<
void
>
;
setPanelPosition
(
position
:
Position
):
void
;
/**
* Returns the element that contains the workbench.
...
...
src/vs/workbench/services/progress/test/progressService.test.ts
浏览文件 @
1cc7dd40
...
...
@@ -69,8 +69,8 @@ class TestPanelService implements IPanelService {
onDidPanelOpen
=
new
Emitter
<
{
panel
:
IPanel
,
focus
:
boolean
}
>
().
event
;
onDidPanelClose
=
new
Emitter
<
IPanel
>
().
event
;
public
openPanel
(
id
:
string
,
focus
?:
boolean
):
TPromise
{
return
TPromise
.
as
(
null
)
;
public
openPanel
(
id
:
string
,
focus
?:
boolean
):
IPanel
{
return
null
;
}
public
getPanels
():
any
[]
{
...
...
src/vs/workbench/services/viewlet/browser/viewletService.ts
浏览文件 @
1cc7dd40
...
...
@@ -70,7 +70,7 @@ export class ViewletService extends Disposable implements IViewletService {
openViewlet
(
id
:
string
,
focus
?:
boolean
):
Thenable
<
IViewlet
>
{
if
(
this
.
getViewlet
(
id
))
{
return
this
.
sidebarPart
.
openViewlet
(
id
,
focus
);
return
Promise
.
resolve
(
this
.
sidebarPart
.
openViewlet
(
id
,
focus
)
);
}
return
this
.
extensionService
.
whenInstalledExtensionsRegistered
()
.
then
(()
=>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录