Example usage for org.eclipse.jface.bindings.keys KeySequenceText INFINITE

List of usage examples for org.eclipse.jface.bindings.keys KeySequenceText INFINITE

Introduction

In this page you can find the example usage for org.eclipse.jface.bindings.keys KeySequenceText INFINITE.

Prototype

int INFINITE

To view the source code for org.eclipse.jface.bindings.keys KeySequenceText INFINITE.

Click Source Link

Document

The special integer value for the maximum number of strokes indicating that an infinite number should be allowed.

Usage

From source file:org.eclipse.e4.ui.keybinding.tests.Bug42024Test.java

License:Open Source License

/**
 * Tests that the limiting facility on KeySequenceText allows an arbitrary
 * number of key strokes, when the the limit is set to "infinite". In this
 * case, we will use a six stroke sequence.
 * // w  w w  . j a  va  2 s.c o  m
 * @throws ParseException
 *             If the test sequence cannot be parsed.
 */
public void testInfiniteStrokes() throws ParseException {
    String keySequenceText = "A B C D E F"; //$NON-NLS-1$
    KeySequence keySequence = KeySequence.getInstance(keySequenceText);
    text.setKeyStrokeLimit(KeySequenceText.INFINITE);
    text.setKeySequence(keySequence);
    assertEquals("Infinite limit but sequence changed.", keySequence, text.getKeySequence()); //$NON-NLS-1$
}

From source file:org.eclipse.e4.ui.keybinding.tests.Bug42024Test.java

License:Open Source License

/**
 * Tests that a zero-length stroke can be inserted into the KeySequenceText --
 * regardless of whether the stroke limit is some positive integer or
 * infinite.//  w  ww .j a va  2  s .  c  om
 */
public void testZeroStroke() {
    KeySequence zeroStrokeSequence = KeySequence.getInstance();

    // Test with a limit of four.
    text.setKeyStrokeLimit(4);
    text.setKeySequence(zeroStrokeSequence);
    assertEquals("Limit of four changed zero stroke sequence.", zeroStrokeSequence, text.getKeySequence()); //$NON-NLS-1$

    // Test with an infinite limit.
    text.setKeyStrokeLimit(KeySequenceText.INFINITE);
    text.setKeySequence(zeroStrokeSequence);
    assertEquals("Infinite limit changed zero stroke sequence.", zeroStrokeSequence, text.getKeySequence()); //$NON-NLS-1$
}