|
|
@@ -1,5 +1,5 @@
|
|
|
import * as React from 'react';
|
|
|
-import { inject, injectable, interfaces } from '@theia/core/shared/inversify';
|
|
|
+import { inject, injectable, interfaces, postConstruct } from '@theia/core/shared/inversify';
|
|
|
import {
|
|
|
AbstractViewContribution, codicon, CompositeTreeNode,
|
|
|
ContextMenuRenderer, createTreeContainer,
|
|
|
@@ -65,6 +65,14 @@ export class Modula2ExplorerWidget extends TreeWidget {
|
|
|
this.title.label = 'Modula-2 Project';
|
|
|
this.title.caption = 'Modula-2 project files';
|
|
|
this.title.closable = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ @postConstruct()
|
|
|
+ protected initialize(): void {
|
|
|
+ // NOTE: inversify only invokes the most-derived @postConstruct, so the
|
|
|
+ // base TreeWidget.init() (row-update wiring) must be called explicitly.
|
|
|
+ super.init();
|
|
|
+ // Injections are complete here (never touch them in the constructor).
|
|
|
this.toDispose.push(this.model.onSelectionChanged(nodes => this.openSelected(nodes)));
|
|
|
this.toDispose.push(this.files.onDidFilesChange(() => this.scheduleRefresh()));
|
|
|
this.toDispose.push(this.workspace.onWorkspaceChanged(() => this.refresh()));
|
|
|
@@ -121,7 +129,12 @@ export class Modula2ExplorerWidget extends TreeWidget {
|
|
|
}
|
|
|
this.model.root = rootNode;
|
|
|
} catch (error) {
|
|
|
- console.error('Modula-2 explorer refresh failed:', error);
|
|
|
+ const message = error instanceof Error ? error.message : String(error);
|
|
|
+ console.error('Modula-2 explorer refresh failed:', message);
|
|
|
+ const errNode = folderNode('m2error', 'Explorer error', 'group');
|
|
|
+ const detail = fileNode('m2error:detail', message.slice(0, 120), false);
|
|
|
+ CompositeTreeNode.addChild(errNode, detail);
|
|
|
+ this.model.root = errNode;
|
|
|
}
|
|
|
}
|
|
|
|