MCPcopy Create free account
hub / github.com/DTStack/molecule / EditorTreeService

Class EditorTreeService

src/services/workbench/explorer/editorTreeService.ts:71–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69
70@singleton()
71export class EditorTreeService
72 extends Component<IEditor>
73 implements IEditorTreeService
74{
75 protected state: IEditor;
76 private readonly editorService: EditorService;
77
78 constructor() {
79 super();
80 this.editorService = container.resolve(EditorService);
81 this.state = this.editorService.getState();
82 }
83
84 public onClose(callback: (tabId: UniqueId, groupId: UniqueId) => void) {
85 this.subscribe(EditorTreeEvent.onClose, callback);
86 }
87
88 public onCloseOthers(
89 callback: (tabItem: IEditorTab, groupId: UniqueId) => void
90 ) {
91 this.subscribe(EditorTreeEvent.onCloseOthers, callback);
92 }
93
94 public onCloseSaved(callback: (groupId: UniqueId) => void) {
95 this.subscribe(EditorTreeEvent.onCloseSaved, callback);
96 }
97
98 public onSelect(callback: (tabId: UniqueId, groupId: UniqueId) => void) {
99 this.subscribe(EditorTreeEvent.onSelect, callback);
100 }
101
102 public onCloseAll(callback: (groupId?: UniqueId) => void) {
103 this.subscribe(EditorTreeEvent.onCloseAll, callback);
104 }
105
106 public onSaveAll(callback: (groupId?: UniqueId) => void) {
107 this.subscribe(EditorTreeEvent.onSaveAll, callback);
108 }
109
110 public onToolbarClick(
111 callback: (toolbar: IActionBarItemProps, groupId?: UniqueId) => void
112 ) {
113 this.subscribe(EditorTreeEvent.onToolbarClick, callback);
114 }
115
116 public onLayout(callback: () => void) {
117 this.subscribe(EditorTreeEvent.onSplitEditorLayout, callback);
118 }
119
120 public onContextMenu(
121 callback: (
122 menu: IMenuItemProps,
123 file: ITabProps,
124 groupId: UniqueId
125 ) => void
126 ) {
127 this.subscribe(EditorTreeEvent.onContextMenu, callback);
128 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected