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
|
|
14 module dwtx.jface.text.formatter.IFormattingContext;
|
|
15
|
|
16 import dwt.dwthelper.utils;
|
|
17
|
|
18 import java.util.Map;
|
|
19
|
|
20 import dwtx.jface.preference.IPreferenceStore;
|
|
21
|
|
22 /**
|
|
23 * Formatting context used in formatting strategies implementing interface
|
|
24 * <code>IFormattingStrategyExtension</code>.
|
|
25 *
|
|
26 * @see IFormattingStrategyExtension
|
|
27 * @since 3.0
|
|
28 */
|
|
29 public interface IFormattingContext {
|
|
30
|
|
31 /**
|
|
32 * Dispose of the formatting context.
|
|
33 * <p>
|
|
34 * Must be called after the formatting context has been used in a
|
|
35 * formatting process.
|
|
36 */
|
|
37 void dispose();
|
|
38
|
|
39 /**
|
|
40 * Returns the preference keys used for the retrieval of formatting
|
|
41 * preferences.
|
|
42 *
|
|
43 * @return The preference keys for formatting
|
|
44 */
|
|
45 String[] getPreferenceKeys();
|
|
46
|
|
47 /**
|
|
48 * Retrieves the property <code>key</code> from the formatting context
|
|
49 *
|
|
50 * @param key
|
|
51 * Key of the property to store in the context
|
|
52 * @return The property <code>key</code> if available, <code>null</code>
|
|
53 * otherwise
|
|
54 */
|
|
55 Object getProperty(Object key);
|
|
56
|
|
57 /**
|
|
58 * Is this preference key for a bool preference?
|
|
59 *
|
|
60 * @param key
|
|
61 * The preference key to query its type
|
|
62 * @return <code>true</code> iff this key is for a bool preference,
|
|
63 * <code>false</code> otherwise.
|
|
64 */
|
|
65 bool isBooleanPreference(String key);
|
|
66
|
|
67 /**
|
|
68 * Is this preference key for a double preference?
|
|
69 *
|
|
70 * @param key
|
|
71 * The preference key to query its type
|
|
72 * @return <code>true</code> iff this key is for a double preference,
|
|
73 * <code>false</code> otherwise.
|
|
74 */
|
|
75 bool isDoublePreference(String key);
|
|
76
|
|
77 /**
|
|
78 * Is this preference key for a float preference?
|
|
79 *
|
|
80 * @param key
|
|
81 * The preference key to query its type
|
|
82 * @return <code>true</code> iff this key is for a float preference,
|
|
83 * <code>false</code> otherwise.
|
|
84 */
|
|
85 bool isFloatPreference(String key);
|
|
86
|
|
87 /**
|
|
88 * Is this preference key for an integer preference?
|
|
89 *
|
|
90 * @param key
|
|
91 * The preference key to query its type
|
|
92 * @return <code>true</code> iff this key is for an integer preference,
|
|
93 * <code>false</code> otherwise.
|
|
94 */
|
|
95 bool isIntegerPreference(String key);
|
|
96
|
|
97 /**
|
|
98 * Is this preference key for a long preference?
|
|
99 *
|
|
100 * @param key
|
|
101 * The preference key to query its type
|
|
102 * @return <code>true</code> iff this key is for a long preference,
|
|
103 * <code>false</code> otherwise.
|
|
104 */
|
|
105 bool isLongPreference(String key);
|
|
106
|
|
107 /**
|
|
108 * Is this preference key for a string preference?
|
|
109 *
|
|
110 * @param key
|
|
111 * The preference key to query its type
|
|
112 * @return <code>true</code> iff this key is for a string preference,
|
|
113 * <code>false</code> otherwise.
|
|
114 */
|
|
115 bool isStringPreference(String key);
|
|
116
|
|
117 /**
|
|
118 * Stores the preferences from a map to a preference store.
|
|
119 * <p>
|
|
120 * Note that the preference keys returned by
|
|
121 * {@link #getPreferenceKeys()} must not be used in the preference store.
|
|
122 * Otherwise the preferences are overwritten.
|
|
123 * </p>
|
|
124 *
|
|
125 * @param map
|
|
126 * Map to retrieve the preferences from
|
|
127 * @param store
|
|
128 * Preference store to store the preferences in
|
|
129 */
|
|
130 void mapToStore(Map map, IPreferenceStore store);
|
|
131
|
|
132 /**
|
|
133 * Stores the property <code>key</code> in the formatting context.
|
|
134 *
|
|
135 * @param key
|
|
136 * Key of the property to store in the context
|
|
137 * @param property
|
|
138 * Property to store in the context. If already present, the new
|
|
139 * property overwrites the present one.
|
|
140 */
|
|
141 void setProperty(Object key, Object property);
|
|
142
|
|
143 /**
|
|
144 * Retrieves the preferences from a preference store in a map.
|
|
145 * <p>
|
|
146 * Note that the preference keys returned by
|
|
147 * {@link #getPreferenceKeys()} must not be used in the map. Otherwise the
|
|
148 * preferences are overwritten.
|
|
149 * </p>
|
|
150 *
|
|
151 * @param store
|
|
152 * Preference store to retrieve the preferences from
|
|
153 * @param map
|
|
154 * Map to store the preferences in
|
|
155 * @param useDefault
|
|
156 * <code>true</code> if the default preferences should be
|
|
157 * used, <code>false</code> otherwise
|
|
158 */
|
|
159 void storeToMap(IPreferenceStore store, Map map, bool useDefault);
|
|
160 }
|