See: Description
Package | Description |
---|---|
org.netbeans.core.multitabs |
multitabs
The main purpose of this API is to allow third-party customizations of editor tabs. Instead of implementing many interfaces and creating various UI delegates it is possible to create a simple decorator-like class that can customize the appearance of a specific editor tab. For example change tabs background color according to file type or project type, change its icon etc.
To customize the rendering of (some) editor tabs one needs subclass
TabDecorator
class and register it in the global Lookup
.
The example below shows a decorator that removes file extension from Java source files to have shorter tabs to show more file names without the need for scrolling.
ServiceProvider(service = TabDecorator.class, position = 1000) public class MyTabDecorator extends TabDecorator { public String getText( TabData tab ) { String res = tab.getText(); if( null != res ) res = res.replace( ".java", ""); return res; } }
If one needs a custom editor tab displayer for example to have special
tab layout or special layout of scrolling buttons etc it is necessary
to subclass TabDisplayer
class and register an instance
of TabDisplayerFactory
in the global Lookup
.
public class MyTabDisplayer extends TabDisplayer { public MyTabDisplayer( TabDataModel model ) { super( model ); } ServiceProvider(service = TabDisplayerFactory.class) public static class MyTabDisplayerFactory extends TabDisplayerFactory { public TabDisplayer createTabDisplayer( TabDataModel tabModel, int orientation ) { return new MyTabDisplayer( tabModel ); } } //implement all abstract methods here }
|
The sources for the module are in the Apache Git repositories or in the GitHub repositories.
No other dependencies.
Read more about the implementation in the answers to architecture questions.