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

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

Introduction

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

Prototype

String GROUP_GUI_DESIGNER_PROPERTY_INSPECTOR_POPUP

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

Click Source Link

Usage

From source file:com.intellij.uiDesigner.propertyInspector.PropertyInspectorTable.java

License:Apache License

PropertyInspectorTable(Project project, @NotNull final ComponentTree componentTree) {
    myProject = project;/* www.ja  v a  2 s . c  o m*/
    myClassToBindProperty = new ClassToBindProperty(project);
    myBindingProperty = new BindingProperty(project);
    myBorderProperty = new BorderProperty(project);

    myPropertyEditorListener = new MyPropertyEditorListener();
    myLafManagerListener = new MyLafManagerListener();
    myComponentTree = componentTree;
    myProperties = new ArrayList<Property>();
    myExpandedProperties = new HashSet<String>();
    myModel = new MyModel();
    setModel(myModel);
    setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    myCellRenderer = new MyCompositeTableCellRenderer();
    myCellEditor = new MyCellEditor();

    addMouseListener(new MouseAdapter() {
        @Override
        public void mousePressed(final MouseEvent e) {
            final int row = rowAtPoint(e.getPoint());
            if (row == -1) {
                return;
            }
            final Property property = myProperties.get(row);
            int indent = getPropertyIndent(property) * 11;
            final Rectangle rect = getCellRect(row, convertColumnIndexToView(0), false);
            if (e.getX() < rect.x + indent || e.getX() > rect.x + 9 + indent || e.getY() < rect.y
                    || e.getY() > rect.y + rect.height) {
                return;
            }

            final Property[] children = getPropChildren(property);
            if (children.length == 0) {
                return;
            }

            if (isPropertyExpanded(property, property.getParent())) {
                collapseProperty(row);
            } else {
                expandProperty(row);
            }
        }
    });

    new DoubleClickListener() {
        @Override
        protected boolean onDoubleClick(MouseEvent e) {
            int row = rowAtPoint(e.getPoint());
            int column = columnAtPoint(e.getPoint());
            if (row >= 0 && column == 0) {
                final Property property = myProperties.get(row);
                if (getPropChildren(property).length == 0) {
                    startEditing(row);
                    return true;
                }
            }
            return false;
        }
    }.installOn(this);

    final AnAction quickJavadocAction = ActionManager.getInstance().getAction(IdeActions.ACTION_QUICK_JAVADOC);
    new ShowJavadocAction().registerCustomShortcutSet(quickJavadocAction.getShortcutSet(), this);

    // Popup menu
    PopupHandler.installPopupHandler(this,
            (ActionGroup) ActionManager.getInstance()
                    .getAction(IdeActions.GROUP_GUI_DESIGNER_PROPERTY_INSPECTOR_POPUP),
            ActionPlaces.GUI_DESIGNER_PROPERTY_INSPECTOR_POPUP, ActionManager.getInstance());
}