Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 1887b0876fb326b362791fe57547a2235a72d4bc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/*******************************************************************************
 * Copyright (c) 2010, 2011 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 ******************************************************************************/
package org.eclipse.equinox.bidi;

import org.eclipse.equinox.bidi.custom.STextProcessor;
import org.eclipse.equinox.bidi.internal.STextTypesCollector;

/**
 * This class provides access to registered structured text processors.
 * 
 * @noinstantiate This class is not intended to be instantiated by clients.
 */
final public class STextProcessorFactory {

	/**
	 * Structured text processor for property file statements. It expects the following format:
	 * <pre>
	 *  name=value
	 * </pre>
	 */
	public static final String PROPERTY = "property"; //$NON-NLS-1$

	/**
	 * Structured text processor for compound names. It expects text to be made of one or more 
	 * parts separated by underscores:
	 * <pre>
	 *  part1_part2_part3
	 * </pre>
	 */
	public static final String UNDERSCORE = "underscore"; //$NON-NLS-1$

	/**
	 * Structured text processor for comma-delimited lists, such as:
	 * <pre>
	 *  part1,part2,part3
	 * </pre>
	 */
	public static final String COMMA_DELIMITED = "comma"; //$NON-NLS-1$

	/**
	 * Structured text processor for strings with the following format:
	 * <pre>
	 *  system(user)
	 * </pre>
	 */
	public static final String SYSTEM_USER = "system"; //$NON-NLS-1$

	/**
	 * Structured text processor for directory and file paths.
	 */
	public static final String FILE = "file"; //$NON-NLS-1$

	/**
	 * Structured text processor for e-mail addresses.
	 */
	public static final String EMAIL = "email"; //$NON-NLS-1$

	/**
	 * Structured text processor for URLs.
	 */
	public static final String URL = "url"; //$NON-NLS-1$

	/**
	 * Structured text processor for regular expressions, possibly spanning multiple lines.
	 */
	public static final String REGEXP = "regex"; //$NON-NLS-1$

	/**
	 * Structured text processor for XPath expressions.
	 */
	public static final String XPATH = "xpath"; //$NON-NLS-1$

	/**
	 * Structured text processor for Java code, possibly spanning multiple lines.
	 */
	public static final String JAVA = "java"; //$NON-NLS-1$

	/**
	 * Structured text processor for SQL statements, possibly spanning multiple lines.
	 */
	public static final String SQL = "sql"; //$NON-NLS-1$

	/**
	 *  Structured text processor for arithmetic expressions, possibly with a RTL base direction.
	 */
	public static final String RTL_ARITHMETIC = "math"; //$NON-NLS-1$

	/**
	 * Prevents instantiation
	 */
	private STextProcessorFactory() {
		// placeholder
	}

	/**
	 * Retrieve all IDs of registered structured text processors.
	 * @return an array of text processor IDs.
	 */
	static public String[] getAllProcessorIDs() {
		return STextTypesCollector.getInstance().getTypes();
	}

	/**
	 *  Obtain a structured text processor of a given type.
	 *  @param id string identifying processor
	 *  @return a processor of the required type, or <code>null</code> if the type is unknown
	 */
	static public STextProcessor getProcessor(String id) {
		return STextTypesCollector.getInstance().getProcessor(id);
	}

}

Back to the top