comparison dwtx/jface/text/templates/TemplateContextType.d @ 162:1a5b8f8129df

...
author Frank Benoit <benoit@tionex.de>
date Mon, 08 Sep 2008 00:51:37 +0200
parents f70d9508c95c
children
comparison
equal deleted inserted replaced
161:f8d52b926852 162:1a5b8f8129df
68 68
69 /** The id of the context type. */ 69 /** The id of the context type. */
70 private /* final */ String fId= null; 70 private /* final */ String fId= null;
71 71
72 /** Variable resolvers used by this content type. */ 72 /** Variable resolvers used by this content type. */
73 private const Map fResolvers= new HashMap(); 73 private const Map fResolvers;
74 74
75 /** The name of the context type. */ 75 /** The name of the context type. */
76 private String fName= null; 76 private String fName= null;
77 77
78 /** 78 /**
90 * 90 *
91 * @param id the unique identifier of the context type 91 * @param id the unique identifier of the context type
92 * @param name the name of the context type 92 * @param name the name of the context type
93 */ 93 */
94 public this(String id, String name) { 94 public this(String id, String name) {
95 fResolvers= new HashMap();
96
95 Assert.isNotNull(id); 97 Assert.isNotNull(id);
96 Assert.isNotNull(name); 98 Assert.isNotNull(name);
97 fId= id; 99 fId= id;
98 fName= name; 100 fName= name;
99 } 101 }
100 102
101 /** 103 /**
102 * Returns the id of the context type. 104 * Returns the id of the context type.
103 * 105 *
104 * @return the id of the receiver 106 * @return the id of the receiver
105 */ 107 */
106 public String getId() { 108 public String getId() {
107 return fId; 109 return fId;
108 } 110 }
125 * called in client code except for subclass constructors; use 127 * called in client code except for subclass constructors; use
126 * {@link #TemplateContextType(String)} instead. 128 * {@link #TemplateContextType(String)} instead.
127 * </p> 129 * </p>
128 */ 130 */
129 public this() { 131 public this() {
132 fResolvers= new HashMap();
130 } 133 }
131 134
132 /** 135 /**
133 * Sets the id of this context. 136 * Sets the id of this context.
134 * <p> 137 * <p>
269 272
270 } 273 }
271 274
272 IDocument document= new Document(buffer.getString()); 275 IDocument document= new Document(buffer.getString());
273 MultiTextEdit edit= new MultiTextEdit(0, document.getLength()); 276 MultiTextEdit edit= new MultiTextEdit(0, document.getLength());
274 edit.addChildren((TextEdit[]) positions.toArray(new TextEdit[positions.size()])); 277 edit.addChildren(arraycast!(TextEdit)( positions.toArray()));
275 edit.addChildren((TextEdit[]) edits.toArray(new TextEdit[edits.size()])); 278 edit.addChildren(arraycast!(TextEdit)( edits.toArray()));
276 edit.apply(document, TextEdit.UPDATE_REGIONS); 279 edit.apply(document, TextEdit.UPDATE_REGIONS);
277 280
278 positionsToVariables(positions, variables); 281 positionsToVariables(positions, variables);
279 282
280 buffer.setContent(document.get(), variables); 283 buffer.setContent(document.get(), variables);
281 } 284 }
282 285
283 /** 286 /**
284 * Resolves a single variable in a context. Resolving is delegated to the registered resolver. 287 * Resolves a single variable in a context. Resolving is delegated to the registered resolver.
285 * 288 *
286 * @param variable the variable to resolve 289 * @param variable the variable to resolve
287 * @param context the context in which to resolve the variable 290 * @param context the context in which to resolve the variable
288 * @since 3.3 291 * @since 3.3
289 */ 292 */
290 public void resolve(TemplateVariable variable, TemplateContext context) { 293 public void resolve(TemplateVariable variable, TemplateContext context) {