net.rim.blackberry.api.stringpattern
Class PatternRepository

java.lang.Object
  |
  +--net.rim.blackberry.api.stringpattern.PatternRepository

public final class PatternRepository
extends Object

Use this class to register ApplicationMenuItems with a Perl-style regular expression or specific String. When a String matching the provided pattern is found, the provided ApplicationMenuItems will appear in the current application menu.

Since:
JDE 4.3.0

Field Summary
static int PATTERN_TYPE_EXACT_MATCH
          If this pattern type is used, the pattern will match a string if and only if it is an exact match
static int PATTERN_TYPE_REGULAR_EXPRESSION
          If this pattern type is used, the pattern will be treated as a Perl-style regular expression
 
Method Summary
static void addPattern(ApplicationDescriptor application, String pattern, int patternType, ApplicationMenuItem[] menuItems)
          Adds a pattern to the repository
static void removePatterns(ApplicationDescriptor application)
          Removes all patterns in the repository for the current application
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PATTERN_TYPE_EXACT_MATCH

public static final int PATTERN_TYPE_EXACT_MATCH
If this pattern type is used, the pattern will match a string if and only if it is an exact match
Since:
JDE 4.3.0

PATTERN_TYPE_REGULAR_EXPRESSION

public static final int PATTERN_TYPE_REGULAR_EXPRESSION
If this pattern type is used, the pattern will be treated as a Perl-style regular expression
Since:
JDE 4.3.0
Method Detail

addPattern

public static void addPattern(ApplicationDescriptor application,
                              String pattern,
                              int patternType,
                              ApplicationMenuItem[] menuItems)
Adds a pattern to the repository
Parameters:
application - An ApplicationDescriptor that describes the application registering the pattern
pattern - The pattern being registered
patternType - The type of pattern. Specify one of the PatternRepository.PATTERN_TYPE_ constants
menuItems - An array of ApplicationMenuItems to appear when the pattern appears in an ActiveTextField
Throws:
IllegalArgumentException - If pattern is null, zero-length or malformed; or if application is null or does not describe the application calling this method; or if menuItems is null, zero-length or contains objects that are null, or whose toString() methods throw exceptions or return null or return zero-length Strings.
Since:
JDE 4.3.0

removePatterns

public static void removePatterns(ApplicationDescriptor application)
Removes all patterns in the repository for the current application
Parameters:
application - ApplicationDescriptor describing the application calling this method
Throws:
IllegalArgumentException - If application does not describe the application calling this method or if application is null
Since:
JDE 4.3.0



Copyright 1999-2009 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.