Search in sources :

Example 1 with IpnbMergeCellBelowAction

use of org.jetbrains.plugins.ipnb.editor.actions.IpnbMergeCellBelowAction in project intellij-community by JetBrains.

the class IpnbEditablePanel method addRightClickMenu.

@Override
protected void addRightClickMenu() {
    myViewPanel.addMouseListener(new MouseAdapter() {

        @Override
        public void mousePressed(MouseEvent e) {
            if (SwingUtilities.isRightMouseButton(e) && e.getClickCount() == 1) {
                final DefaultActionGroup group = new DefaultActionGroup(new IpnbMergeCellAboveAction(), new IpnbMergeCellBelowAction());
                final ListPopup menu = createPopupMenu(group);
                menu.show(RelativePoint.fromScreen(e.getLocationOnScreen()));
            }
        }
    });
    myEditableTextArea.addMouseListener(new MouseAdapter() {

        @Override
        public void mousePressed(MouseEvent e) {
            if (SwingUtilities.isRightMouseButton(e) && e.getClickCount() == 1) {
                final DefaultActionGroup group = new DefaultActionGroup(new IpnbSplitCellAction());
                final ListPopup menu = createPopupMenu(group);
                menu.show(RelativePoint.fromScreen(e.getLocationOnScreen()));
            }
        }
    });
}
Also used : MouseEvent(java.awt.event.MouseEvent) IpnbMergeCellBelowAction(org.jetbrains.plugins.ipnb.editor.actions.IpnbMergeCellBelowAction) MouseAdapter(java.awt.event.MouseAdapter) ListPopup(com.intellij.openapi.ui.popup.ListPopup) IpnbMergeCellAboveAction(org.jetbrains.plugins.ipnb.editor.actions.IpnbMergeCellAboveAction) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) IpnbSplitCellAction(org.jetbrains.plugins.ipnb.editor.actions.IpnbSplitCellAction)

Aggregations

DefaultActionGroup (com.intellij.openapi.actionSystem.DefaultActionGroup)1 ListPopup (com.intellij.openapi.ui.popup.ListPopup)1 MouseAdapter (java.awt.event.MouseAdapter)1 MouseEvent (java.awt.event.MouseEvent)1 IpnbMergeCellAboveAction (org.jetbrains.plugins.ipnb.editor.actions.IpnbMergeCellAboveAction)1 IpnbMergeCellBelowAction (org.jetbrains.plugins.ipnb.editor.actions.IpnbMergeCellBelowAction)1 IpnbSplitCellAction (org.jetbrains.plugins.ipnb.editor.actions.IpnbSplitCellAction)1