Example usage for com.intellij.openapi.actionSystem DefaultActionGroup getChildren

List of usage examples for com.intellij.openapi.actionSystem DefaultActionGroup getChildren

Introduction

In this page you can find the example usage for com.intellij.openapi.actionSystem DefaultActionGroup getChildren.

Prototype

@Override
    public AnAction @NotNull [] getChildren(@Nullable AnActionEvent e) 

Source Link

Usage

From source file:com.android.tools.idea.startup.GradleSpecificInitializer.java

License:Apache License

private static void setUpWelcomeScreenActions() {
    // Force the new "flat" welcome screen.
    System.setProperty("ide.new.welcome.screen.force", "true");

    // Update the Welcome Screen actions
    replaceAction("WelcomeScreen.OpenProject",
            new AndroidOpenFileAction("Open an existing Android Studio project"));
    replaceAction("WelcomeScreen.CreateNewProject",
            new AndroidNewProjectAction("Start a new Android Studio project"));
    replaceAction("WelcomeScreen.ImportProject",
            new AndroidImportProjectAction("Import project (Eclipse ADT, Gradle, etc.)"));
    replaceAction("TemplateProjectStructure",
            new AndroidTemplateProjectStructureAction("Default Project Structure..."));

    moveAction("WelcomeScreen.ImportProject", "WelcomeScreen.QuickStart.IDEA", "WelcomeScreen.QuickStart",
            new Constraints(AFTER, "WelcomeScreen.GetFromVcs"));

    ActionManager actionManager = ActionManager.getInstance();
    AnAction getFromVcsAction = actionManager.getAction("WelcomeScreen.GetFromVcs");
    if (getFromVcsAction != null) {
        getFromVcsAction.getTemplatePresentation().setText("Check out project from Version Control");
    }//ww w .  ja  v a2  s  .c om

    AnAction configureIdeaAction = actionManager.getAction("WelcomeScreen.Configure.IDEA");
    if (configureIdeaAction instanceof DefaultActionGroup) {
        DefaultActionGroup settingsGroup = (DefaultActionGroup) configureIdeaAction;
        AnAction[] children = settingsGroup.getChildren(null);
        if (children.length == 1) {
            AnAction child = children[0];
            if (child instanceof TemplateProjectSettingsGroup) {
                settingsGroup.replaceAction(child, new AndroidTemplateProjectSettingsGroup());
            }
        }
    }
}

From source file:com.antoine.ideaplugin.greenrobot.ShowUsagesAction.java

License:Apache License

