| 39 | |
| 40 | @singleton() |
| 41 | export class EditorTreeController |
| 42 | extends Controller |
| 43 | implements IEditorTreeController |
| 44 | { |
| 45 | private readonly explorerService: ExplorerService; |
| 46 | private readonly editService: EditorService; |
| 47 | private readonly builtinService: IBuiltinService; |
| 48 | |
| 49 | constructor() { |
| 50 | super(); |
| 51 | this.editService = container.resolve(EditorService); |
| 52 | this.explorerService = container.resolve(ExplorerService); |
| 53 | this.builtinService = container.resolve(BuiltinService); |
| 54 | } |
| 55 | |
| 56 | public initView() { |
| 57 | const EditorTreeView = connect<IOpenEditProps>( |
| 58 | this.editService, |
| 59 | EditorTree |
| 60 | ); |
| 61 | const { |
| 62 | builtInExplorerEditorPanel, |
| 63 | builtInEditorTreeContextMenu, |
| 64 | builtInEditorTreeHeaderContextMenu, |
| 65 | } = this.builtinService.getModules(); |
| 66 | if (builtInExplorerEditorPanel) { |
| 67 | const { groupToolbar, ...restEditor } = builtInExplorerEditorPanel; |
| 68 | const contextMenu = builtInEditorTreeContextMenu || []; |
| 69 | const headerContextMenu = builtInEditorTreeHeaderContextMenu || []; |
| 70 | |
| 71 | this.explorerService.addPanel({ |
| 72 | ...restEditor, |
| 73 | renderPanel: (panel) => ( |
| 74 | <EditorTreeView |
| 75 | panel={panel} |
| 76 | contextMenu={contextMenu} |
| 77 | headerContextMenu={headerContextMenu} |
| 78 | groupToolbar={groupToolbar} |
| 79 | onClose={this.onClose} |
| 80 | onSelect={this.onSelect} |
| 81 | onCloseGroup={this.onCloseGroup} |
| 82 | onSaveGroup={this.onSaveGroup} |
| 83 | onContextMenu={this.onContextMenu} |
| 84 | onToolbarClick={this.onToolbarClick} |
| 85 | /> |
| 86 | ), |
| 87 | }); |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | public onContextMenu = ( |
| 92 | menu: IMenuItemProps, |
| 93 | groupId: UniqueId, |
| 94 | file?: ITabProps |
| 95 | ) => { |
| 96 | const { |
| 97 | EDITOR_MENU_CLOSE, |
| 98 | EDITOR_MENU_CLOSE_OTHERS, |
nothing calls this directly
no test coverage detected