KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > text > ITextStore


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.jface.text;
12
13
14 /**
15  * Interface for storing and managing text.
16  * <p>
17  * Provides access to the stored text and allows to manipulate it.</p>
18  * <p>
19  * Clients may
20  * implement this interface or use {@link org.eclipse.jface.text.GapTextStore} or
21  * {@link org.eclipse.jface.text.CopyOnWriteTextStore}.</p>
22  */

23 public interface ITextStore {
24
25     /**
26      * Returns the character at the specified offset.
27      *
28      * @param offset the offset in this text store
29      * @return the character at this offset
30      */

31     char get(int offset);
32
33     /**
34      * Returns the text of the specified character range.
35      *
36      * @param offset the offset of the range
37      * @param length the length of the range
38      * @return the text of the range
39      */

40     String JavaDoc get(int offset, int length);
41
42     /**
43      * Returns number of characters stored in this text store.
44      *
45      * @return the number of characters stored in this text store
46      */

47     int getLength();
48
49     /**
50      * Replaces the specified character range with the given text.
51      * <code>replace(getLength(), 0, "some text")</code> is a valid
52      * call and appends text to the end of the text store.
53      *
54      * @param offset the offset of the range to be replaced
55      * @param length the number of characters to be replaced
56      * @param text the substitution text
57      */

58     void replace(int offset, int length, String JavaDoc text);
59
60     /**
61      * Replace the content of the text store with the given text.
62      * Convenience method for <code>replace(0, getLength(), text</code>.
63      *
64      * @param text the new content of the text store
65      */

66     void set(String JavaDoc text);
67 }
68
Popular Tags