提交 3f38333b 编写于 作者: I isidor

getMultiSelectedEditorContexts

上级 f9237aa2
......@@ -475,7 +475,7 @@ function positionAndInput(editorGroupService: IEditorGroupService, editorService
export function getMultiSelectedEditorContexts(editorContext: IEditorIdentifier, listService: IListService): IEditorIdentifier[] {
const list = listService.lastFocusedList;
// Mapping for open editors view
const elementToContext = element => element && element.editorGroup && element.editorInput ? { group: element.editorGroup, editor: element.editorInput } : { group: element };
const elementToContext = element => element && element.editorGroup && element.editorInput ? { group: element.editorGroup, editor: element.editorInput } : { group: element, editor: undefined };
if (list instanceof List && list.isDOMFocused()) {
const selection = list.getSelectedElements();
......
......@@ -785,7 +785,7 @@ export interface IEditorGroup {
export interface IEditorIdentifier {
group: IEditorGroup;
editor?: IEditorInput;
editor: IEditorInput;
}
export interface IEditorCloseEvent extends IEditorIdentifier {
......
......@@ -36,9 +36,9 @@ export function getResourceForCommand(resource: URI, listService: IListService,
export function getMultiSelectedResources(resource: URI, listService: IListService, editorService: IWorkbenchEditorService): URI[] {
const list = listService.lastFocusedList;
if (list && list.isDOMFocused()) {
const focus = list.getFocus();
// Explorer
if (list instanceof Tree) {
const focus = list.getFocus();
const selection = list.getSelection();
if (selection && selection.indexOf(focus) >= 0) {
return selection.map(fs => fs.resource);
......@@ -46,8 +46,9 @@ export function getMultiSelectedResources(resource: URI, listService: IListServi
}
// Open editors view
if (list instanceof List) {
const focus = list.getFocusedElements();
const selection = list.getSelectedElements();
if (selection && selection.indexOf(focus) >= 0) {
if (selection && focus.length && selection.indexOf(focus[0]) >= 0) {
return selection.filter(s => s instanceof OpenEditor).map((oe: OpenEditor) => oe.getResource());
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册