Navigator Widget Factory¶
File: custom-ui/src/frontend/navigator-widget-factory.ts
Overview¶
Replaces Theia's default navigator widget factory to keep the explorer focused and minimal:
- Keeps only the Files tree widget.
- Removes the Open Editors widget from the explorer container.
- Prevents dragging the widget to other containers.
- Renames the view title to
Files.
Functions¶
initFileNavigator¶
export function initFileNavigator({
bind,
rebind,
}: {
bind: interfaces.Bind;
rebind: interfaces.Rebind;
}): void;
InversifyJS wiring entry point.
Bindings¶
| Action | From | To |
|---|---|---|
rebind |
TheiaNavigatorWidgetFactory |
NavigatorWidgetFactory (singleton) |
bind |
WidgetFactory |
Dynamic factory for FILE_NAVIGATOR_ID returning FileNavigatorWidget |
The dynamic widget factory uses createFileTreeContainer(...) with custom widget + standard Theia
tree/model/decorator services.
Classes¶
FileNavigatorWidget¶
Overrides doUpdateRows():
- Calls
super.doUpdateRows(). - Sets
this.title.label = nls.localizeByDefault("Files").
This ensures the tree root label is consistently Files.
NavigatorWidgetFactory¶
Customises explorer container composition and widget options.
Overridden Property¶
fileNavigatorWidgetOptions¶
protected override fileNavigatorWidgetOptions: ViewContainer.Factory.WidgetOptions = {
order: 0,
canHide: false,
initiallyCollapsed: false,
weight: 120,
disableDraggingToOtherContainers: true,
};
| Option | Value | Effect |
|---|---|---|
canHide |
false |
Files widget cannot be hidden |
disableDraggingToOtherContainers |
true |
Prevents moving widget out of explorer |
order |
0 |
Appears first in container |
weight |
120 |
Theia layout weight |
createWidget(): Promise<ViewContainer>¶
Creates explorer container with id EXPLORER_VIEW_CONTAINER_ID, then:
- Sets container title options with label
Filesandcloseable: false. - Gets/creates
FILE_NAVIGATOR_IDwidget. - Adds only navigator widget to container.
- Omits Theia's Open Editors widget (commented out intentionally).
Returns the configured ViewContainer.