Example usage for com.intellij.openapi.actionSystem IdeActions GROUP_GUI_DESIGNER_COMPONENT_TREE_POPUP

List of usage examples for com.intellij.openapi.actionSystem IdeActions GROUP_GUI_DESIGNER_COMPONENT_TREE_POPUP

Introduction

In this page you can find the example usage for com.intellij.openapi.actionSystem IdeActions GROUP_GUI_DESIGNER_COMPONENT_TREE_POPUP.

Prototype

String GROUP_GUI_DESIGNER_COMPONENT_TREE_POPUP

To view the source code for com.intellij.openapi.actionSystem IdeActions GROUP_GUI_DESIGNER_COMPONENT_TREE_POPUP.

Click Source Link

Usage

From source file:com.intellij.uiDesigner.componentTree.ComponentTree.java

License:Apache License

public ComponentTree(@NotNull final Project project) {
    super(new DefaultTreeModel(new DefaultMutableTreeNode()));
    myProject = project;// w  ww .ja  v  a 2 s  .c om

    setCellRenderer(new MyTreeCellRenderer());
    setRootVisible(false);
    setShowsRootHandles(true);

    // Enable tooltips
    ToolTipManager.sharedInstance().registerComponent(this);

    // Install convenient keyboard navigation
    TreeUtil.installActions(this);

    // Popup menu
    PopupHandler.installPopupHandler(this,
            (ActionGroup) ActionManager.getInstance()
                    .getAction(IdeActions.GROUP_GUI_DESIGNER_COMPONENT_TREE_POPUP),
            ActionPlaces.GUI_DESIGNER_COMPONENT_TREE_POPUP, ActionManager.getInstance());

    // F2 should start inplace editing
    myStartInplaceEditingAction = new StartInplaceEditingAction(null);
    myStartInplaceEditingAction
            .registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0)), this);

    if (!ApplicationManager.getApplication().isHeadlessEnvironment()) {
        setDragEnabled(true);
        setTransferHandler(new TransferHandler() {
            public int getSourceActions(JComponent c) {
                return DnDConstants.ACTION_COPY_OR_MOVE;
            }

            protected Transferable createTransferable(JComponent c) {
                return DraggedComponentList.pickupSelection(myEditor, null);
            }
        });
        setDropTarget(new DropTarget(this, new MyDropTargetListener()));
    }
}