@NotNull
private JBPopup createUsagePopup(@NotNull final List<Usage> usages,
        @NotNull final UsageInfoToUsageConverter.TargetElementsDescriptor descriptor,
        @NotNull Set<UsageNode> visibleNodes, @NotNull final FindUsagesHandler handler, final Editor editor,
        @NotNull final RelativePoint popupPosition, final int maxUsages, @NotNull final UsageViewImpl usageView,
        @NotNull final FindUsagesOptions options, @NotNull final JTable table,
        @NotNull final UsageViewPresentation presentation, @NotNull final AsyncProcessIcon processIcon,
        boolean hadMoreSeparator) {
    table.setRowHeight(PlatformIcons.CLASS_ICON.getIconHeight() + 2);
    table.setShowGrid(false);//w w  w  .j a v  a2s .c  om
    table.setShowVerticalLines(false);
    table.setShowHorizontalLines(false);
    table.setTableHeader(null);
    table.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
    table.setIntercellSpacing(new Dimension(0, 0));

    PopupChooserBuilder builder = new PopupChooserBuilder(table);
    final String title = presentation.getTabText();
    if (title != null) {
        String result = getFullTitle(usages, title, hadMoreSeparator, visibleNodes.size() - 1, true);
        builder.setTitle(result);
        builder.setAdText(getSecondInvocationTitle(options, handler));
    }

    builder.setMovable(true).setResizable(true);
    builder.setItemChoosenCallback(new Runnable() {
        @Override
        public void run() {
            int[] selected = table.getSelectedRows();
            for (int i : selected) {
                Object value = table.getValueAt(i, 0);
                if (value instanceof UsageNode) {
                    Usage usage = ((UsageNode) value).getUsage();
                    if (usage == MORE_USAGES_SEPARATOR) {
                        appendMoreUsages(editor, popupPosition, handler, maxUsages);
                        return;
                    }
                    navigateAndHint(usage, null, handler, popupPosition, maxUsages, options);
                }
            }
        }
    });
    final JBPopup[] popup = new JBPopup[1];

    KeyboardShortcut shortcut = UsageViewImpl.getShowUsagesWithSettingsShortcut();
    if (shortcut != null) {
        new DumbAwareAction() {
            @Override
            public void actionPerformed(AnActionEvent e) {
                popup[0].cancel();
                showDialogAndFindUsages(handler, popupPosition, editor, maxUsages);
            }
        }.registerCustomShortcutSet(new CustomShortcutSet(shortcut.getFirstKeyStroke()), table);
    }
    shortcut = getShowUsagesShortcut();
    if (shortcut != null) {
        new DumbAwareAction() {
            @Override
            public void actionPerformed(AnActionEvent e) {
                popup[0].cancel();
                searchEverywhere(options, handler, editor, popupPosition, maxUsages);
            }
        }.registerCustomShortcutSet(new CustomShortcutSet(shortcut.getFirstKeyStroke()), table);
    }

    InplaceButton settingsButton = createSettingsButton(handler, popupPosition, editor, maxUsages,
            new Runnable() {
                @Override
                public void run() {
                    popup[0].cancel();
                }
            });

    ActiveComponent spinningProgress = new ActiveComponent() {
        @Override
        public void setActive(boolean active) {
        }

        @Override
        public JComponent getComponent() {
            return processIcon;
        }
    };
    builder.setCommandButton(new CompositeActiveComponent(spinningProgress, settingsButton));

    DefaultActionGroup toolbar = new DefaultActionGroup();
    usageView.addFilteringActions(toolbar);

    toolbar.add(UsageGroupingRuleProviderImpl.createGroupByFileStructureAction(usageView));
    toolbar.add(new AnAction("Open Find Usages Toolwindow", "Show all usages in a separate toolwindow",
            AllIcons.Toolwindows.ToolWindowFind) {
        {
            AnAction action = ActionManager.getInstance().getAction(IdeActions.ACTION_FIND_USAGES);
            setShortcutSet(action.getShortcutSet());
        }

        @Override
        public void actionPerformed(AnActionEvent e) {
            hideHints();
            popup[0].cancel();
            FindUsagesManager findUsagesManager = ((FindManagerImpl) FindManager
                    .getInstance(usageView.getProject())).getFindUsagesManager();

            findUsagesManager.findUsages(handler.getPrimaryElements(), handler.getSecondaryElements(), handler,
                    options, FindSettings.getInstance().isSkipResultsWithOneUsage());
        }
    });

    ActionToolbar actionToolbar = ActionManager.getInstance()
            .createActionToolbar(ActionPlaces.USAGE_VIEW_TOOLBAR, toolbar, true);
    actionToolbar.setReservePlaceAutoPopupIcon(false);
    final JComponent toolBar = actionToolbar.getComponent();
    toolBar.setOpaque(false);
    builder.setSettingButton(toolBar);

    popup[0] = builder.createPopup();
    JComponent content = popup[0].getContent();

    myWidth = (int) (toolBar.getPreferredSize().getWidth()
            + new JLabel(getFullTitle(usages, title, hadMoreSeparator, visibleNodes.size() - 1, true))
                    .getPreferredSize().getWidth()
            + settingsButton.getPreferredSize().getWidth());
    myWidth = -1;
    for (AnAction action : toolbar.getChildren(null)) {
        action.unregisterCustomShortcutSet(usageView.getComponent());
        action.registerCustomShortcutSet(action.getShortcutSet(), content);
    }

    return popup[0];
}

From source file:com.intellij.execution.ui.layout.impl.RunnerContentUi.java

License:Apache License

