/*
 * Copyright 2000-2009 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.intellij.ide.util.newProjectWizard;

import com.intellij.ui.CheckboxTree;
import com.intellij.ui.CheckedTreeNode;
import com.intellij.util.ui.tree.TreeUtil;

import javax.swing.*;
import javax.swing.tree.TreePath;
import java.awt.*;
import java.awt.event.MouseEvent;
import java.util.List;

/**
 * @author nik
 */
public class FrameworksTree extends CheckboxTree {
  private boolean myProcessingMouseEventOnCheckbox;

  public FrameworksTree(List<List<FrameworkSupportNode>> groups) {
    super(new FrameworksTreeRenderer(), new FrameworksRootNode(groups), new CheckPolicy(false, true, true, false));
    setRootVisible(false);
    setShowsRootHandles(false);
    TreeUtil.expandAll(this);
  }

  @Override
  protected void processMouseEvent(MouseEvent e) {
    final TreePath path = getPathForLocation(e.getX(), e.getY());
    if (path != null) {
      final Object node = path.getLastPathComponent();
      if (node instanceof FrameworkSupportNode) {
        final Rectangle checkboxBounds = ((CheckboxTreeCellRendererBase)getCellRenderer()).myCheckbox.getBounds();
        final Rectangle pathBounds = getPathBounds(path);
        checkboxBounds.setLocation(pathBounds.getLocation());
        if (checkboxBounds.contains(e.getPoint())) {
          try {
            myProcessingMouseEventOnCheckbox = true;
            super.processMouseEvent(e);
          }
          finally {
            myProcessingMouseEventOnCheckbox = false;
          }
          return;
        }
      }
    }

    super.processMouseEvent(e);
  }

  public boolean isProcessingMouseEventOnCheckbox() {
    return myProcessingMouseEventOnCheckbox;
  }

  private static class FrameworksTreeRenderer extends CheckboxTreeCellRenderer {
    private FrameworksTreeRenderer() {
      super(true, false);
    }

    @Override
    public void customizeRenderer(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
      if (value instanceof FrameworkSupportNode) {
        final FrameworkSupportNode node = (FrameworkSupportNode)value;
        getTextRenderer().append(node.getTitle());
        getTextRenderer().setIcon(node.getProvider().getIcon());
      }
    }
  }

  private static class FrameworksRootNode extends CheckedTreeNode {
    public FrameworksRootNode(List<List<FrameworkSupportNode>> groups) {
      super(null);
      for (List<FrameworkSupportNode> group : groups) {
        for (FrameworkSupportNode node : group) {
          add(node);
        }
      }
    }
  }
}

@@ -720,16 +720,103 @@
 eeNode;%0A
+import com.intellij.ui.TreeSpeedSearch;%0Aimport com.intellij.util.containers.Convertor;%0A
 import c
@@ -2221,16 +2221,412 @@
 );%0A  %7D%0A%0A
+  @Override%0A  protected void installSpeedSearch() %7B%0A    new TreeSpeedSearch(this, new Convertor%3CTreePath, String%3E() %7B%0A      @Override%0A      public String convert(TreePath path) %7B%0A        final Object node = path.getLastPathComponent();%0A        if (node instanceof FrameworkSupportNode) %7B%0A          return ((FrameworkSupportNode)node).getTitle();%0A        %7D%0A        return %22%22;%0A      %7D%0A    %7D);%0A  %7D%0A%0A
   public

Add frameword support page: quick search is not working