Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
eb405494
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,发现更多精彩内容 >>
提交
eb405494
编写于
12月 21, 2017
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rename command
上级
919b7df8
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
27 addition
and
4 deletion
+27
-4
src/vs/workbench/parts/files/electron-browser/fileActions.contribution.ts
.../parts/files/electron-browser/fileActions.contribution.ts
+11
-2
src/vs/workbench/parts/files/electron-browser/fileActions.ts
src/vs/workbench/parts/files/electron-browser/fileActions.ts
+16
-2
未找到文件。
src/vs/workbench/parts/files/electron-browser/fileActions.contribution.ts
浏览文件 @
eb405494
...
...
@@ -9,7 +9,7 @@ import { Registry } from 'vs/platform/registry/common/platform';
import
{
Action
,
IAction
}
from
'
vs/base/common/actions
'
;
import
{
ActionItem
,
BaseActionItem
,
Separator
}
from
'
vs/base/browser/ui/actionbar/actionbar
'
;
import
{
Scope
,
IActionBarRegistry
,
Extensions
as
ActionBarExtensions
,
ActionBarContributor
}
from
'
vs/workbench/browser/actions
'
;
import
{
GlobalNewUntitledFileAction
,
SaveFileAsAction
,
ShowOpenedFileInNewWindow
,
CopyPathAction
,
GlobalCopyPathAction
,
RevealInOSAction
,
GlobalRevealInOSAction
,
pasteIntoFocusedFilesExplorerViewItem
,
FocusOpenEditorsView
,
FocusFilesExplorer
,
GlobalCompareResourcesAction
,
GlobalNewFileAction
,
GlobalNewFolderAction
,
RevertFileAction
,
SaveFilesAction
,
SaveAllAction
,
SaveFileAction
,
MoveFileToTrashAction
,
TriggerRenameFileAction
,
PasteFileAction
,
CopyFileAction
,
ShowActiveFileInExplorer
,
CollapseExplorerView
,
RefreshExplorerView
,
CompareWithSavedAction
,
CompareWithClipboardAction
,
NEW_FILE_COMMAND_ID
,
NEW_FILE_LABEL
,
NEW_FOLDER_COMMAND_ID
,
NEW_FOLDER
_LABEL
}
from
'
vs/workbench/parts/files/electron-browser/fileActions
'
;
import
{
GlobalNewUntitledFileAction
,
SaveFileAsAction
,
ShowOpenedFileInNewWindow
,
CopyPathAction
,
GlobalCopyPathAction
,
RevealInOSAction
,
GlobalRevealInOSAction
,
pasteIntoFocusedFilesExplorerViewItem
,
FocusOpenEditorsView
,
FocusFilesExplorer
,
GlobalCompareResourcesAction
,
GlobalNewFileAction
,
GlobalNewFolderAction
,
RevertFileAction
,
SaveFilesAction
,
SaveAllAction
,
SaveFileAction
,
MoveFileToTrashAction
,
PasteFileAction
,
CopyFileAction
,
ShowActiveFileInExplorer
,
CollapseExplorerView
,
RefreshExplorerView
,
CompareWithSavedAction
,
CompareWithClipboardAction
,
NEW_FILE_COMMAND_ID
,
NEW_FILE_LABEL
,
NEW_FOLDER_COMMAND_ID
,
NEW_FOLDER_LABEL
,
TRIGGER_RENAME_COMMAND_ID
,
TRIGGER_RENAME
_LABEL
}
from
'
vs/workbench/parts/files/electron-browser/fileActions
'
;
import
{
revertLocalChangesCommand
,
acceptLocalChangesCommand
,
CONFLICT_RESOLUTION_CONTEXT
}
from
'
vs/workbench/parts/files/electron-browser/saveErrorHandler
'
;
import
{
SyncActionDescriptor
,
MenuId
,
MenuRegistry
}
from
'
vs/platform/actions/common/actions
'
;
import
{
IWorkbenchActionRegistry
,
Extensions
as
ActionExtensions
}
from
'
vs/workbench/common/actions
'
;
...
...
@@ -66,7 +66,6 @@ class FilesViewerActionContributor extends ActionBarContributor {
// Rename File/Folder
if
(
!
stat
.
isRoot
)
{
actions
.
push
(
new
Separator
(
null
,
150
));
actions
.
push
(
this
.
instantiationService
.
createInstance
(
TriggerRenameFileAction
,
tree
,
<
FileStat
>
stat
));
// Delete File/Folder
actions
.
push
(
this
.
instantiationService
.
createInstance
(
MoveFileToTrashAction
,
tree
,
<
FileStat
>
stat
));
}
...
...
@@ -444,3 +443,13 @@ MenuRegistry.appendMenuItem(MenuId.ExplorerContext, {
},
when
:
ContextKeyExpr
.
and
(
ExplorerFolderContext
)
});
MenuRegistry
.
appendMenuItem
(
MenuId
.
ExplorerContext
,
{
group
:
'
5_modify
'
,
order
:
10
,
command
:
{
id
:
TRIGGER_RENAME_COMMAND_ID
,
title
:
TRIGGER_RENAME_LABEL
},
when
:
ExplorerRootContext
.
toNegated
()
});
src/vs/workbench/parts/files/electron-browser/fileActions.ts
浏览文件 @
eb405494
...
...
@@ -68,6 +68,9 @@ export const NEW_FILE_LABEL = nls.localize('newFile', "New File");
export
const
NEW_FOLDER_COMMAND_ID
=
'
workbench.command.files.newFolder
'
;
export
const
NEW_FOLDER_LABEL
=
nls
.
localize
(
'
newFolder
'
,
"
New Folder
"
);
export
const
TRIGGER_RENAME_COMMAND_ID
=
'
workbench.command.files.rename
'
;
export
const
TRIGGER_RENAME_LABEL
=
nls
.
localize
(
'
rename
'
,
"
Rename
"
);
export
class
BaseErrorReportingAction
extends
Action
{
constructor
(
...
...
@@ -149,7 +152,7 @@ export class BaseFileAction extends BaseErrorReportingAction {
}
}
export
class
TriggerRenameFileAction
extends
BaseFileAction
{
class
TriggerRenameFileAction
extends
BaseFileAction
{
public
static
readonly
ID
=
'
renameFile
'
;
...
...
@@ -164,7 +167,7 @@ export class TriggerRenameFileAction extends BaseFileAction {
@
ITextFileService
textFileService
:
ITextFileService
,
@
IInstantiationService
instantiationService
:
IInstantiationService
)
{
super
(
TriggerRenameFileAction
.
ID
,
nls
.
localize
(
'
rename
'
,
"
Rename
"
)
,
fileService
,
messageService
,
textFileService
);
super
(
TriggerRenameFileAction
.
ID
,
TRIGGER_RENAME_LABEL
,
fileService
,
messageService
,
textFileService
);
this
.
tree
=
tree
;
this
.
element
=
element
;
...
...
@@ -1785,3 +1788,14 @@ CommandsRegistry.registerCommand({
return
newFolderAction
.
run
(
explorerContext
);
}
});
CommandsRegistry
.
registerCommand
({
id
:
TRIGGER_RENAME_COMMAND_ID
,
handler
:
(
accessor
,
resource
:
URI
,
explorerContext
:
IExplorerContext
)
=>
{
const
instantationService
=
accessor
.
get
(
IInstantiationService
);
const
listService
=
accessor
.
get
(
IListService
);
const
renameAction
=
instantationService
.
createInstance
(
TriggerRenameFileAction
,
listService
.
lastFocusedList
,
explorerContext
.
stat
);
return
renameAction
.
run
(
explorerContext
);
}
});
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录