private boolean rebuildCommonActions() {
    boolean hasToolbarContent = false;
    for (Map.Entry<GridImpl, Wrapper> entry : myCommonActionsPlaceholder.entrySet()) {
        Wrapper eachPlaceholder = entry.getValue();
        List<Content> contentList = entry.getKey().getContents();

        Set<Content> contents = new HashSet<Content>();
        contents.addAll(contentList);//from   w  w w .  j  av a 2 s.c o  m

        DefaultActionGroup groupToBuild;
        JComponent contextComponent = null;
        if (isHorizontalToolbar() && contents.size() == 1) {
            Content content = contentList.get(0);
            groupToBuild = new DefaultActionGroup();
            if (content.getActions() != null) {
                groupToBuild.addAll(content.getActions());
                groupToBuild.addSeparator();
                contextComponent = content.getActionsContextComponent();
            }
            groupToBuild.addAll(myTopActions);
        } else {
            final DefaultActionGroup group = new DefaultActionGroup();
            group.addAll(myTopActions);
            groupToBuild = group;
        }

        final AnAction[] actions = groupToBuild.getChildren(null);
        if (!Arrays.equals(actions, myContextActions.get(entry.getKey()))) {
            ActionToolbar tb = myActionManager.createActionToolbar(myActionsPlace, groupToBuild, true);
            tb.getComponent().setBorder(null);
            tb.setTargetComponent(contextComponent);
            eachPlaceholder.setContent(tb.getComponent());
        }

        if (groupToBuild.getChildrenCount() > 0) {
            hasToolbarContent = true;
        }

        myContextActions.put(entry.getKey(), actions);
    }

    return hasToolbarContent;
}

From source file:com.intellij.find.actions.ShowUsagesAction.java

License:Apache License

@NotNull
private JBPopup createUsagePopup(@NotNull final List<Usage> usages, @NotNull Set<UsageNode> visibleNodes,
        @NotNull final FindUsagesHandler handler, final Editor editor,
        @NotNull final RelativePoint popupPosition, final int maxUsages, @NotNull final UsageViewImpl usageView,
        @NotNull final FindUsagesOptions options, @NotNull final JTable table,
        @NotNull final Runnable itemChoseCallback, @NotNull final UsageViewPresentation presentation,
        @NotNull final AsyncProcessIcon processIcon) {

    PopupChooserBuilder builder = new PopupChooserBuilder(table);
    final String title = presentation.getTabText();
    if (title != null) {
        String result = getFullTitle(usages, title, false, visibleNodes.size() - 1, true);
        builder.setTitle(result);/*from  w  w w . j a v  a  2  s  .c  o m*/
        builder.setAdText(getSecondInvocationTitle(options, handler));
    }

    builder.setMovable(true).setResizable(true);
    builder.setMovable(true).setResizable(true);
    builder.setItemChoosenCallback(itemChoseCallback);
    final JBPopup[] popup = new JBPopup[1];

    KeyboardShortcut shortcut = UsageViewImpl.getShowUsagesWithSettingsShortcut();
    if (shortcut != null) {
        new DumbAwareAction() {
            @Override
            public void actionPerformed(@NotNull AnActionEvent e) {
                cancel(popup);
                showDialogAndFindUsages(handler, popupPosition, editor, maxUsages);
            }
        }.registerCustomShortcutSet(new CustomShortcutSet(shortcut.getFirstKeyStroke()), table);
    }
    shortcut = getShowUsagesShortcut();
    if (shortcut != null) {
        new DumbAwareAction() {
            @Override
            public void actionPerformed(@NotNull AnActionEvent e) {
                cancel(popup);
                searchEverywhere(options, handler, editor, popupPosition, maxUsages);
            }
        }.registerCustomShortcutSet(new CustomShortcutSet(shortcut.getFirstKeyStroke()), table);
    }

    InplaceButton settingsButton = createSettingsButton(handler, popupPosition, editor, maxUsages,
            new Runnable() {
                @Override
                public void run() {
                    cancel(popup);
                }
            });

    ActiveComponent spinningProgress = new ActiveComponent() {
        @Override
        public void setActive(boolean active) {
        }

        @Override
        public JComponent getComponent() {
            return processIcon;
        }
    };
    final DefaultActionGroup pinGroup = new DefaultActionGroup();
    final ActiveComponent pin = createPinButton(handler, usageView, options, popup, pinGroup);
    builder.setCommandButton(new CompositeActiveComponent(spinningProgress, settingsButton, pin));

    DefaultActionGroup toolbar = new DefaultActionGroup();
    usageView.addFilteringActions(toolbar);

    toolbar.add(UsageGroupingRuleProviderImpl.createGroupByFileStructureAction(usageView));
    ActionToolbar actionToolbar = ActionManager.getInstance()
            .createActionToolbar(ActionPlaces.USAGE_VIEW_TOOLBAR, toolbar, true);
    actionToolbar.setReservePlaceAutoPopupIcon(false);
    final JComponent toolBar = actionToolbar.getComponent();
    toolBar.setOpaque(false);
    builder.setSettingButton(toolBar);

    popup[0] = builder.createPopup();
    JComponent content = popup[0].getContent();

    myWidth = (int) (toolBar.getPreferredSize().getWidth()
            + new JLabel(getFullTitle(usages, title, false, visibleNodes.size() - 1, true)).getPreferredSize()
                    .getWidth()
            + settingsButton.getPreferredSize().getWidth());
    myWidth = -1;
    for (AnAction action : toolbar.getChildren(null)) {
        action.unregisterCustomShortcutSet(usageView.getComponent());
        action.registerCustomShortcutSet(action.getShortcutSet(), content);
    }

    for (AnAction action : pinGroup.getChildren(null)) {
        action.unregisterCustomShortcutSet(usageView.getComponent());
        action.registerCustomShortcutSet(action.getShortcutSet(), content);
    }

    return popup[0];
}

