KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > core > util > SimpleDocument


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 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 package org.eclipse.jdt.internal.core.util;
12
13 import org.eclipse.jface.text.IDocument;
14 import org.eclipse.jface.text.IDocumentListener;
15 import org.eclipse.jface.text.IDocumentPartitioner;
16 import org.eclipse.jface.text.IDocumentPartitioningListener;
17 import org.eclipse.jface.text.IPositionUpdater;
18 import org.eclipse.jface.text.IRegion;
19 import org.eclipse.jface.text.ITypedRegion;
20 import org.eclipse.jface.text.Position;
21
22 /**
23  * Minimal implementation of IDocument to apply text edit onto a string.
24  */

25 public class SimpleDocument implements IDocument {
26     
27     private StringBuffer JavaDoc buffer;
28
29     
30     public SimpleDocument(String JavaDoc source) {
31         this.buffer = new StringBuffer JavaDoc(source);
32     }
33     
34     /* (non-Javadoc)
35      * @see org.eclipse.jface.text.IDocument#getChar(int)
36      */

37     public char getChar(int offset) {
38         return 0;
39     }
40
41     /* (non-Javadoc)
42      * @see org.eclipse.jface.text.IDocument#getLength()
43      */

44     public int getLength() {
45         return this.buffer.length();
46     }
47
48     /* (non-Javadoc)
49      * @see org.eclipse.jface.text.IDocument#get()
50      */

51     public String JavaDoc get() {
52         return this.buffer.toString();
53     }
54
55     /* (non-Javadoc)
56      * @see org.eclipse.jface.text.IDocument#get(int, int)
57      */

58     public String JavaDoc get(int offset, int length) {
59         return this.buffer.substring(offset, offset + length);
60     }
61
62     /* (non-Javadoc)
63      * @see org.eclipse.jface.text.IDocument#set(java.lang.String)
64      */

65     public void set(String JavaDoc text) {
66         // defining interface method
67
}
68
69     /* (non-Javadoc)
70      * @see org.eclipse.jface.text.IDocument#replace(int, int, java.lang.String)
71      */

72     public void replace(int offset, int length, String JavaDoc text) {
73         
74         this.buffer.replace(offset, offset + length, text);
75     }
76
77     /* (non-Javadoc)
78      * @see org.eclipse.jface.text.IDocument#addDocumentListener(org.eclipse.jface.text.IDocumentListener)
79      */

80     public void addDocumentListener(IDocumentListener listener) {
81         // defining interface method
82
}
83
84     /* (non-Javadoc)
85      * @see org.eclipse.jface.text.IDocument#removeDocumentListener(org.eclipse.jface.text.IDocumentListener)
86      */

87     public void removeDocumentListener(IDocumentListener listener) {
88         // defining interface method
89
}
90
91     /* (non-Javadoc)
92      * @see org.eclipse.jface.text.IDocument#addPrenotifiedDocumentListener(org.eclipse.jface.text.IDocumentListener)
93      */

94     public void addPrenotifiedDocumentListener(IDocumentListener documentAdapter) {
95         // defining interface method
96
}
97
98     /* (non-Javadoc)
99      * @see org.eclipse.jface.text.IDocument#removePrenotifiedDocumentListener(org.eclipse.jface.text.IDocumentListener)
100      */

101     public void removePrenotifiedDocumentListener(IDocumentListener documentAdapter) {
102         // defining interface method
103
}
104
105     /* (non-Javadoc)
106      * @see org.eclipse.jface.text.IDocument#addPositionCategory(java.lang.String)
107      */

108     public void addPositionCategory(String JavaDoc category) {
109         // defining interface method
110
}
111
112     /* (non-Javadoc)
113      * @see org.eclipse.jface.text.IDocument#removePositionCategory(java.lang.String)
114      */

115     public void removePositionCategory(String JavaDoc category) {
116             // defining interface method
117
}
118
119     /* (non-Javadoc)
120      * @see org.eclipse.jface.text.IDocument#getPositionCategories()
121      */

122     public String JavaDoc[] getPositionCategories() {
123         // defining interface method
124
return null;
125     }
126
127     /* (non-Javadoc)
128      * @see org.eclipse.jface.text.IDocument#containsPositionCategory(java.lang.String)
129      */

130     public boolean containsPositionCategory(String JavaDoc category) {
131         // defining interface method
132
return false;
133     }
134
135     /* (non-Javadoc)
136      * @see org.eclipse.jface.text.IDocument#addPosition(org.eclipse.jface.text.Position)
137      */

138     public void addPosition(Position position) {
139         // defining interface method
140
}
141
142     /* (non-Javadoc)
143      * @see org.eclipse.jface.text.IDocument#removePosition(org.eclipse.jface.text.Position)
144      */

145     public void removePosition(Position position) {
146         // defining interface method
147
}
148
149     /* (non-Javadoc)
150      * @see org.eclipse.jface.text.IDocument#addPosition(java.lang.String, org.eclipse.jface.text.Position)
151      */

152     public void addPosition(String JavaDoc category, Position position) {
153         // defining interface method
154
}
155
156     /* (non-Javadoc)
157      * @see org.eclipse.jface.text.IDocument#removePosition(java.lang.String, org.eclipse.jface.text.Position)
158      */

159     public void removePosition(String JavaDoc category, Position position) {
160         // defining interface method
161
}
162
163     /* (non-Javadoc)
164      * @see org.eclipse.jface.text.IDocument#getPositions(java.lang.String)
165      */

166     public Position[] getPositions(String JavaDoc category) {
167         // defining interface method
168
return null;
169     }
170
171     /* (non-Javadoc)
172      * @see org.eclipse.jface.text.IDocument#containsPosition(java.lang.String, int, int)
173      */

174     public boolean containsPosition(String JavaDoc category, int offset, int length) {
175         // defining interface method
176
return false;
177     }
178
179     /* (non-Javadoc)
180      * @see org.eclipse.jface.text.IDocument#computeIndexInCategory(java.lang.String, int)
181      */

182     public int computeIndexInCategory(String JavaDoc category, int offset) {
183         // defining interface method
184
return 0;
185     }
186
187     /* (non-Javadoc)
188      * @see org.eclipse.jface.text.IDocument#addPositionUpdater(org.eclipse.jface.text.IPositionUpdater)
189      */

190     public void addPositionUpdater(IPositionUpdater updater) {
191         // defining interface method
192
}
193
194     /* (non-Javadoc)
195      * @see org.eclipse.jface.text.IDocument#removePositionUpdater(org.eclipse.jface.text.IPositionUpdater)
196      */

197     public void removePositionUpdater(IPositionUpdater updater) {
198         // defining interface method
199
}
200
201     /* (non-Javadoc)
202      * @see org.eclipse.jface.text.IDocument#insertPositionUpdater(org.eclipse.jface.text.IPositionUpdater, int)
203      */

204     public void insertPositionUpdater(IPositionUpdater updater, int index) {
205         // defining interface method
206
}
207
208     /* (non-Javadoc)
209      * @see org.eclipse.jface.text.IDocument#getPositionUpdaters()
210      */

211     public IPositionUpdater[] getPositionUpdaters() {
212         // defining interface method
213
return null;
214     }
215
216     /* (non-Javadoc)
217      * @see org.eclipse.jface.text.IDocument#getLegalContentTypes()
218      */

219     public String JavaDoc[] getLegalContentTypes() {
220         // defining interface method
221
return null;
222     }
223
224     /* (non-Javadoc)
225      * @see org.eclipse.jface.text.IDocument#getContentType(int)
226      */

227     public String JavaDoc getContentType(int offset) {
228         // defining interface method
229
return null;
230     }
231
232     /* (non-Javadoc)
233      * @see org.eclipse.jface.text.IDocument#getPartition(int)
234      */

235     public ITypedRegion getPartition(int offset) {
236         // defining interface method
237
return null;
238     }
239
240     /* (non-Javadoc)
241      * @see org.eclipse.jface.text.IDocument#computePartitioning(int, int)
242      */

243     public ITypedRegion[] computePartitioning(int offset, int length) {
244         // defining interface method
245
return null;
246     }
247
248     /* (non-Javadoc)
249      * @see org.eclipse.jface.text.IDocument#addDocumentPartitioningListener(org.eclipse.jface.text.IDocumentPartitioningListener)
250      */

251     public void addDocumentPartitioningListener(IDocumentPartitioningListener listener) {
252         // defining interface method
253
}
254
255     /* (non-Javadoc)
256      * @see org.eclipse.jface.text.IDocument#removeDocumentPartitioningListener(org.eclipse.jface.text.IDocumentPartitioningListener)
257      */

258     public void removeDocumentPartitioningListener(IDocumentPartitioningListener listener) {
259         // defining interface method
260
}
261
262     /* (non-Javadoc)
263      * @see org.eclipse.jface.text.IDocument#setDocumentPartitioner(org.eclipse.jface.text.IDocumentPartitioner)
264      */

265     public void setDocumentPartitioner(IDocumentPartitioner partitioner) {
266         // defining interface method
267
}
268
269     /* (non-Javadoc)
270      * @see org.eclipse.jface.text.IDocument#getDocumentPartitioner()
271      */

272     public IDocumentPartitioner getDocumentPartitioner() {
273         // defining interface method
274
return null;
275     }
276
277     /* (non-Javadoc)
278      * @see org.eclipse.jface.text.IDocument#getLineLength(int)
279      */

280     public int getLineLength(int line) {
281         // defining interface method
282
return 0;
283     }
284
285     /* (non-Javadoc)
286      * @see org.eclipse.jface.text.IDocument#getLineOfOffset(int)
287      */

288     public int getLineOfOffset(int offset) {
289         // defining interface method
290
return 0;
291     }
292
293     /* (non-Javadoc)
294      * @see org.eclipse.jface.text.IDocument#getLineOffset(int)
295      */

296     public int getLineOffset(int line) {
297         // defining interface method
298
return 0;
299     }
300
301     /* (non-Javadoc)
302      * @see org.eclipse.jface.text.IDocument#getLineInformation(int)
303      */

304     public IRegion getLineInformation(int line) {
305         // defining interface method
306
return null;
307     }
308
309     /* (non-Javadoc)
310      * @see org.eclipse.jface.text.IDocument#getLineInformationOfOffset(int)
311      */

312     public IRegion getLineInformationOfOffset(int offset) {
313         // defining interface method
314
return null;
315     }
316
317     /* (non-Javadoc)
318      * @see org.eclipse.jface.text.IDocument#getNumberOfLines()
319      */

320     public int getNumberOfLines() {
321         // defining interface method
322
return 0;
323     }
324
325     /* (non-Javadoc)
326      * @see org.eclipse.jface.text.IDocument#getNumberOfLines(int, int)
327      */

328     public int getNumberOfLines(int offset, int length) {
329         // defining interface method
330
return 0;
331     }
332
333     /* (non-Javadoc)
334      * @see org.eclipse.jface.text.IDocument#computeNumberOfLines(java.lang.String)
335      */

336     public int computeNumberOfLines(String JavaDoc text) {
337         // defining interface method
338
return 0;
339     }
340
341     /* (non-Javadoc)
342      * @see org.eclipse.jface.text.IDocument#getLegalLineDelimiters()
343      */

344     public String JavaDoc[] getLegalLineDelimiters() {
345         // defining interface method
346
return null;
347     }
348
349     /* (non-Javadoc)
350      * @see org.eclipse.jface.text.IDocument#getLineDelimiter(int)
351      */

352     public String JavaDoc getLineDelimiter(int line) {
353         // defining interface method
354
return null;
355     }
356
357     /**
358      * @see org.eclipse.jface.text.IDocument#search(int, java.lang.String, boolean, boolean, boolean)
359      * @deprecated
360      */

361     public int search(
362         int startOffset,
363         String JavaDoc findString,
364         boolean forwardSearch,
365         boolean caseSensitive,
366         boolean wholeWord) {
367         // defining interface method
368
return 0;
369     }
370
371 }
372
Popular Tags