Search in sources :

Example 1 with MouseShortcut

use of com.intellij.openapi.actionSystem.MouseShortcut in project intellij-community by JetBrains.

the class EditorMultiCaretTest method doWithAltClickShortcut.

private static void doWithAltClickShortcut(ThrowableRunnable runnable) throws Throwable {
    Keymap keymap = KeymapManager.getInstance().getActiveKeymap();
    MouseShortcut shortcut = new MouseShortcut(1, InputEvent.ALT_DOWN_MASK, 1);
    try {
        keymap.addShortcut(IdeActions.ACTION_EDITOR_ADD_OR_REMOVE_CARET, shortcut);
        runnable.run();
    } finally {
        keymap.removeShortcut(IdeActions.ACTION_EDITOR_ADD_OR_REMOVE_CARET, shortcut);
    }
}
Also used : MouseShortcut(com.intellij.openapi.actionSystem.MouseShortcut) Keymap(com.intellij.openapi.keymap.Keymap)

Example 2 with MouseShortcut

use of com.intellij.openapi.actionSystem.MouseShortcut in project intellij-community by JetBrains.

the class KeymapTest method testRemoveMouseShortcut.

public void testRemoveMouseShortcut() throws Exception {
    myParent.clearOwnActionsIds();
    myChild.clearOwnActionsIds();
    MouseShortcut mouseShortcut = new MouseShortcut(1, InputEvent.BUTTON2_MASK, 1);
    myParent.addShortcut(ACTION_2, mouseShortcut);
    assertThat(myChild.getActionIds(mouseShortcut)).containsExactly(ACTION_2);
    myChild.removeShortcut(ACTION_2, mouseShortcut);
    assertThat(myChild.getActionIds(mouseShortcut)).isEmpty();
}
Also used : MouseShortcut(com.intellij.openapi.actionSystem.MouseShortcut)

Example 3 with MouseShortcut

use of com.intellij.openapi.actionSystem.MouseShortcut in project intellij-community by JetBrains.

the class MouseShortcutEqualityTest method testEqualMouseShortcutsAreEqual.

public void testEqualMouseShortcutsAreEqual() {
    assertEquals("Mouse shortcuts with equal data are equal", new MouseShortcut(MouseEvent.BUTTON1, 0, 1), new MouseShortcut(MouseEvent.BUTTON1, 0, 1));
    assertEquals("Mouse shortcuts with equal data are equal", new MouseShortcut(MouseEvent.BUTTON2, InputEvent.ALT_DOWN_MASK, 2), new MouseShortcut(MouseEvent.BUTTON2, InputEvent.ALT_DOWN_MASK, 2));
}
Also used : MouseShortcut(com.intellij.openapi.actionSystem.MouseShortcut)

Example 4 with MouseShortcut

use of com.intellij.openapi.actionSystem.MouseShortcut in project intellij-community by JetBrains.

the class MouseShortcutEqualityTest method testTheSameMouseShortcutIsEqual.

public void testTheSameMouseShortcutIsEqual() {
    MouseShortcut mouseShortcut = new MouseShortcut(MouseEvent.BUTTON1, 0, 1);
    assertEquals("The same MouseShortcut should be equals to itself", mouseShortcut, mouseShortcut);
    mouseShortcut = new MouseShortcut(MouseEvent.BUTTON2, 0, 1);
    assertEquals("The same MouseShortcut should be equals to itself", mouseShortcut, mouseShortcut);
    mouseShortcut = new MouseShortcut(MouseEvent.BUTTON1, InputEvent.ALT_DOWN_MASK, 1);
    assertEquals("The same MouseShortcut should be equals to itself", mouseShortcut, mouseShortcut);
    mouseShortcut = new MouseShortcut(MouseEvent.BUTTON1, InputEvent.CTRL_DOWN_MASK, 2);
    assertEquals("The same MouseShortcut should be equals to itself", mouseShortcut, mouseShortcut);
}
Also used : MouseShortcut(com.intellij.openapi.actionSystem.MouseShortcut)

Example 5 with MouseShortcut

use of com.intellij.openapi.actionSystem.MouseShortcut in project intellij-community by JetBrains.

the class MouseShortcutEqualityTest method testSubclassesOfMouseEventsAreNotEqualToMouseEvents.

public void testSubclassesOfMouseEventsAreNotEqualToMouseEvents() {
    MouseShortcut mouseShortcut = new MouseShortcut(MouseEvent.BUTTON2, InputEvent.ALT_DOWN_MASK, 2);
    PressureShortcut pressureShortcut = new PressureShortcut(1);
    assertFalse("MouseShortcut is not equal to PressureShortcut", mouseShortcut.equals(pressureShortcut));
    assertFalse("MouseShortcut is not equal to PressureShortcut", pressureShortcut.equals(mouseShortcut));
}
Also used : PressureShortcut(com.intellij.openapi.actionSystem.PressureShortcut) MouseShortcut(com.intellij.openapi.actionSystem.MouseShortcut)

Aggregations

MouseShortcut (com.intellij.openapi.actionSystem.MouseShortcut)5 PressureShortcut (com.intellij.openapi.actionSystem.PressureShortcut)1 Keymap (com.intellij.openapi.keymap.Keymap)1