update copyrights
[fedora-idea.git] / platform / lang-api / src / com / intellij / psi / PsiFile.java
blob72dede6cb7f1176d16c771f2c701fc347d65cfa3
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.
16 package com.intellij.psi;
18 import com.intellij.lang.ASTNode;
19 import com.intellij.openapi.fileTypes.FileType;
20 import com.intellij.openapi.vfs.VirtualFile;
21 import org.jetbrains.annotations.NotNull;
22 import org.jetbrains.annotations.Nullable;
24 /**
25 * A PSI element representing a file.
27 public interface PsiFile extends PsiFileSystemItem {
28 /**
29 * The empty array of PSI files which can be reused to avoid unnecessary allocations.
31 PsiFile[] EMPTY_ARRAY = new PsiFile[0];
33 /**
34 * Returns the virtual file corresponding to the PSI file.
36 * @return the virtual file, or null if the file exists only in memory.
38 @Nullable VirtualFile getVirtualFile();
40 /**
41 * Returns the directory containing the file.
43 * @return the containing directory, or null if the file exists only in memory.
45 @Nullable PsiDirectory getContainingDirectory();
47 @Nullable PsiDirectory getParent();
49 /**
50 * Gets the modification stamp value. Modification stamp is a value changed by any modification
51 * of the content of the file. Note that it is not related to the file modification time.
53 * @return the modification stamp value
54 * @see com.intellij.openapi.vfs.VirtualFile#getModificationStamp()
56 long getModificationStamp();
58 /**
59 * If the file is a non-physical copy of a file, returns the original file which had
60 * been copied. Otherwise, returns the same file.
62 * @return the original file of a copy, or the same file if the file is not a copy.
64 @NotNull PsiFile getOriginalFile();
66 /**
67 * Returns the file type for the file.
69 * @return the file type instance.
71 @NotNull FileType getFileType();
73 /**
74 * If the file contains multiple interspersed languages, returns the roots for
75 * PSI trees for each of these languages. (For example, a JSPX file contains JSP,
76 * XML and Java trees.)
78 * @return the array of PSI roots, or a single-element array containing <code>this</code>
79 * if the file has only a single language.
80 * @deprecated Use {@link com.intellij.psi.FileViewProvider#getLanguages()} and then
81 * {@link com.intellij.psi.FileViewProvider#getPsi(com.intellij.lang.Language)} instead.
83 @NotNull PsiFile[] getPsiRoots();
85 @NotNull FileViewProvider getViewProvider();
87 ASTNode getNode();
89 void subtreeChanged();