If I want file icon show in side tab bars when theia start, what should i do?

And the file icon can’t be closed whenever

[original thread by oyo]

Do you mean that the explorer should be available on start and cannot be closable?

[oyo]

@anton-kosyakov yes, and the other widget icon that I create also should

You will need to make FileNavigatorWidget as not closable. widget.title.closable = false.

For isntance by rebinding it via https://github.com/eclipse-theia/theia/blob/e48b9b5fb5fbe66c6c91c41397e74f9fd73e9195/packages/navigator/src/browser/navigator-frontend-module.ts#L49-L51

after that you need to implement FrontendApplicationContribution.initializeLayout with calling FileNavigatorContribution.open. It will ensure that the explorer is always opened on first statrt.

Something similar for your custom widget.

[oyo]

@anton-kosyakov FileNavigatorContribution.open? I not see this method in FileNavigatorContribution, or not FileNavigatorContribution.openView?

[oyo]

If I want many icons show in side tab bars when start, and the widget not open, what should I do?

[oyo]

and I want know why here use createFileNavigatorWidget?thx

yes, it is openView.

By default FileNavigatorWidget is closable by a user, if you wan to change it, you have to hook into creation by rebinding it. You can call createFileNavigatorWidget, get a widget and set that it is title is not closable.

You should use FrontendApplicationContribution.initializeLayout to customize the default layout. For each view which you want to show by default, you should have a view contribution, you can ask it to open a view.

Maybe we are talking about different things because I keep repeating myself? :slight_smile: You mean a view when you taslk about the icon in side tab, correct?

[oyo]

@anton-kosyakov I try change closable of FileNavigatorWidget,and rebind FileNavigatorWidget to the new class,but It occrus the error:
Error: No matching bindings found for serviceIdentifier: Symbol(TreeProps)

[oyo]

and I try the code:

rebind(FileNavigatorWidget).toDynamicValue(ctx => {
const originFileNavigatorWidget = createFileNavigatorWidget(ctx.container);
originFileNavigatorWidget.title.closable = false;
return originFileNavigatorWidget;
});

but the file icon can also be closed,because I find that ohter code change closable be true;what should I do?

viewContainer.setTitleOptions(EXPLORER\_VIEW\_CONTAINER\_TITLE\_OPTIONS);

ah, true, it is not the navigator, but the explorer view container

[oyo]

@anton-kosyakov so if I want the explorer view container can’t be closed, what should I do?rebind or others?

try to rebind ViewContainer here: https://github.com/eclipse-theia/theia/blob/f5433ece0a32211439fd4acac33200894de1f012/packages/navigator/src/browser/navigator-frontend-module.ts#L56-L71

and make it not closable