better isEquivalenTo for PsiClasses
[fedora-idea.git] / platform / lang-api / src / com / intellij / psi / PsiFileFactory.java
blob63e8be5c4251de71f27c64b02d97b80f16f68c32
1 /*
2 * @author max
3 */
4 package com.intellij.psi;
6 import com.intellij.lang.Language;
7 import com.intellij.openapi.components.ServiceManager;
8 import com.intellij.openapi.fileTypes.FileType;
9 import com.intellij.openapi.project.Project;
10 import com.intellij.openapi.util.Key;
11 import org.jetbrains.annotations.NonNls;
12 import org.jetbrains.annotations.NotNull;
13 import org.jetbrains.annotations.Nullable;
15 public abstract class PsiFileFactory {
16 public static Key<PsiFile> ORIGINAL_FILE = Key.create("ORIGINAL_FILE");
17 public static PsiFileFactory getInstance(Project project) {
18 return ServiceManager.getService(project, PsiFileFactory.class);
21 /**
22 * Creates a file from the specified text.
24 * @param name the name of the file to create (the extension of the name determines the file type).
25 * @param text the text of the file to create.
26 * @return the created file.
27 * @throws com.intellij.util.IncorrectOperationException if the file type with specified extension is binary.
29 @NotNull
30 public abstract PsiFile createFileFromText(@NotNull @NonNls String name, @NotNull @NonNls String text);
32 @NotNull
33 public abstract PsiFile createFileFromText(@NonNls @NotNull String fileName, @NotNull FileType fileType, @NotNull CharSequence text);
35 @NotNull
36 public abstract PsiFile createFileFromText(@NonNls @NotNull String name, @NotNull FileType fileType, @NotNull CharSequence text,
37 long modificationStamp, boolean physical);
39 @NotNull
40 public abstract PsiFile createFileFromText(@NonNls @NotNull String name, @NotNull FileType fileType, @NotNull CharSequence text,
41 long modificationStamp, boolean physical, boolean markAsCopy);
43 public abstract PsiFile createFileFromText(@NotNull String name, @NotNull Language language, @NotNull CharSequence text);
45 public abstract PsiFile createFileFromText(@NotNull String name, @NotNull Language language, @NotNull CharSequence text,
46 boolean physical, boolean markAsCopy);
48 public abstract PsiFile createFileFromText(FileType fileType, String fileName, CharSequence chars, int startOffset, int endOffset);
50 @Nullable
51 public abstract PsiFile createFileFromText(@NotNull CharSequence chars, @NotNull PsiFile original);