private ActionToolbar createToolbar() {
    DefaultActionGroup group = new DefaultActionGroup();

    BackAction back = new BackAction();
    back.registerCustomShortcutSet(
        new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0)), this);
    group.add(back);

    ForwardAction forward = new ForwardAction();
    forward.registerCustomShortcutSet(
        new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0)), this);
    group.add(forward);

    EditSourceActionBase edit = new EditSourceAction();
    edit.registerCustomShortcutSet(
        new CompositeShortcutSet(CommonShortcuts.getEditSource(), CommonShortcuts.ENTER), this);
    group.add(edit);

    edit = new ShowSourceAction();
    edit.registerCustomShortcutSet(
        new CompositeShortcutSet(CommonShortcuts.getViewSource(), CommonShortcuts.CTRL_ENTER),
        this);
    group.add(edit);

    return ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, group, true);
  }
 private DefaultActionGroup createActionGroup(JComponent component) {
   final DefaultActionGroup group = new DefaultActionGroup();
   final DefaultActionGroup temp = new DefaultActionGroup();
   NewPackageAction newPackageAction = new NewPackageAction();
   newPackageAction.enableInModalConext();
   newPackageAction.registerCustomShortcutSet(
       ActionManager.getInstance().getAction(IdeActions.ACTION_NEW_ELEMENT).getShortcutSet(),
       component);
   temp.add(newPackageAction);
   group.add(temp);
   return group;
 }
 @Override
 public KeyboardShortcut getShortcut() {
   return ActionManager.getInstance().getKeyboardShortcut("FindInPath");
 }
  protected JComponent createCenterPanel() {
    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());

    myModel = new DefaultTreeModel(new DefaultMutableTreeNode());
    createTreeModel();
    myTree = new Tree(myModel);

    UIUtil.setLineStyleAngled(myTree);
    myTree.setCellRenderer(
        new DefaultTreeCellRenderer() {
          public Component getTreeCellRendererComponent(
              JTree tree,
              Object value,
              boolean sel,
              boolean expanded,
              boolean leaf,
              int row,
              boolean hasFocus) {
            super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
            setIcon(expanded ? Icons.PACKAGE_OPEN_ICON : Icons.PACKAGE_ICON);

            if (value instanceof DefaultMutableTreeNode) {
              DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
              Object object = node.getUserObject();
              if (object instanceof PsiPackage) {
                String name = ((PsiPackage) object).getName();
                if (name != null && name.length() > 0) {
                  setText(name);
                } else {
                  setText(IdeBundle.message("node.default"));
                }
              }
            }
            return this;
          }
        });

    myTree.setBorder(BorderFactory.createEtchedBorder());
    JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTree);
    scrollPane.setPreferredSize(new Dimension(500, 300));

    new TreeSpeedSearch(
        myTree,
        new Convertor<TreePath, String>() {
          public String convert(TreePath path) {
            DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent();
            Object object = node.getUserObject();
            if (object instanceof PsiPackage) return ((PsiPackage) object).getName();
            else return "";
          }
        });

    myTree
        .getSelectionModel()
        .addTreeSelectionListener(
            new TreeSelectionListener() {
              public void valueChanged(TreeSelectionEvent e) {
                PsiPackage selection = getTreeSelection();
                if (selection != null) {
                  String name = selection.getQualifiedName();
                  setTitle(
                      myTitle
                          + " - "
                          + ("".equals(name) ? IdeBundle.message("node.default.package") : name));
                } else {
                  setTitle(myTitle);
                }
              }
            });

    panel.add(scrollPane, BorderLayout.CENTER);
    DefaultActionGroup group = createActionGroup(myTree);

    ActionToolbar toolBar =
        ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, group, true);
    panel.add(toolBar.getComponent(), BorderLayout.NORTH);
    toolBar.getComponent().setAlignmentX(JComponent.LEFT_ALIGNMENT);

    return panel;
  }