Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
12562dcf
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,发现更多精彩内容 >>
提交
12562dcf
编写于
5月 09, 2016
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
very first bare editor part using stacks model
上级
2a5d87f3
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
193 addition
and
1 deletion
+193
-1
src/vs/workbench/browser/parts/editor/editorPart2.ts
src/vs/workbench/browser/parts/editor/editorPart2.ts
+192
-0
src/vs/workbench/browser/workbench.ts
src/vs/workbench/browser/workbench.ts
+1
-1
未找到文件。
src/vs/workbench/browser/parts/editor/editorPart2.ts
0 → 100644
浏览文件 @
12562dcf
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
/* tslint:disable:no-unused-variable */
import
'
vs/css!./media/editorpart
'
;
import
'
vs/workbench/browser/parts/editor/editor.contribution
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
Registry
}
from
'
vs/platform/platform
'
;
import
timer
=
require
(
'
vs/base/common/timer
'
);
import
{
EventType
}
from
'
vs/base/common/events
'
;
import
{
Dimension
,
Builder
,
$
}
from
'
vs/base/browser/builder
'
;
import
nls
=
require
(
'
vs/nls
'
);
import
strings
=
require
(
'
vs/base/common/strings
'
);
import
assert
=
require
(
'
vs/base/common/assert
'
);
import
arrays
=
require
(
'
vs/base/common/arrays
'
);
import
types
=
require
(
'
vs/base/common/types
'
);
import
{
IEditorViewState
,
IEditor
}
from
'
vs/editor/common/editorCommon
'
;
import
errors
=
require
(
'
vs/base/common/errors
'
);
import
{
Scope
as
MementoScope
}
from
'
vs/workbench/common/memento
'
;
import
{
Scope
,
IActionBarRegistry
,
Extensions
as
ActionBarExtensions
,
prepareActions
}
from
'
vs/workbench/browser/actionBarRegistry
'
;
import
{
IAction
}
from
'
vs/base/common/actions
'
;
import
{
Part
}
from
'
vs/workbench/browser/part
'
;
import
{
EventType
as
WorkbenchEventType
,
EditorEvent
}
from
'
vs/workbench/common/events
'
;
import
{
IEditorRegistry
,
Extensions
as
EditorExtensions
,
BaseEditor
,
IEditorInputActionContext
,
EditorDescriptor
}
from
'
vs/workbench/browser/parts/editor/baseEditor
'
;
import
{
EditorInput
,
EditorOptions
,
TextEditorOptions
}
from
'
vs/workbench/common/editor
'
;
import
{
BaseTextEditor
}
from
'
vs/workbench/browser/parts/editor/textEditor
'
;
import
{
EventType
as
SideBySideEventType
,
SideBySideEditorControl
,
Rochade
}
from
'
vs/workbench/browser/parts/editor/sideBySideEditorControl
'
;
import
{
WorkbenchProgressService
}
from
'
vs/workbench/services/progress/browser/progressService
'
;
import
{
EditorArrangement
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IEditorPart
}
from
'
vs/workbench/services/editor/browser/editorService
'
;
import
{
IPartService
}
from
'
vs/workbench/services/part/common/partService
'
;
import
{
Position
,
POSITIONS
}
from
'
vs/platform/editor/common/editor
'
;
import
{
IStorageService
}
from
'
vs/platform/storage/common/storage
'
;
import
{
IEventService
}
from
'
vs/platform/event/common/event
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
ServiceCollection
}
from
'
vs/platform/instantiation/common/serviceCollection
'
;
import
{
IMessageService
,
IMessageWithAction
,
Severity
}
from
'
vs/platform/message/common/message
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IProgressService
}
from
'
vs/platform/progress/common/progress
'
;
import
{
EditorStacksModel
,
IEditorStacksModel
,
IEditorGroup
}
from
'
vs/workbench/common/editor/editorStacksModel
'
;
export
class
EditorPart
extends
Part
implements
IEditorPart
{
private
stacksModel
:
IEditorStacksModel
;
private
groupsToEditor
:
{
[
groupId
:
number
]:
BaseEditor
;
};
private
sideBySideControl
:
SideBySideEditorControl
;
private
memento
:
any
;
constructor
(
id
:
string
,
@
IMessageService
private
messageService
:
IMessageService
,
@
IEventService
private
eventService
:
IEventService
,
@
ITelemetryService
private
telemetryService
:
ITelemetryService
,
@
IStorageService
private
storageService
:
IStorageService
,
@
IPartService
private
partService
:
IPartService
,
@
IInstantiationService
private
instantiationService
:
IInstantiationService
)
{
super
(
id
);
this
.
groupsToEditor
=
Object
.
create
(
null
);
this
.
stacksModel
=
this
.
instantiationService
.
createInstance
(
EditorStacksModel
);
}
public
getStacksModel
():
IEditorStacksModel
{
return
this
.
stacksModel
;
}
public
getActiveEditorInput
():
EditorInput
{
const
group
=
this
.
stacksModel
.
activeGroup
;
return
group
?
group
.
activeEditor
:
null
;
}
public
getActiveEditor
():
BaseEditor
{
const
activeGroup
=
this
.
stacksModel
.
activeGroup
;
if
(
activeGroup
)
{
return
this
.
groupsToEditor
[
activeGroup
.
id
];
}
return
null
;
}
public
getVisibleEditors
():
BaseEditor
[]
{
return
this
.
stacksModel
.
groups
.
map
(
g
=>
this
.
groupsToEditor
[
g
.
id
]);
}
public
openEditor
(
input
?:
EditorInput
,
options
?:
EditorOptions
,
sideBySide
?:
boolean
):
TPromise
<
BaseEditor
>
;
public
openEditor
(
input
?:
EditorInput
,
options
?:
EditorOptions
,
position
?:
Position
,
widthRatios
?:
number
[]):
TPromise
<
BaseEditor
>
;
public
openEditor
(
input
?:
EditorInput
,
options
?:
EditorOptions
,
arg3
?:
any
,
widthRatios
?:
number
[]):
TPromise
<
BaseEditor
>
{
return
TPromise
.
as
(
null
);
}
public
activateEditor
(
editor
:
BaseEditor
):
void
{
const
group
=
this
.
groupOfEditor
(
editor
);
// Activate group of editor
this
.
stacksModel
.
setActive
(
group
);
// Activate input of editor
group
.
setActive
(
editor
.
input
);
}
public
moveEditor
(
from
:
Position
,
to
:
Position
):
void
{
// TODO@stacks method should be removed and the stacks model be used directly
this
.
stacksModel
.
moveGroup
(
this
.
stacksModel
.
groups
[
from
],
to
);
}
public
closeEditors
(
othersOnly
?:
boolean
):
TPromise
<
void
>
{
// TODO@stacks method should be removed and the stacks model be used directly
this
.
stacksModel
.
closeGroups
(
othersOnly
?
this
.
stacksModel
.
activeGroup
:
void
0
);
return
TPromise
.
as
(
null
);
}
public
arrangeEditors
(
arrangement
:
EditorArrangement
):
void
{
this
.
sideBySideControl
.
arrangeEditors
(
arrangement
);
}
public
createContentArea
(
parent
:
Builder
):
Builder
{
// Content Container
let
contentArea
=
$
(
parent
)
.
div
()
.
addClass
(
'
content
'
);
// Stacks Control
this
.
sideBySideControl
=
this
.
instantiationService
.
createInstance
(
SideBySideEditorControl
,
contentArea
);
// TODO@stacks this.toUnbind.push(this.sideBySideControl.addListener(SideBySideEventType.EDITOR_FOCUS_CHANGED, () => { this.onEditorFocusChanged(); }));
// settings
this
.
memento
=
this
.
getMemento
(
this
.
storageService
,
MementoScope
.
WORKSPACE
);
return
contentArea
;
}
public
layout
(
dimension
:
Dimension
):
Dimension
[]
{
// Pass to super
let
sizes
=
super
.
layout
(
dimension
);
// Pass to Stacks Control
const
size
=
sizes
[
1
];
this
.
sideBySideControl
.
layout
(
size
);
return
sizes
;
}
public
shutdown
():
void
{
// TODO@stacks persist side by side width ratios
// TODO@stacks shutdown instantiated editors
// Pass to super
super
.
shutdown
();
}
public
dispose
():
void
{
// TODO@stacks dispose instantiated editors
// Pass to stacks control
this
.
sideBySideControl
.
dispose
();
// Pass to super
super
.
dispose
();
}
private
groupOfEditor
(
editor
:
BaseEditor
):
IEditorGroup
{
for
(
let
groupId
of
Object
.
keys
(
this
.
groupsToEditor
))
{
let
groupEditor
=
this
.
groupsToEditor
[
groupId
];
if
(
groupEditor
===
editor
)
{
return
this
.
stacksModel
.
getGroup
(
Number
(
groupId
));
}
}
return
null
;
}
/// --- NOT IMPLEMENTED YET
public
setEditors
(
inputs
:
EditorInput
[],
options
?:
EditorOptions
[]):
TPromise
<
BaseEditor
[]
>
{
return
TPromise
.
as
([]);
}
public
restoreEditorState
(
inputsToOpen
?:
EditorInput
[],
options
?:
EditorOptions
[]):
TPromise
<
BaseEditor
[]
>
{
return
TPromise
.
as
([]);
}
}
\ No newline at end of file
src/vs/workbench/browser/workbench.ts
浏览文件 @
12562dcf
...
...
@@ -27,7 +27,7 @@ import {TextEditorOptions, EditorInput, EditorOptions} from 'vs/workbench/common
import
{
Part
}
from
'
vs/workbench/browser/part
'
;
import
{
HistoryService
}
from
'
vs/workbench/services/history/browser/history
'
;
import
{
ActivitybarPart
}
from
'
vs/workbench/browser/parts/activitybar/activitybarPart
'
;
import
{
EditorPart
}
from
'
vs/workbench/browser/parts/editor/editorPart
'
;
import
{
EditorPart
}
from
'
vs/workbench/browser/parts/editor/editorPart
2
'
;
import
{
SidebarPart
}
from
'
vs/workbench/browser/parts/sidebar/sidebarPart
'
;
import
{
PanelPart
}
from
'
vs/workbench/browser/parts/panel/panelPart
'
;
import
{
StatusbarPart
}
from
'
vs/workbench/browser/parts/statusbar/statusbarPart
'
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录