From source file:com.smardec.ideaplugin.ideamousegestures.ActionHelper.java

License:Open Source License

private static Node[] convert(Node parent, AnAction action, List<Node> actionNodes) {
    if (action instanceof Separator)
        return new Node[] { new Node(NodeType.SEPARATOR, parent, null, null, null) };
    if (action instanceof DefaultActionGroup) {
        DefaultActionGroup defaultActionGroup = (DefaultActionGroup) action;
        Presentation presentation = defaultActionGroup.getTemplatePresentation();
        String text = presentation.getText();
        if (text == null) {
            List<Node> childrenNodes = new LinkedList<Node>();
            AnAction[] childrenActions = defaultActionGroup.getChildren(null);
            for (AnAction childAction : childrenActions) {
                childrenNodes.addAll(Arrays.asList(convert(parent, childAction, actionNodes)));
            }/*w w w  .  j  a v a  2s.  co  m*/
            return childrenNodes.toArray(new Node[childrenNodes.size()]);
        } else {
            Node groupActionNode = new Node(NodeType.GROUP, parent, text, GROUP_ICON, null);
            List<Node> childrenNodes = new LinkedList<Node>();
            AnAction[] childrenActions = defaultActionGroup.getChildren(null);
            for (AnAction childAction : childrenActions) {
                childrenNodes.addAll(Arrays.asList(convert(groupActionNode, childAction, actionNodes)));
            }
            groupActionNode.children = childrenNodes.toArray(new Node[childrenNodes.size()]);
            return new Node[] { groupActionNode };
        }
    } else {
        if (action == null)
            return EMPTY_NODE_ARRAY;
        Presentation presentation = action.getTemplatePresentation();
        if (presentation == null)
            return EMPTY_NODE_ARRAY;
        String text = presentation.getText();
        if (text == null)
            return EMPTY_NODE_ARRAY;
        Node actionNode = new Node(NodeType.SIMPLE, parent, text, presentation.getIcon(), action);
        actionNodes.add(actionNode);
        return new Node[] { actionNode };
    }
}

From source file:com.squareup.ideaplugin.dagger.ShowUsagesAction.java

License:Apache License

