Using CWorkingArea in a CToolbarContentArea

Hello, I have written an application with a grid in the center, some single dockables one the left side and toolbars around it (similar to eclipse). This is all working fine, but if I add during runtime a new MultipleCDockable to the CContentToolbarArea, the previous closed dockables are again displayed (but this time without the close button). The options removeOnClose and setClosable are both enabled in the MultipleCDockable. I am using a factory for this. The code for startup:

this.control = new CControl(this);
		this.control.addControlListener(new CControlListener() {
			@Override
			public void added(CControl control, CDockable dockable) {
				// dockable added

			}

			@Override
			public void closed(CControl control, CDockable dockable) {
				controller.dockableClosed(dockable);

			}

			@Override
			public void opened(CControl control, CDockable dockable) {
				// dockable visible

			}

			@Override
			public void removed(CControl control, CDockable dockable) {
				controller.dockableClosed(dockable);

			}
		});
		this.control.setTheme(ThemeMap.KEY_ECLIPSE_THEME);
		this.area = new CToolbarContentArea(this.control, "center");
		this.control.addStationContainer(this.area);
		// register factories
		this.factory = new EditorDockableFactory("editor");
		control.addSingleDockableFactory("toolbox", new ToolboxFactory("toolbox"));
		//control.addSingleDockableFactory(new RegexFilter("toolbar.*"), new ToolbarItemFactory("toolbar"));
		control.addMultipleDockableFactory(CUSTOM_MULTI_FACTORY_ID, factory);
		grid = new CGrid(control);
		this.area.getCenterArea().deploy(grid);
		this.getContentPane().add(this.area.getComponent(), BorderLayout.CENTER);
		// adding status bar
		this.statusBar = new UIToolBar();
		this.getContentPane().add(this.statusBar, BorderLayout.SOUTH);

And the code for adding MultipleCDockables:

this.grid.add(20, 0, 80, 100, new EditorDockable(this.factory, title, panel, new ImageIcon(MainFrame.class.getResource("/icons/page_white.png"))));
		this.area.deploy(grid);

The grid and the area are stored as private attributes in the class (like the CControl too).
I have tried to use a new CGrid, but than I loose the open dockables.
What should I do?

Don’t use a CGrid to show new dockables. Instead you could use “CWorkingArea.show” to place and show the dockable at a “good” location. Or use “CControl.addDockable”, “CDockable.setLocationsAsideFocused” (since version 1.1.2p2) and “CDockable.setVisible” if you want to show a new dockable that is not a child of the CWorkingArea.

Thanks for your quick response. I use CWorkingArea and it is working fine.