01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.jface.text;
11:
12: /**
13: * Interface for storing and managing text.
14: * <p>
15: * Provides access to the stored text and allows to manipulate it.</p>
16: * <p>
17: * Clients may
18: * implement this interface or use {@link org.eclipse.jface.text.GapTextStore} or
19: * {@link org.eclipse.jface.text.CopyOnWriteTextStore}.</p>
20: */
21: public interface ITextStore {
22:
23: /**
24: * Returns the character at the specified offset.
25: *
26: * @param offset the offset in this text store
27: * @return the character at this offset
28: */
29: char get(int offset);
30:
31: /**
32: * Returns the text of the specified character range.
33: *
34: * @param offset the offset of the range
35: * @param length the length of the range
36: * @return the text of the range
37: */
38: String get(int offset, int length);
39:
40: /**
41: * Returns number of characters stored in this text store.
42: *
43: * @return the number of characters stored in this text store
44: */
45: int getLength();
46:
47: /**
48: * Replaces the specified character range with the given text.
49: * <code>replace(getLength(), 0, "some text")</code> is a valid
50: * call and appends text to the end of the text store.
51: *
52: * @param offset the offset of the range to be replaced
53: * @param length the number of characters to be replaced
54: * @param text the substitution text
55: */
56: void replace(int offset, int length, String text);
57:
58: /**
59: * Replace the content of the text store with the given text.
60: * Convenience method for <code>replace(0, getLength(), text</code>.
61: *
62: * @param text the new content of the text store
63: */
64: void set(String text);
65: }
|