update copyrights
[fedora-idea.git] / platform / lang-impl / src / com / intellij / psi / impl / source / tree / FileElement.java
blobe0884fbd2613f4299332efec1b32b74d63c51279
1 /*
2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package com.intellij.psi.impl.source.tree;
19 import com.intellij.lang.ASTNode;
20 import com.intellij.psi.impl.PsiManagerEx;
21 import com.intellij.psi.impl.source.CharTableImpl;
22 import com.intellij.psi.impl.source.PsiFileImpl;
23 import com.intellij.psi.tree.IElementType;
24 import com.intellij.util.CharTable;
26 public class FileElement extends LazyParseableElement {
27 private volatile CharTable myCharTable = new CharTableImpl();
29 public CharTable getCharTable() {
30 return myCharTable;
33 public FileElement(IElementType type, CharSequence text) {
34 super(type, text);
37 @Deprecated // for 8.1 API compatibility
38 public FileElement(IElementType type) {
39 super(type, null);
42 public PsiManagerEx getManager() {
43 if (getTreeParent() != null) return getTreeParent().getManager();
44 return (PsiManagerEx)getPsi().getManager(); //TODO: cache?
47 public ASTNode copyElement() {
48 PsiFileImpl psiElement = (PsiFileImpl)getPsi();
49 PsiFileImpl psiElementCopy = (PsiFileImpl)psiElement.copy();
50 return psiElementCopy.getTreeElement();
53 public void setCharTable(CharTable table) {
54 myCharTable = table;