KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ltk > ui > refactoring > LanguageElementNode


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 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.ltk.ui.refactoring;
12
13 import org.eclipse.core.runtime.CoreException;
14
15 import org.eclipse.jface.text.IRegion;
16
17 import org.eclipse.ltk.ui.refactoring.TextEditChangeNode.ChildNode;
18
19 import org.eclipse.ltk.internal.ui.refactoring.InternalLanguageElementNode;
20
21 /**
22  * A special child node of a <code>TextEditChangeNode</code> to represent
23  * language elements which don't have an associated <code>TextEditChangeGroup
24  * </code>. Instances of this class typically represent language members
25  * like types, methods, fields, etc. in the change preview tree.
26  * <p>
27  * Clients may extend this class.
28  * </p>
29  *
30  * @since 3.2
31  */

32 public abstract class LanguageElementNode extends InternalLanguageElementNode {
33
34     /**
35      * Creates a new <code>LanguageElementNode</code> using the
36      * given <code>TextEditChangeGroup</code> as a parent.
37      *
38      * @param parent the parent of this node
39      */

40     protected LanguageElementNode(TextEditChangeNode parent) {
41         super(parent);
42     }
43
44     /**
45      * Creates a new <code>LanguageElementNode</code> using the
46      * given <code>ChildNode</code> as a parent.
47      *
48      * @param parent the parent of this node
49      */

50     protected LanguageElementNode(ChildNode parent) {
51         super(parent);
52     }
53
54     /**
55      * Adds the given <code>ChildNode<code> to this <code>LanguageElementNode</code>
56      *
57      * @param child the child to add
58      */

59     public void addChild(ChildNode child) {
60         internalAddChild(child);
61     }
62     
63     /**
64      * Returns the text region the of this language element node.
65      *
66      * @return the text region of this language element node
67      * @throws CoreException if the source region can't be obtained
68      */

69     public abstract IRegion getTextRange() throws CoreException;
70     
71     /**
72      * This is an internal method which should not be called by
73      * subclasses.
74      *
75      * @param child the child node to add
76      */

77     protected void internalAddChild(ChildNode child) {
78         super.internalAddChild(child);
79     }
80 }
Popular Tags