Hello,
I'm currently trying to change the title of a tab (CHE 5.10.0).
I have for example this project:

and when I open the file README, I got this:

Is there a simple way to change the title of the tab without modifying the existing CHE source code, with an extension for example ?
Hi, @vnea! You can create an implementation of org.eclipse.che.ide.api.resources.ResourceInterceptor for this purpose.
See example:
import com.google.inject.Singleton;
import org.eclipse.che.ide.api.resources.Resource;
import org.eclipse.che.ide.api.resources.ResourceInterceptor;
import org.eclipse.che.ide.api.resources.marker.PresentableTextMarker;
@Singleton
public class CustomResourceInterceptor implements ResourceInterceptor {
public static final String README = "README";
@Override
public void intercept(Resource resource) {
// or by specific path resource.getLocation().equals(Path.valueOf("/ChangeTabTitle/README"))
if (resource.isFile() && README.equals(resource.getName())) {
resource.addMarker(new PresentableTextMarker("custom_title"));
}
}
}
Then register this interceptor in your gin module:
@ExtensionGinModule
public class MavenGinModule extends AbstractGinModule {
@Override
protected void configure() {
// ...
GinMultibinder.newSetBinder(binder(), ResourceInterceptor.class).addBinding().to(CustomResourceInterceptor.class);
// ...
}
}
And you'll have smth like that:

@vzhukovskii Thank it works perfectly !
Most helpful comment
Hi, @vnea! You can create an implementation of
org.eclipse.che.ide.api.resources.ResourceInterceptorfor this purpose.See example:
Then register this interceptor in your gin module:
And you'll have smth like that:
