use of com.intellij.ide.DefaultTreeExpander in project intellij-community by JetBrains.
the class RunDashboardContent method createToolbar.
private JComponent createToolbar() {
JPanel toolBarPanel = new JPanel(new GridLayout());
DefaultActionGroup leftGroup = new DefaultActionGroup();
leftGroup.add(ActionManager.getInstance().getAction(RUN_DASHBOARD_TOOLBAR));
// TODO [konstantin.aleev] provide context help ID
//leftGroup.add(new Separator());
//leftGroup.add(new ContextHelpAction(HELP_ID));
ActionToolbar leftActionToolBar = ActionManager.getInstance().createActionToolbar(PLACE_TOOLBAR, leftGroup, false);
toolBarPanel.add(leftActionToolBar.getComponent());
myTree.putClientProperty(DataManager.CLIENT_PROPERTY_DATA_PROVIDER, new DataProvider() {
@Override
public Object getData(@NonNls String dataId) {
if (KEY.getName().equals(dataId)) {
return RunDashboardContent.this;
}
return null;
}
});
leftActionToolBar.setTargetComponent(myTree);
DefaultActionGroup rightGroup = new DefaultActionGroup();
TreeExpander treeExpander = new DefaultTreeExpander(myTree);
AnAction expandAllAction = CommonActionsManager.getInstance().createExpandAllAction(treeExpander, this);
rightGroup.add(expandAllAction);
AnAction collapseAllAction = CommonActionsManager.getInstance().createCollapseAllAction(treeExpander, this);
rightGroup.add(collapseAllAction);
rightGroup.add(new Separator());
myGroupers.stream().filter(grouper -> !grouper.getRule().isAlwaysEnabled()).forEach(grouper -> rightGroup.add(new GroupAction(grouper)));
ActionToolbar rightActionToolBar = ActionManager.getInstance().createActionToolbar(PLACE_TOOLBAR, rightGroup, false);
toolBarPanel.add(rightActionToolBar.getComponent());
rightActionToolBar.setTargetComponent(myTree);
return toolBarPanel;
}
use of com.intellij.ide.DefaultTreeExpander in project intellij-community by JetBrains.
the class SourceItemsTree method createPopupGroup.
private ActionGroup createPopupGroup() {
final DefaultActionGroup group = new DefaultActionGroup();
group.add(new PutSourceItemIntoDefaultLocationAction(this, myArtifactsEditor));
group.add(new PackAndPutIntoDefaultLocationAction(this, myArtifactsEditor));
group.add(new PutSourceItemIntoParentAndLinkViaManifestAction(this, myArtifactsEditor));
group.add(new ExtractIntoDefaultLocationAction(this, myArtifactsEditor));
group.add(Separator.getInstance());
group.add(new SourceItemNavigateAction(this));
group.add(new SourceItemFindUsagesAction(this, myArtifactsEditor.getContext().getProject(), myArtifactsEditor.getContext().getParent()));
DefaultTreeExpander expander = new DefaultTreeExpander(this);
final CommonActionsManager commonActionsManager = CommonActionsManager.getInstance();
group.add(Separator.getInstance());
group.addAction(commonActionsManager.createExpandAllAction(expander, this));
group.addAction(commonActionsManager.createCollapseAllAction(expander, this));
return group;
}
use of com.intellij.ide.DefaultTreeExpander 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.DefaultTreeExpander in project intellij-community by JetBrains.
the class HierarchyBrowserBase method getData.
@Override
@Nullable
public Object getData(@NonNls final String dataId) {
if (CommonDataKeys.PSI_ELEMENT.is(dataId)) {
final PsiElement anElement = getSelectedElement();
return anElement != null && anElement.isValid() ? anElement : super.getData(dataId);
}
if (LangDataKeys.PSI_ELEMENT_ARRAY.is(dataId)) {
return getSelectedElements();
}
if (PlatformDataKeys.DELETE_ELEMENT_PROVIDER.is(dataId)) {
return null;
}
if (CommonDataKeys.NAVIGATABLE.is(dataId)) {
final DefaultMutableTreeNode selectedNode = getSelectedNode();
if (selectedNode == null)
return null;
final HierarchyNodeDescriptor descriptor = getDescriptor(selectedNode);
if (descriptor == null)
return null;
return getNavigatable(descriptor);
}
if (CommonDataKeys.NAVIGATABLE_ARRAY.is(dataId)) {
return getNavigatables();
}
if (PlatformDataKeys.TREE_EXPANDER.is(dataId)) {
final JTree tree = getCurrentTree();
if (tree != null) {
return new DefaultTreeExpander(tree);
}
}
return super.getData(dataId);
}
use of com.intellij.ide.DefaultTreeExpander 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;
}
Aggregations