@NotNull
private JBPopup createUsagePopup(@NotNull final List<Usage> usages,
        @NotNull final UsageInfoToUsageConverter.TargetElementsDescriptor descriptor,
        @NotNull Set<UsageNode> visibleNodes, @NotNull final FindUsagesHandler handler, final Editor editor,
        @NotNull final RelativePoint popupPosition, final int maxUsages, @NotNull final UsageViewImpl usageView,
        @NotNull final FindUsagesOptions options, @NotNull final JTable table,
        @NotNull final UsageViewPresentation presentation, @NotNull final AsyncProcessIcon processIcon,
        boolean hadMoreSeparator) {
    table.setRowHeight(PlatformIcons.CLASS_ICON.getIconHeight() + 2);
    table.setShowGrid(false);//from  w w w.ja va  2  s  . c  o  m
    table.setShowVerticalLines(false);
    table.setShowHorizontalLines(false);
    table.setTableHeader(null);
    table.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
    table.setIntercellSpacing(new Dimension(0, 0));

    PopupChooserBuilder builder = new PopupChooserBuilder(table);
    final String title = presentation.getTabText();
    if (title != null) {
        String result = getFullTitle(usages, title, hadMoreSeparator, visibleNodes.size() - 1, true);
        builder.setTitle(result);
        builder.setAdText(getSecondInvocationTitle(options, handler));
    }

    builder.setMovable(true).setResizable(true);
    builder.setItemChoosenCallback(new Runnable() {
        @Override
        public void run() {
            int[] selected = table.getSelectedRows();
            for (int i : selected) {
                Object value = table.getValueAt(i, 0);
                if (value instanceof UsageNode) {
                    Usage usage = ((UsageNode) value).getUsage();
                    if (usage == MORE_USAGES_SEPARATOR) {
                        appendMoreUsages(editor, popupPosition, handler, maxUsages);
                        return;
                    }
                    navigateAndHint(usage, null, handler, popupPosition, maxUsages, options);
                }
            }
        }
    });
    final JBPopup[] popup = new JBPopup[1];

    KeyboardShortcut shortcut = UsageViewImpl.getShowUsagesWithSettingsShortcut();
    if (shortcut != null) {
        new DumbAwareAction() {
            @Override
            public void actionPerformed(AnActionEvent e) {
                popup[0].cancel();
                showDialogAndFindUsages(handler, popupPosition, editor, maxUsages);
            }
        }.registerCustomShortcutSet(new CustomShortcutSet(shortcut.getFirstKeyStroke()), table);
    }
    shortcut = getShowUsagesShortcut();
    if (shortcut != null) {
        new DumbAwareAction() {
            @Override
            public void actionPerformed(AnActionEvent e) {
                popup[0].cancel();
                searchEverywhere(options, handler, editor, popupPosition, maxUsages);
            }
        }.registerCustomShortcutSet(new CustomShortcutSet(shortcut.getFirstKeyStroke()), table);
    }

    InplaceButton settingsButton = createSettingsButton(handler, popupPosition, editor, maxUsages,
            new Runnable() {
                @Override
                public void run() {
                    popup[0].cancel();
                }
            });

    ActiveComponent spinningProgress = new ActiveComponent() {
        @Override
        public void setActive(boolean active) {
        }

        @Override
        public JComponent getComponent() {
            return processIcon;
        }
    };
    builder.setCommandButton(new CompositeActiveComponent(spinningProgress, settingsButton));

    DefaultActionGroup toolbar = new DefaultActionGroup();
    usageView.addFilteringActions(toolbar);

    toolbar.add(UsageGroupingRuleProviderImpl.createGroupByFileStructureAction(usageView));
    toolbar.add(new AnAction("Open Find Usages Toolwindow", "Show all usages in a separate toolwindow",
            AllIcons.Toolwindows.ToolWindowFind) {
        {
            AnAction action = ActionManager.getInstance().getAction(IdeActions.ACTION_FIND_USAGES);
            setShortcutSet(action.getShortcutSet());
        }

        @Override
        public void actionPerformed(AnActionEvent e) {
            hideHints();
            popup[0].cancel();
            FindUsagesManager findUsagesManager = ((FindManagerImpl) FindManager
                    .getInstance(usageView.getProject())).getFindUsagesManager();
            findUsagesManager.findUsages(handler.getPrimaryElements(), handler.getSecondaryElements(), handler,
                    options, true);
        }
    });

    ActionToolbar actionToolbar = ActionManager.getInstance()
            .createActionToolbar(ActionPlaces.USAGE_VIEW_TOOLBAR, toolbar, true);
    actionToolbar.setReservePlaceAutoPopupIcon(false);
    final JComponent toolBar = actionToolbar.getComponent();
    toolBar.setOpaque(false);
    builder.setSettingButton(toolBar);

    popup[0] = builder.createPopup();
    JComponent content = popup[0].getContent();

    myWidth = (int) (toolBar.getPreferredSize().getWidth()
            + new JLabel(getFullTitle(usages, title, hadMoreSeparator, visibleNodes.size() - 1, true))
                    .getPreferredSize().getWidth()
            + settingsButton.getPreferredSize().getWidth());
    myWidth = -1;
    for (AnAction action : toolbar.getChildren(null)) {
        action.unregisterCustomShortcutSet(usageView.getComponent());
        action.registerCustomShortcutSet(action.getShortcutSet(), content);
    }

    return popup[0];
}

