use of com.intellij.ide.CommonActionsManager in project android by JetBrains.
the class ProjectProfileSelectionDialog method createTreePanel.
@NotNull
static JPanel createTreePanel(@NotNull CheckboxTreeView tree) {
JPanel treePanel = new JPanel(new BorderLayout());
DefaultActionGroup group = new DefaultActionGroup();
CommonActionsManager actions = CommonActionsManager.getInstance();
group.addAll(actions.createExpandAllAction(tree, treePanel), actions.createCollapseAllAction(tree, treePanel));
ActionToolbar actionToolBar = ActionManager.getInstance().createActionToolbar("AndroidProjectProfileSelection", group, true);
JPanel buttonsPanel = new JPanel(new BorderLayout());
buttonsPanel.add(actionToolBar.getComponent(), BorderLayout.CENTER);
buttonsPanel.setBorder(new SideBorder(JBColor.border(), SideBorder.TOP | SideBorder.LEFT | SideBorder.RIGHT, 1));
treePanel.add(buttonsPanel, BorderLayout.NORTH);
treePanel.add(ScrollPaneFactory.createScrollPane(tree), BorderLayout.CENTER);
return treePanel;
}
use of com.intellij.ide.CommonActionsManager in project android by JetBrains.
the class ToolWindowAlikePanel method createTreePanel.
@NotNull
public static ToolWindowAlikePanel createTreePanel(@NotNull String title, @NotNull JTree tree) {
ToolWindowAlikePanel panel = new ToolWindowAlikePanel(title, createScrollPane(tree));
Object root = tree.getModel().getRoot();
if (root instanceof TreeNode && ((TreeNode) root).getChildCount() > 0) {
TreeExpander expander = new DefaultTreeExpander(tree);
CommonActionsManager actions = CommonActionsManager.getInstance();
AnAction expandAllAction = actions.createExpandAllAction(expander, tree);
expandAllAction.getTemplatePresentation().setIcon(ExpandAll);
AnAction collapseAllAction = actions.createCollapseAllAction(expander, tree);
collapseAllAction.getTemplatePresentation().setIcon(CollapseAll);
panel.setAdditionalTitleActions(expandAllAction, collapseAllAction);
}
return panel;
}
use of com.intellij.ide.CommonActionsManager in project intellij-community by JetBrains.
the class SpecificFilesViewDialog method createPanel.
private void createPanel() {
myPanel = new JPanel(new BorderLayout());
final DefaultActionGroup group = new DefaultActionGroup();
final ActionToolbar actionToolbar = ActionManager.getInstance().createActionToolbar("SPECIFIC_FILES_DIALOG", group, true);
addCustomActions(group, actionToolbar);
final CommonActionsManager cam = CommonActionsManager.getInstance();
final Expander expander = new Expander();
group.addSeparator();
group.add(new ToggleShowFlattenAction());
group.add(cam.createExpandAllAction(expander, myView));
group.add(cam.createCollapseAllAction(expander, myView));
myPanel.add(actionToolbar.getComponent(), BorderLayout.NORTH);
myPanel.add(ScrollPaneFactory.createScrollPane(myView), BorderLayout.CENTER);
myView.setShowFlatten(false);
}
use of com.intellij.ide.CommonActionsManager in project intellij-community by JetBrains.
the class ChooseLibrariesDialogBase method createNorthPanel.
@Override
protected JComponent createNorthPanel() {
final DefaultActionGroup group = new DefaultActionGroup();
final TreeExpander expander = new DefaultTreeExpander(myTree);
final CommonActionsManager actionsManager = CommonActionsManager.getInstance();
group.add(actionsManager.createExpandAllAction(expander, myTree));
group.add(actionsManager.createCollapseAllAction(expander, myTree));
final JComponent component = ActionManager.getInstance().createActionToolbar(ActionPlaces.PROJECT_VIEW_TOOLBAR, group, true).getComponent();
component.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.darkGray), component.getBorder()));
return component;
}
use of com.intellij.ide.CommonActionsManager 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();
}
Aggregations