public void setSelectedEditor(final int selectedEditor) {
        final int oldEditor = this.selectedRootEditor;
        if (oldEditor == selectedEditor) {
            // no change - so nothing to do!
            return;
        }
        this.selectedRootEditor = selectedEditor;
        // make sure that only the selected editor is active.
        // all other editors will be disabled, if needed and
        // not touched if they are already in the correct state

        for (int i = 0; i < this.rootEditors.size(); i++) {
            final boolean shouldBeActive = (i == selectedEditor);
            final RootEditor container =
                (RootEditor) this.rootEditors.get(i);
            if (container.isActive() && (shouldBeActive == false)) {
                container.setActive(false);
            }
        }

        if (this.currentToolbar != null) {
            closeToolbar();
            this.toolbarContainer.removeAll();
            this.currentToolbar = null;
        }

        for (int i = 0; i < this.rootEditors.size(); i++) {
            final boolean shouldBeActive = (i == selectedEditor);
            final RootEditor container =
                (RootEditor) this.rootEditors.get(i);
            if ((container.isActive() == false) && (shouldBeActive == true)) {
                container.setActive(true);
                setJMenuBar(createEditorMenubar(container));
                this.currentToolbar = container.getToolbar();
                if (this.currentToolbar != null) {
                    this.toolbarContainer.add
                        (this.currentToolbar, BorderLayout.CENTER);
                    this.toolbarContainer.setVisible(true);
                    this.currentToolbar.setVisible(true);
                }
                else {
                    this.toolbarContainer.setVisible(false);
                }

                this.getJMenuBar().repaint();
            }
        }
    }