private JComponent createTreeToolbar() { final DefaultActionGroup group = new DefaultActionGroup(); final Runnable update = new Runnable() { public void run() { rebuild(true); } }; if (ProjectViewDirectoryHelper.getInstance(myProject).supportsFlattenPackages()) { group.add(new FlattenPackagesAction(update)); } final PatternDialectProvider[] dialectProviders = Extensions.getExtensions(PatternDialectProvider.EP_NAME); for (PatternDialectProvider provider : dialectProviders) { for (AnAction action : provider.createActions(myProject, update)) { group.add(action); } } group.add(new ShowFilesAction(update)); final Module[] modules = ModuleManager.getInstance(myProject).getModules(); if (modules.length > 1) { group.add(new ShowModulesAction(update)); group.add(new ShowModuleGroupsAction(update)); } group.add(new FilterLegalsAction(update)); if (dialectProviders.length > 1) { group.add(new ChooseScopeTypeAction(update)); } ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, group, true); return toolbar.getComponent(); }
private void initTree(Tree tree) { tree.setCellRenderer(new MyTreeCellRenderer()); tree.setRootVisible(false); tree.setShowsRootHandles(true); tree.setLineStyleAngled(); TreeUtil.installActions(tree); SmartExpander.installOn(tree); new TreeSpeedSearch(tree); tree.addTreeWillExpandListener( new TreeWillExpandListener() { @Override public void treeWillExpand(TreeExpansionEvent event) throws ExpandVetoException { ((PackageDependenciesNode) event.getPath().getLastPathComponent()).sortChildren(); } @Override public void treeWillCollapse(TreeExpansionEvent event) throws ExpandVetoException {} }); PopupHandler.installUnknownPopupHandler( tree, createTreePopupActions(), ActionManager.getInstance()); }