A massive organize imports and formatting of the sources using default Eclipse code...
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / core / util / SimpleDocument.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2004 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials 
4  * are made available under the terms of the Common Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v10.html
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11 package net.sourceforge.phpdt.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 buffer;
28
29         public SimpleDocument(String source) {
30                 this.buffer = new StringBuffer(source);
31         }
32
33         /*
34          * (non-Javadoc)
35          * 
36          * @see org.eclipse.jface.text.IDocument#getChar(int)
37          */
38         public char getChar(int offset) {
39                 return 0;
40         }
41
42         /*
43          * (non-Javadoc)
44          * 
45          * @see org.eclipse.jface.text.IDocument#getLength()
46          */
47         public int getLength() {
48                 return this.buffer.length();
49         }
50
51         /*
52          * (non-Javadoc)
53          * 
54          * @see org.eclipse.jface.text.IDocument#get()
55          */
56         public String get() {
57                 return this.buffer.toString();
58         }
59
60         /*
61          * (non-Javadoc)
62          * 
63          * @see org.eclipse.jface.text.IDocument#get(int, int)
64          */
65         public String get(int offset, int length) {
66                 return this.buffer.substring(offset, offset + length);
67         }
68
69         /*
70          * (non-Javadoc)
71          * 
72          * @see org.eclipse.jface.text.IDocument#set(java.lang.String)
73          */
74         public void set(String text) {
75                 // defining interface method
76         }
77
78         /*
79          * (non-Javadoc)
80          * 
81          * @see org.eclipse.jface.text.IDocument#replace(int, int, java.lang.String)
82          */
83         public void replace(int offset, int length, String text) {
84
85                 this.buffer.replace(offset, offset + length, text);
86         }
87
88         /*
89          * (non-Javadoc)
90          * 
91          * @see org.eclipse.jface.text.IDocument#addDocumentListener(org.eclipse.jface.text.IDocumentListener)
92          */
93         public void addDocumentListener(IDocumentListener listener) {
94                 // defining interface method
95         }
96
97         /*
98          * (non-Javadoc)
99          * 
100          * @see org.eclipse.jface.text.IDocument#removeDocumentListener(org.eclipse.jface.text.IDocumentListener)
101          */
102         public void removeDocumentListener(IDocumentListener listener) {
103                 // defining interface method
104         }
105
106         /*
107          * (non-Javadoc)
108          * 
109          * @see org.eclipse.jface.text.IDocument#addPrenotifiedDocumentListener(org.eclipse.jface.text.IDocumentListener)
110          */
111         public void addPrenotifiedDocumentListener(IDocumentListener documentAdapter) {
112                 // defining interface method
113         }
114
115         /*
116          * (non-Javadoc)
117          * 
118          * @see org.eclipse.jface.text.IDocument#removePrenotifiedDocumentListener(org.eclipse.jface.text.IDocumentListener)
119          */
120         public void removePrenotifiedDocumentListener(
121                         IDocumentListener documentAdapter) {
122                 // defining interface method
123         }
124
125         /*
126          * (non-Javadoc)
127          * 
128          * @see org.eclipse.jface.text.IDocument#addPositionCategory(java.lang.String)
129          */
130         public void addPositionCategory(String category) {
131                 // defining interface method
132         }
133
134         /*
135          * (non-Javadoc)
136          * 
137          * @see org.eclipse.jface.text.IDocument#removePositionCategory(java.lang.String)
138          */
139         public void removePositionCategory(String category) {
140                 // defining interface method
141         }
142
143         /*
144          * (non-Javadoc)
145          * 
146          * @see org.eclipse.jface.text.IDocument#getPositionCategories()
147          */
148         public String[] getPositionCategories() {
149                 // defining interface method
150                 return null;
151         }
152
153         /*
154          * (non-Javadoc)
155          * 
156          * @see org.eclipse.jface.text.IDocument#containsPositionCategory(java.lang.String)
157          */
158         public boolean containsPositionCategory(String category) {
159                 // defining interface method
160                 return false;
161         }
162
163         /*
164          * (non-Javadoc)
165          * 
166          * @see org.eclipse.jface.text.IDocument#addPosition(org.eclipse.jface.text.Position)
167          */
168         public void addPosition(Position position) {
169                 // defining interface method
170         }
171
172         /*
173          * (non-Javadoc)
174          * 
175          * @see org.eclipse.jface.text.IDocument#removePosition(org.eclipse.jface.text.Position)
176          */
177         public void removePosition(Position position) {
178                 // defining interface method
179         }
180
181         /*
182          * (non-Javadoc)
183          * 
184          * @see org.eclipse.jface.text.IDocument#addPosition(java.lang.String,
185          *      org.eclipse.jface.text.Position)
186          */
187         public void addPosition(String category, Position position) {
188                 // defining interface method
189         }
190
191         /*
192          * (non-Javadoc)
193          * 
194          * @see org.eclipse.jface.text.IDocument#removePosition(java.lang.String,
195          *      org.eclipse.jface.text.Position)
196          */
197         public void removePosition(String category, Position position) {
198                 // defining interface method
199         }
200
201         /*
202          * (non-Javadoc)
203          * 
204          * @see org.eclipse.jface.text.IDocument#getPositions(java.lang.String)
205          */
206         public Position[] getPositions(String category) {
207                 // defining interface method
208                 return null;
209         }
210
211         /*
212          * (non-Javadoc)
213          * 
214          * @see org.eclipse.jface.text.IDocument#containsPosition(java.lang.String,
215          *      int, int)
216          */
217         public boolean containsPosition(String category, int offset, int length) {
218                 // defining interface method
219                 return false;
220         }
221
222         /*
223          * (non-Javadoc)
224          * 
225          * @see org.eclipse.jface.text.IDocument#computeIndexInCategory(java.lang.String,
226          *      int)
227          */
228         public int computeIndexInCategory(String category, int offset) {
229                 // defining interface method
230                 return 0;
231         }
232
233         /*
234          * (non-Javadoc)
235          * 
236          * @see org.eclipse.jface.text.IDocument#addPositionUpdater(org.eclipse.jface.text.IPositionUpdater)
237          */
238         public void addPositionUpdater(IPositionUpdater updater) {
239                 // defining interface method
240         }
241
242         /*
243          * (non-Javadoc)
244          * 
245          * @see org.eclipse.jface.text.IDocument#removePositionUpdater(org.eclipse.jface.text.IPositionUpdater)
246          */
247         public void removePositionUpdater(IPositionUpdater updater) {
248                 // defining interface method
249         }
250
251         /*
252          * (non-Javadoc)
253          * 
254          * @see org.eclipse.jface.text.IDocument#insertPositionUpdater(org.eclipse.jface.text.IPositionUpdater,
255          *      int)
256          */
257         public void insertPositionUpdater(IPositionUpdater updater, int index) {
258                 // defining interface method
259         }
260
261         /*
262          * (non-Javadoc)
263          * 
264          * @see org.eclipse.jface.text.IDocument#getPositionUpdaters()
265          */
266         public IPositionUpdater[] getPositionUpdaters() {
267                 // defining interface method
268                 return null;
269         }
270
271         /*
272          * (non-Javadoc)
273          * 
274          * @see org.eclipse.jface.text.IDocument#getLegalContentTypes()
275          */
276         public String[] getLegalContentTypes() {
277                 // defining interface method
278                 return null;
279         }
280
281         /*
282          * (non-Javadoc)
283          * 
284          * @see org.eclipse.jface.text.IDocument#getContentType(int)
285          */
286         public String getContentType(int offset) {
287                 // defining interface method
288                 return null;
289         }
290
291         /*
292          * (non-Javadoc)
293          * 
294          * @see org.eclipse.jface.text.IDocument#getPartition(int)
295          */
296         public ITypedRegion getPartition(int offset) {
297                 // defining interface method
298                 return null;
299         }
300
301         /*
302          * (non-Javadoc)
303          * 
304          * @see org.eclipse.jface.text.IDocument#computePartitioning(int, int)
305          */
306         public ITypedRegion[] computePartitioning(int offset, int length) {
307                 // defining interface method
308                 return null;
309         }
310
311         /*
312          * (non-Javadoc)
313          * 
314          * @see org.eclipse.jface.text.IDocument#addDocumentPartitioningListener(org.eclipse.jface.text.IDocumentPartitioningListener)
315          */
316         public void addDocumentPartitioningListener(
317                         IDocumentPartitioningListener listener) {
318                 // defining interface method
319         }
320
321         /*
322          * (non-Javadoc)
323          * 
324          * @see org.eclipse.jface.text.IDocument#removeDocumentPartitioningListener(org.eclipse.jface.text.IDocumentPartitioningListener)
325          */
326         public void removeDocumentPartitioningListener(
327                         IDocumentPartitioningListener listener) {
328                 // defining interface method
329         }
330
331         /*
332          * (non-Javadoc)
333          * 
334          * @see org.eclipse.jface.text.IDocument#setDocumentPartitioner(org.eclipse.jface.text.IDocumentPartitioner)
335          */
336         public void setDocumentPartitioner(IDocumentPartitioner partitioner) {
337                 // defining interface method
338         }
339
340         /*
341          * (non-Javadoc)
342          * 
343          * @see org.eclipse.jface.text.IDocument#getDocumentPartitioner()
344          */
345         public IDocumentPartitioner getDocumentPartitioner() {
346                 // defining interface method
347                 return null;
348         }
349
350         /*
351          * (non-Javadoc)
352          * 
353          * @see org.eclipse.jface.text.IDocument#getLineLength(int)
354          */
355         public int getLineLength(int line) {
356                 // defining interface method
357                 return 0;
358         }
359
360         /*
361          * (non-Javadoc)
362          * 
363          * @see org.eclipse.jface.text.IDocument#getLineOfOffset(int)
364          */
365         public int getLineOfOffset(int offset) {
366                 // defining interface method
367                 return 0;
368         }
369
370         /*
371          * (non-Javadoc)
372          * 
373          * @see org.eclipse.jface.text.IDocument#getLineOffset(int)
374          */
375         public int getLineOffset(int line) {
376                 // defining interface method
377                 return 0;
378         }
379
380         /*
381          * (non-Javadoc)
382          * 
383          * @see org.eclipse.jface.text.IDocument#getLineInformation(int)
384          */
385         public IRegion getLineInformation(int line) {
386                 // defining interface method
387                 return null;
388         }
389
390         /*
391          * (non-Javadoc)
392          * 
393          * @see org.eclipse.jface.text.IDocument#getLineInformationOfOffset(int)
394          */
395         public IRegion getLineInformationOfOffset(int offset) {
396                 // defining interface method
397                 return null;
398         }
399
400         /*
401          * (non-Javadoc)
402          * 
403          * @see org.eclipse.jface.text.IDocument#getNumberOfLines()
404          */
405         public int getNumberOfLines() {
406                 // defining interface method
407                 return 0;
408         }
409
410         /*
411          * (non-Javadoc)
412          * 
413          * @see org.eclipse.jface.text.IDocument#getNumberOfLines(int, int)
414          */
415         public int getNumberOfLines(int offset, int length) {
416                 // defining interface method
417                 return 0;
418         }
419
420         /*
421          * (non-Javadoc)
422          * 
423          * @see org.eclipse.jface.text.IDocument#computeNumberOfLines(java.lang.String)
424          */
425         public int computeNumberOfLines(String text) {
426                 // defining interface method
427                 return 0;
428         }
429
430         /*
431          * (non-Javadoc)
432          * 
433          * @see org.eclipse.jface.text.IDocument#getLegalLineDelimiters()
434          */
435         public String[] getLegalLineDelimiters() {
436                 // defining interface method
437                 return null;
438         }
439
440         /*
441          * (non-Javadoc)
442          * 
443          * @see org.eclipse.jface.text.IDocument#getLineDelimiter(int)
444          */
445         public String getLineDelimiter(int line) {
446                 // defining interface method
447                 return null;
448         }
449
450         /**
451          * @see org.eclipse.jface.text.IDocument#search(int, java.lang.String,
452          *      boolean, boolean, boolean)
453          * @deprecated
454          */
455         public int search(int startOffset, String findString,
456                         boolean forwardSearch, boolean caseSensitive, boolean wholeWord) {
457                 // defining interface method
458                 return 0;
459         }
460
461 }