Search in sources :

Example 1 with CustomActionsSchema

use of com.intellij.ide.ui.customization.CustomActionsSchema in project intellij-community by JetBrains.

the class PyCharmEduInitialConfigurator method patchMainMenu.

private static void patchMainMenu() {
    final CustomActionsSchema schema = new CustomActionsSchema();
    final JTree actionsTree = new Tree();
    Group rootGroup = new Group("root", null, null);
    final DefaultMutableTreeNode root = new DefaultMutableTreeNode(rootGroup);
    DefaultTreeModel model = new DefaultTreeModel(root);
    actionsTree.setModel(model);
    schema.fillActionGroups(root);
    for (int i = 0; i < root.getChildCount(); i++) {
        final DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) root.getChildAt(i);
        if ("Main menu".equals(getItemId(treeNode))) {
            hideActionFromMainMenu(root, schema, treeNode);
        }
        hideActions(schema, root, treeNode, HIDDEN_ACTIONS);
    }
    CustomActionsSchema.getInstance().copyFrom(schema);
}
Also used : DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) Group(com.intellij.openapi.keymap.impl.ui.Group) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) CustomActionsSchema(com.intellij.ide.ui.customization.CustomActionsSchema) Tree(com.intellij.ui.treeStructure.Tree) DefaultTreeModel(javax.swing.tree.DefaultTreeModel) ExtensionPoint(com.intellij.openapi.extensions.ExtensionPoint)

Aggregations

CustomActionsSchema (com.intellij.ide.ui.customization.CustomActionsSchema)1 DefaultActionGroup (com.intellij.openapi.actionSystem.DefaultActionGroup)1 ExtensionPoint (com.intellij.openapi.extensions.ExtensionPoint)1 Group (com.intellij.openapi.keymap.impl.ui.Group)1 Tree (com.intellij.ui.treeStructure.Tree)1 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)1 DefaultTreeModel (javax.swing.tree.DefaultTreeModel)1