KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > core > text > DocumentTextNode


1 /*******************************************************************************
2  * Copyright (c) 2000, 2007 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.pde.internal.core.text;
12
13 public class DocumentTextNode implements IDocumentTextNode {
14     
15     private static final long serialVersionUID = 1L;
16     
17     private transient int fOffset = -1;
18     private transient int fLength = 0;
19     private transient IDocumentNode fEnclosingElement;
20     
21     private String JavaDoc fText;
22
23     /* (non-Javadoc)
24      * @see org.eclipse.pde.internal.ui.model.IDocumentTextNode#setEnclosingElement(org.eclipse.pde.internal.ui.model.IDocumentNode)
25      */

26     public void setEnclosingElement(IDocumentNode node) {
27         fEnclosingElement = node;
28     }
29     /* (non-Javadoc)
30      * @see org.eclipse.pde.internal.ui.model.IDocumentTextNode#getEnclosingElement()
31      */

32     public IDocumentNode getEnclosingElement() {
33         return fEnclosingElement;
34     }
35     /* (non-Javadoc)
36      * @see org.eclipse.pde.internal.ui.model.IDocumentTextNode#setText(java.lang.String)
37      */

38     public void setText(String JavaDoc text) {
39         fText = text;
40     }
41     /* (non-Javadoc)
42      * @see org.eclipse.pde.internal.ui.model.IDocumentTextNode#getText()
43      */

44     public String JavaDoc getText() {
45         return fText == null ? "" : fText; //$NON-NLS-1$
46
}
47     /* (non-Javadoc)
48      * @see org.eclipse.pde.internal.ui.model.IDocumentTextNode#setOffset(int)
49      */

50     public void setOffset(int offset) {
51         fOffset = offset;
52     }
53     /* (non-Javadoc)
54      * @see org.eclipse.pde.internal.ui.model.IDocumentTextNode#getOffset()
55      */

56     public int getOffset() {
57         return fOffset;
58     }
59     
60     /* (non-Javadoc)
61      * @see org.eclipse.pde.internal.ui.model.IDocumentTextNode#getLength()
62      */

63     public int getLength() {
64         return fLength;
65     }
66     
67     /* (non-Javadoc)
68      * @see org.eclipse.pde.internal.ui.model.IDocumentTextNode#setLength(int)
69      */

70     public void setLength(int length) {
71         fLength = length;
72     }
73     
74     /* (non-Javadoc)
75      * @see org.eclipse.pde.internal.core.text.IDocumentTextNode#reconnectText(org.eclipse.pde.internal.core.text.IDocumentNode)
76      */

77     public void reconnect(IDocumentNode parent) {
78         // Transient field: Enclosing Element
79
// Essentially the parent (an element)
80
fEnclosingElement = parent;
81         // Transient field: Length
82
fLength = -1;
83         // Transient field: Offset
84
fOffset = -1;
85     }
86     
87 }
88
Popular Tags