Installing Eclipse theme causes NPE when glass extension is in the build path

Using docking frames 1.1.1 or 1.1.2 preview 4, I’m getting a NullPointerException when trying to install EclipseTheme with glass extension on the build path. My minimal program begins with the following:

 
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
JFrame frame = new JFrame();
DockFrontend frontEnd = new DockFrontend(frame);
DockController controller = frontEnd.getController();
DockTheme theme = new EclipseTheme();
controller.setTheme(theme);

The setTheme method will not complete. The top of the stack is:

 
at glass.eclipse.theme.EclipseThemeExtension.install(Unknown Source)
at bibliothek.gui.dock.themes.BasicTheme.install(BasicTheme.java:168)
at bibliothek.gui.dock.themes.ThemeManager.setTheme(ThemeManager.java:278)
at bibliothek.gui.DockController.setTheme(DockController.java:750)
at testdock.Minimal.exec(Minimal.java:41)

Inside the EclipseTheme.install, the local variable 'version; is null, the subsequent call to version.setFactory causes an NPE to be thrown.

 
public void install (DockController controller, DockTheme theme) {
      DockTitleManager manager = controller.getDockTitleManager();
      DockTitleVersion version = manager.getVersion(FlapDockStation.BUTTON_TITLE_ID);
      version.setFactory(CGlassDockTitleFactory.FACTORY, Priority.CLIENT);
   }

I can run your demo programs with glass extension; how do I ensure that FlapDockStation.BUTTON_TITLE_ID is initialized?

Thanks for the bug report, I’ll have that fixed in the next release (uploading it this weekend).

I would highly suggest you make use of the Common API, instead of only the Core API. Common offers many more features without any additional configuration (minimization, proper tracking of locations, persistency). Just use “CControl” instead of “DockFrontend”, and “CDockables” instead of “Dockables”.
There is a project with named “docking-frames-demo-tutorial”, it can show you how to use Common (and please do ask in the forum if you have troubles).


If you insist of using only Core, then this piece of code will make sure “version” is not null:

		DockFrontend frontEnd = new DockFrontend(frame);
		DockController controller = frontEnd.getController();

		// force initialization of the "version"
		controller.getDockTitleManager().registerClient( FlapDockStation.BUTTON_TITLE_ID, null );

		DockTheme theme = new EclipseTheme();
		controller.setTheme(theme);```