@Override
  public void configurationChanged() {
    configurationOverrideModel.removeAllElements();

    configurationOverrideModel.addElement(DEFAULT_OVERRIDE);
    for (ConfigurationLocation configurationLocation :
        checkStylePlugin.getConfiguration().getConfigurationLocations()) {
      configurationOverrideModel.addElement(configurationLocation);
    }
    configurationOverrideModel.setSelectedItem(DEFAULT_OVERRIDE);
  }
  /**
   * Create a tool window for the given project.
   *
   * @param project the project.
   */
  public CheckStyleToolWindowPanel(final ToolWindow toolWindow, final Project project) {
    super(new BorderLayout());

    this.toolWindow = toolWindow;
    this.project = project;

    checkStylePlugin = project.getComponent(CheckStylePlugin.class);
    if (checkStylePlugin == null) {
      throw new IllegalStateException("Couldn't get checkstyle plugin");
    }

    configurationChanged();
    checkStylePlugin.getConfiguration().addConfigurationListener(this);

    final ActionGroup mainActionGroup =
        (ActionGroup) ActionManager.getInstance().getAction(MAIN_ACTION_GROUP);
    final ActionToolbar mainToolbar =
        ActionManager.getInstance().createActionToolbar(ID_TOOLWINDOW, mainActionGroup, false);

    final ActionGroup treeActionGroup =
        (ActionGroup) ActionManager.getInstance().getAction(TREE_ACTION_GROUP);
    final ActionToolbar treeToolbar =
        ActionManager.getInstance().createActionToolbar(ID_TOOLWINDOW, treeActionGroup, false);

    final Box toolBarBox = Box.createHorizontalBox();
    toolBarBox.add(mainToolbar.getComponent());
    toolBarBox.add(treeToolbar.getComponent());

    setBorder(new EmptyBorder(1, 1, 1, 1));
    add(toolBarBox, BorderLayout.WEST);
    add(createToolPanel(), BorderLayout.CENTER);

    expandTree();

    mainToolbar.getComponent().setVisible(true);
  }