129
|
1 /*******************************************************************************
|
|
2 * Copyright (c) 2000, 2005 IBM Corporation and others.
|
|
3 * All rights reserved. This program and the accompanying materials
|
|
4 * are made available under the terms of the Eclipse Public License v1.0
|
|
5 * which accompanies this distribution, and is available at
|
|
6 * http://www.eclipse.org/legal/epl-v10.html
|
|
7 *
|
|
8 * Contributors:
|
|
9 * IBM Corporation - initial API and implementation
|
|
10 * Port to the D programming language:
|
|
11 * Frank Benoit <benoit@tionex.de>
|
|
12 *******************************************************************************/
|
|
13
|
131
|
14
|
151
|
15 module dwtx.jface.text.formatter.IFormattingContext;
|
|
16
|
131
|
17 import dwtx.jface.text.formatter.MultiPassContentFormatter; // packageimport
|
|
18 import dwtx.jface.text.formatter.ContextBasedFormattingStrategy; // packageimport
|
|
19 import dwtx.jface.text.formatter.FormattingContext; // packageimport
|
|
20 import dwtx.jface.text.formatter.IFormattingStrategy; // packageimport
|
|
21 import dwtx.jface.text.formatter.IContentFormatterExtension; // packageimport
|
|
22 import dwtx.jface.text.formatter.IFormattingStrategyExtension; // packageimport
|
|
23 import dwtx.jface.text.formatter.IContentFormatter; // packageimport
|
|
24 import dwtx.jface.text.formatter.FormattingContextProperties; // packageimport
|
|
25 import dwtx.jface.text.formatter.ContentFormatter; // packageimport
|
|
26
|
129
|
27 import dwt.dwthelper.utils;
|
|
28
|
|
29 import java.util.Map;
|
|
30
|
|
31 import dwtx.jface.preference.IPreferenceStore;
|
|
32
|
|
33 /**
|
|
34 * Formatting context used in formatting strategies implementing interface
|
|
35 * <code>IFormattingStrategyExtension</code>.
|
|
36 *
|
|
37 * @see IFormattingStrategyExtension
|
|
38 * @since 3.0
|
|
39 */
|
|
40 public interface IFormattingContext {
|
|
41
|
|
42 /**
|
|
43 * Dispose of the formatting context.
|
|
44 * <p>
|
|
45 * Must be called after the formatting context has been used in a
|
|
46 * formatting process.
|
|
47 */
|
|
48 void dispose();
|
|
49
|
|
50 /**
|
|
51 * Returns the preference keys used for the retrieval of formatting
|
|
52 * preferences.
|
|
53 *
|
|
54 * @return The preference keys for formatting
|
|
55 */
|
|
56 String[] getPreferenceKeys();
|
|
57
|
|
58 /**
|
|
59 * Retrieves the property <code>key</code> from the formatting context
|
|
60 *
|
|
61 * @param key
|
|
62 * Key of the property to store in the context
|
|
63 * @return The property <code>key</code> if available, <code>null</code>
|
|
64 * otherwise
|
|
65 */
|
|
66 Object getProperty(Object key);
|
|
67
|
|
68 /**
|
|
69 * Is this preference key for a bool preference?
|
|
70 *
|
|
71 * @param key
|
|
72 * The preference key to query its type
|
|
73 * @return <code>true</code> iff this key is for a bool preference,
|
|
74 * <code>false</code> otherwise.
|
|
75 */
|
|
76 bool isBooleanPreference(String key);
|
|
77
|
|
78 /**
|
|
79 * Is this preference key for a double preference?
|
|
80 *
|
|
81 * @param key
|
|
82 * The preference key to query its type
|
|
83 * @return <code>true</code> iff this key is for a double preference,
|
|
84 * <code>false</code> otherwise.
|
|
85 */
|
|
86 bool isDoublePreference(String key);
|
|
87
|
|
88 /**
|
|
89 * Is this preference key for a float preference?
|
|
90 *
|
|
91 * @param key
|
|
92 * The preference key to query its type
|
|
93 * @return <code>true</code> iff this key is for a float preference,
|
|
94 * <code>false</code> otherwise.
|
|
95 */
|
|
96 bool isFloatPreference(String key);
|
|
97
|
|
98 /**
|
|
99 * Is this preference key for an integer preference?
|
|
100 *
|
|
101 * @param key
|
|
102 * The preference key to query its type
|
|
103 * @return <code>true</code> iff this key is for an integer preference,
|
|
104 * <code>false</code> otherwise.
|
|
105 */
|
|
106 bool isIntegerPreference(String key);
|
|
107
|
|
108 /**
|
|
109 * Is this preference key for a long preference?
|
|
110 *
|
|
111 * @param key
|
|
112 * The preference key to query its type
|
|
113 * @return <code>true</code> iff this key is for a long preference,
|
|
114 * <code>false</code> otherwise.
|
|
115 */
|
|
116 bool isLongPreference(String key);
|
|
117
|
|
118 /**
|
|
119 * Is this preference key for a string preference?
|
|
120 *
|
|
121 * @param key
|
|
122 * The preference key to query its type
|
|
123 * @return <code>true</code> iff this key is for a string preference,
|
|
124 * <code>false</code> otherwise.
|
|
125 */
|
|
126 bool isStringPreference(String key);
|
|
127
|
|
128 /**
|
|
129 * Stores the preferences from a map to a preference store.
|
|
130 * <p>
|
|
131 * Note that the preference keys returned by
|
|
132 * {@link #getPreferenceKeys()} must not be used in the preference store.
|
|
133 * Otherwise the preferences are overwritten.
|
|
134 * </p>
|
|
135 *
|
|
136 * @param map
|
|
137 * Map to retrieve the preferences from
|
|
138 * @param store
|
|
139 * Preference store to store the preferences in
|
|
140 */
|
|
141 void mapToStore(Map map, IPreferenceStore store);
|
|
142
|
|
143 /**
|
|
144 * Stores the property <code>key</code> in the formatting context.
|
|
145 *
|
|
146 * @param key
|
|
147 * Key of the property to store in the context
|
|
148 * @param property
|
|
149 * Property to store in the context. If already present, the new
|
|
150 * property overwrites the present one.
|
|
151 */
|
|
152 void setProperty(Object key, Object property);
|
|
153
|
|
154 /**
|
|
155 * Retrieves the preferences from a preference store in a map.
|
|
156 * <p>
|
|
157 * Note that the preference keys returned by
|
|
158 * {@link #getPreferenceKeys()} must not be used in the map. Otherwise the
|
|
159 * preferences are overwritten.
|
|
160 * </p>
|
|
161 *
|
|
162 * @param store
|
|
163 * Preference store to retrieve the preferences from
|
|
164 * @param map
|
|
165 * Map to store the preferences in
|
|
166 * @param useDefault
|
|
167 * <code>true</code> if the default preferences should be
|
|
168 * used, <code>false</code> otherwise
|
|
169 */
|
|
170 void storeToMap(IPreferenceStore store, Map map, bool useDefault);
|
|
171 }
|