Example usage for com.intellij.openapi.actionSystem ActionPlaces GUI_DESIGNER_PROPERTY_INSPECTOR_POPUP

List of usage examples for com.intellij.openapi.actionSystem ActionPlaces GUI_DESIGNER_PROPERTY_INSPECTOR_POPUP

Introduction

In this page you can find the example usage for com.intellij.openapi.actionSystem ActionPlaces GUI_DESIGNER_PROPERTY_INSPECTOR_POPUP.

Prototype

String GUI_DESIGNER_PROPERTY_INSPECTOR_POPUP

To view the source code for com.intellij.openapi.actionSystem ActionPlaces 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;/* w  w w  .java  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());
}

From source file:org.cordovastudio.editors.designer.propertyTable.actions.ShowExpert.java

License:Apache License

@Override
public void update(AnActionEvent e) {
    super.update(e);

    Presentation presentation = e.getPresentation();
    if (ActionPlaces.GUI_DESIGNER_PROPERTY_INSPECTOR_POPUP.equals(e.getPlace())) {
        presentation.setIcon(null);//from   w  ww. j a  v a 2  s .  c om
    } else {
        presentation.setIcon(AllIcons.General.Filter);
    }
}

From source file:org.cordovastudio.editors.designer.propertyTable.actions.ShowExpert.java

License:Apache License

@Override
public void setSelected(AnActionEvent e, boolean state) {
    myTable.showExpert(state);/*from w ww.  java 2s.  c  o m*/
    if (ActionPlaces.GUI_DESIGNER_PROPERTY_INSPECTOR_POPUP.equals(e.getPlace())) {
        getTemplatePresentation().putClientProperty(SELECTED_PROPERTY, state);
    }
}

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   w w  w  . j a  va 2s .  c om
        }
    };

    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);
        }
    });
}