From source file:generate.tostring.psi.PsiAdapter.java

License:Apache License

/**
 * Removes the action from the menu./*  w  ww.  ja  v a  2s . c o m*/
 * <p/>
 * The group must be of a DefaultActionGroup instance, if not this method returns false.
 *
 * @param actionId group id of the action to remove.
 * @param menuId   id of the menu that contains the action. See ActionManager.xml in the IDEA openapi folder.
 * @return true if the action was remove, false if not (action could not be found)
 */
public boolean removeActionFromMenu(String actionId, String menuId) {
    ActionManager am = ActionManager.getInstance();
    AnAction group = am.getAction(menuId);

    // must be default action group
    if (group instanceof DefaultActionGroup) {
        DefaultActionGroup defGroup = (DefaultActionGroup) group;

        // loop children (actions) and remove the matching id
        AnAction[] actions = defGroup.getChildren(null);
        for (AnAction action : actions) {
            String id = am.getId(action);

            // if match id then remove action from menu
            if (actionId.equals(id)) {
                defGroup.remove(action);
                return true;
            }

        }

    }

    // action to remove not found
    return false;
}

From source file:generate.tostring.psi.PsiAdapter.java

License:Apache License

/**
 * Adds the action to the menu./*w  w w  .  j  a v a2  s .com*/
 * <p/>
 * The group must be of a DefaultActionGroup instance, if not this method returns false.
 *
 * @param actionId    group id of the action to add.
 * @param menuId      id of the menu the action should be added to. See ActionManager.xml in the IDEA openapi folder.
 * @param anchorId    id of the action to position relative to.  See ActionManager.xml in the IDEA openapi folder.
 * @param afterAnchor true if the action should be added after the anchorId, false if before.
 * @return true if the action was added, false if not.
 */
public boolean addActionToMenu(String actionId, String menuId, String anchorId, boolean afterAnchor) {
    ActionManager am = ActionManager.getInstance();
    AnAction group = am.getAction(menuId);

    // must be default action group
    if (group instanceof DefaultActionGroup) {
        DefaultActionGroup defGroup = (DefaultActionGroup) group;

        // loop children (actions) and remove the matching id
        AnAction[] actions = defGroup.getChildren(null);
        for (AnAction action : actions) {
            String id = am.getId(action);

            // if match id then add action to menu
            if (anchorId.equals(id)) {
                AnAction actionToAdd = am.getAction(actionId); // find the action to add
                defGroup.add(actionToAdd,
                        new Constraints(afterAnchor ? Anchor.AFTER : Anchor.BEFORE, anchorId));
                return true;
            }

        }

    }

    // action to add next to not found
    return false;
}

From source file:org.cordovastudio.editors.designer.actions.DesignerActionPanel.java

License:Apache License

