KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > text > formatter > IFormattingContext


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  *******************************************************************************/

11
12 package org.eclipse.jface.text.formatter;
13
14 import java.util.Map JavaDoc;
15
16 import org.eclipse.jface.preference.IPreferenceStore;
17
18 /**
19  * Formatting context used in formatting strategies implementing interface
20  * <code>IFormattingStrategyExtension</code>.
21  *
22  * @see IFormattingStrategyExtension
23  * @since 3.0
24  */

25 public interface IFormattingContext {
26
27     /**
28      * Dispose of the formatting context.
29      * <p>
30      * Must be called after the formatting context has been used in a
31      * formatting process.
32      */

33     void dispose();
34
35     /**
36      * Returns the preference keys used for the retrieval of formatting
37      * preferences.
38      *
39      * @return The preference keys for formatting
40      */

41     String JavaDoc[] getPreferenceKeys();
42
43     /**
44      * Retrieves the property <code>key</code> from the formatting context
45      *
46      * @param key
47      * Key of the property to store in the context
48      * @return The property <code>key</code> if available, <code>null</code>
49      * otherwise
50      */

51     Object JavaDoc getProperty(Object JavaDoc key);
52
53     /**
54      * Is this preference key for a boolean preference?
55      *
56      * @param key
57      * The preference key to query its type
58      * @return <code>true</code> iff this key is for a boolean preference,
59      * <code>false</code> otherwise.
60      */

61     boolean isBooleanPreference(String JavaDoc key);
62
63     /**
64      * Is this preference key for a double preference?
65      *
66      * @param key
67      * The preference key to query its type
68      * @return <code>true</code> iff this key is for a double preference,
69      * <code>false</code> otherwise.
70      */

71     boolean isDoublePreference(String JavaDoc key);
72
73     /**
74      * Is this preference key for a float preference?
75      *
76      * @param key
77      * The preference key to query its type
78      * @return <code>true</code> iff this key is for a float preference,
79      * <code>false</code> otherwise.
80      */

81     boolean isFloatPreference(String JavaDoc key);
82
83     /**
84      * Is this preference key for an integer preference?
85      *
86      * @param key
87      * The preference key to query its type
88      * @return <code>true</code> iff this key is for an integer preference,
89      * <code>false</code> otherwise.
90      */

91     boolean isIntegerPreference(String JavaDoc key);
92
93     /**
94      * Is this preference key for a long preference?
95      *
96      * @param key
97      * The preference key to query its type
98      * @return <code>true</code> iff this key is for a long preference,
99      * <code>false</code> otherwise.
100      */

101     boolean isLongPreference(String JavaDoc key);
102
103     /**
104      * Is this preference key for a string preference?
105      *
106      * @param key
107      * The preference key to query its type
108      * @return <code>true</code> iff this key is for a string preference,
109      * <code>false</code> otherwise.
110      */

111     boolean isStringPreference(String JavaDoc key);
112
113     /**
114      * Stores the preferences from a map to a preference store.
115      * <p>
116      * Note that the preference keys returned by
117      * {@link #getPreferenceKeys()} must not be used in the preference store.
118      * Otherwise the preferences are overwritten.
119      * </p>
120      *
121      * @param map
122      * Map to retrieve the preferences from
123      * @param store
124      * Preference store to store the preferences in
125      */

126     void mapToStore(Map JavaDoc map, IPreferenceStore store);
127
128     /**
129      * Stores the property <code>key</code> in the formatting context.
130      *
131      * @param key
132      * Key of the property to store in the context
133      * @param property
134      * Property to store in the context. If already present, the new
135      * property overwrites the present one.
136      */

137     void setProperty(Object JavaDoc key, Object JavaDoc property);
138
139     /**
140      * Retrieves the preferences from a preference store in a map.
141      * <p>
142      * Note that the preference keys returned by
143      * {@link #getPreferenceKeys()} must not be used in the map. Otherwise the
144      * preferences are overwritten.
145      * </p>
146      *
147      * @param store
148      * Preference store to retrieve the preferences from
149      * @param map
150      * Map to store the preferences in
151      * @param useDefault
152      * <code>true</code> if the default preferences should be
153      * used, <code>false</code> otherwise
154      */

155     void storeToMap(IPreferenceStore store, Map JavaDoc map, boolean useDefault);
156 }
157
Popular Tags