use of com.intellij.ide.DefaultTreeExpander in project intellij-community by JetBrains.
the class IntentionSettingsTree method initTree.
private void initTree() {
myTree = new CheckboxTree(new CheckboxTree.CheckboxTreeCellRenderer(true) {
@Override
public void customizeRenderer(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
if (!(value instanceof CheckedTreeNode))
return;
CheckedTreeNode node = (CheckedTreeNode) value;
SimpleTextAttributes attributes = node.getUserObject() instanceof IntentionActionMetaData ? SimpleTextAttributes.REGULAR_ATTRIBUTES : SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES;
final String text = getNodeText(node);
final Color background = selected ? UIUtil.getTreeSelectionBackground() : UIUtil.getTreeTextBackground();
UIUtil.changeBackGround(this, background);
if (text != null) {
SearchUtil.appendFragments(myFilter != null ? myFilter.getFilter() : null, text, attributes.getStyle(), attributes.getFgColor(), background, getTextRenderer());
}
}
}, new CheckedTreeNode(null));
myTree.getSelectionModel().addTreeSelectionListener(new TreeSelectionListener() {
@Override
public void valueChanged(TreeSelectionEvent e) {
TreePath path = e.getPath();
Object userObject = ((DefaultMutableTreeNode) path.getLastPathComponent()).getUserObject();
selectionChanged(userObject);
}
});
myFilter = new MyFilterComponent();
myComponent = new JPanel(new BorderLayout());
JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTree);
myNorthPanel = new JPanel(new BorderLayout());
myNorthPanel.add(myFilter, BorderLayout.CENTER);
final DefaultActionGroup group = new DefaultActionGroup();
final CommonActionsManager actionManager = CommonActionsManager.getInstance();
final DefaultTreeExpander treeExpander = new DefaultTreeExpander(myTree);
group.add(actionManager.createExpandAllAction(treeExpander, myTree));
group.add(actionManager.createCollapseAllAction(treeExpander, myTree));
myNorthPanel.add(ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, group, true).getComponent(), BorderLayout.WEST);
myComponent.add(myNorthPanel, BorderLayout.NORTH);
myComponent.add(scrollPane, BorderLayout.CENTER);
myFilter.reset();
}
use of com.intellij.ide.DefaultTreeExpander in project intellij-community by JetBrains.
the class ArtifactEditorImpl method createPopupActionGroup.
private DefaultActionGroup createPopupActionGroup() {
final LayoutTree tree = myLayoutTreeComponent.getLayoutTree();
DefaultActionGroup popupActionGroup = new DefaultActionGroup();
final List<AnAction> createActions = new ArrayList<>();
AddCompositeElementAction.addCompositeCreateActions(createActions, this);
for (AnAction createAction : createActions) {
popupActionGroup.add(createAction);
}
popupActionGroup.add(createAddNonCompositeElementGroup());
final RemovePackagingElementAction removeAction = new RemovePackagingElementAction(this);
removeAction.registerCustomShortcutSet(CommonShortcuts.getDelete(), tree);
popupActionGroup.add(removeAction);
popupActionGroup.add(new ExtractArtifactAction(this));
popupActionGroup.add(new InlineArtifactAction(this));
popupActionGroup.add(new RenamePackagingElementAction(this));
popupActionGroup.add(new SurroundElementWithAction(this));
popupActionGroup.add(Separator.getInstance());
popupActionGroup.add(new HideContentAction(this));
popupActionGroup.add(new LayoutTreeNavigateAction(myLayoutTreeComponent));
popupActionGroup.add(new LayoutTreeFindUsagesAction(myLayoutTreeComponent, myProject, myContext.getParent()));
popupActionGroup.add(Separator.getInstance());
CommonActionsManager actionsManager = CommonActionsManager.getInstance();
DefaultTreeExpander treeExpander = new DefaultTreeExpander(tree);
popupActionGroup.add(actionsManager.createExpandAllAction(treeExpander, tree));
popupActionGroup.add(actionsManager.createCollapseAllAction(treeExpander, tree));
return popupActionGroup;
}
use of com.intellij.ide.DefaultTreeExpander in project azure-tools-for-java by Microsoft.
the class AzureSdkTreePanel method initToolbar.
private ActionToolbarImpl initToolbar() {
final DefaultTreeExpander expander = new DefaultTreeExpander(this.tree);
final DefaultActionGroup group = new DefaultActionGroup();
final CommonActionsManager manager = CommonActionsManager.getInstance();
group.add(new RefreshAction());
group.addSeparator();
group.add(manager.createExpandAllAction(expander, this.tree));
group.add(manager.createCollapseAllAction(expander, this.tree));
return new ActionToolbarImpl(ActionPlaces.TOOLBAR, group, true);
}
Aggregations