private static boolean isVisible(DefaultActionGroup group) {
    if (group.getChildrenCount() == 0) {
        return false;
    }/* w  w w . jav a2s .c  o m*/

    for (AnAction action : group.getChildren(null)) {
        if (action instanceof DefaultActionGroup) {
            if (isVisible((DefaultActionGroup) action)) {
                return true;
            }
        } else {
            return true;
        }
    }
    return false;
}

From source file:org.cordovastudio.editors.designer.propertyTable.PropertyTablePanel.java

License:Apache License

public PropertyTablePanel(final Project project) {
    myPropertyTable = new RadPropertyTable(project) {
        protected void updateEditActions() {
            updateActions();/*from   www .  jav  a  2  s .c  o  m*/
        }
    };

    setLayout(new GridBagLayout());

    int gridX = 0;

    myTitleLabel = new JLabel(CordovaDesignerBundle.message("designer.properties.title"));
    myTitleLabel.setFont(UIUtil.getLabelFont(UIUtil.FontSize.SMALL));
    add(myTitleLabel, new GridBagConstraints(gridX++, 0, 1, 1, 0, 0, GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL, new Insets(2, 5, 2, 10), 0, 0));

    ActionManager actionManager = ActionManager.getInstance();
    DefaultActionGroup actionGroup = new DefaultActionGroup();

    //TODO: remove JavaDoc as it's not needed for Cordova projects!
    ShowJavadoc showJavadoc = new ShowJavadoc(myPropertyTable);
    showJavadoc.registerCustomShortcutSet(
            actionManager.getAction(IdeActions.ACTION_QUICK_JAVADOC).getShortcutSet(), myPropertyTable);
    actionGroup.add(showJavadoc);

    actionGroup.addSeparator();

    RestoreDefault restoreDefault = new RestoreDefault(myPropertyTable);
    // Don't register ACTION_DELETE on Mac; on Mac, the default delete key is VK_DELETE rather than VK_BACK_SPACE
    // which means users end up accidentally restoring to default when trying to edit inside property editors.
    if (!SystemInfo.isMac) {
        restoreDefault.registerCustomShortcutSet(
                actionManager.getAction(IdeActions.ACTION_DELETE).getShortcutSet(), myPropertyTable);
    }
    actionGroup.add(restoreDefault);

    actionGroup.add(new ShowExpert(myPropertyTable));

    myTabPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 5, 0));
    add(myTabPanel, new GridBagConstraints(gridX++, 0, 1, 1, 1, 0, GridBagConstraints.LINE_START,
            GridBagConstraints.NONE, new Insets(2, 0, 2, 0), 0, 0));

    myActionPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 5, 0));
    add(myActionPanel, new GridBagConstraints(gridX++, 0, 1, 1, 0, 0, GridBagConstraints.CENTER,
            GridBagConstraints.NONE, new Insets(2, 0, 2, 2), 0, 0));

    myActions = actionGroup.getChildren(null);
    for (AnAction action : myActions) {
        if (action instanceof Separator) {
            continue;
        }

        Presentation presentation = action.getTemplatePresentation();
        ActionButton button = new ActionButton(action, presentation, ActionPlaces.UNKNOWN,
                ActionToolbar.DEFAULT_MINIMUM_BUTTON_SIZE);
        myActionPanel.add(button);
        presentation.putClientProperty(BUTTON_KEY, button);
    }

    actionGroup.add(new ShowColumns(myPropertyTable));

    PopupHandler.installPopupHandler(myPropertyTable, actionGroup,
            ActionPlaces.GUI_DESIGNER_PROPERTY_INSPECTOR_POPUP, actionManager);

    myPropertyTable.getSelectionModel().addListSelectionListener(this);
    valueChanged(null);

    JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myPropertyTable);
    scrollPane.setBorder(IdeBorderFactory.createBorder(SideBorder.TOP));
    myPropertyTable.initQuickFixManager(scrollPane.getViewport());
    add(scrollPane, new GridBagConstraints(0, 1, gridX, 1, 1, 1, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));

    myPropertyTable.setPropertyTablePanel(this);

    addMouseListener(new MouseAdapter() {
        public void mouseReleased(final MouseEvent e) {
            IdeFocusManager.getInstance(project).requestFocus(myPropertyTable, true);
        }
    });
}