This commit is contained in:
Alexey Kudravtsev
2015-06-11 15:30:33 +03:00
parent 6ae576e2bd
commit ec80e685eb
4 changed files with 17 additions and 15 deletions
@@ -71,7 +71,7 @@ class RefCountHolder {
private static final Key<Reference<RefCountHolder>> REF_COUNT_HOLDER_IN_FILE_KEY = Key.create("REF_COUNT_HOLDER_IN_FILE_KEY");
@NotNull
public static RefCountHolder get(@NotNull PsiFile file) {
static RefCountHolder get(@NotNull PsiFile file) {
Reference<RefCountHolder> ref = file.getUserData(REF_COUNT_HOLDER_IN_FILE_KEY);
RefCountHolder holder = com.intellij.reference.SoftReference.dereference(ref);
if (holder == null) {
@@ -171,7 +171,7 @@ class RefCountHolder {
}
}
public boolean isReferenced(@NotNull PsiElement element) {
boolean isReferenced(@NotNull PsiElement element) {
Collection<PsiReference> array;
synchronized (myLocalRefsMap) {
array = myLocalRefsMap.get(element);
@@ -272,10 +272,10 @@ class RefCountHolder {
return false;
}
public boolean analyze(@NotNull PsiFile file,
TextRange dirtyScope,
@NotNull ProgressIndicator indicator,
@NotNull Runnable analyze) {
boolean analyze(@NotNull PsiFile file,
TextRange dirtyScope,
@NotNull ProgressIndicator indicator,
@NotNull Runnable analyze) {
ProgressIndicator result;
if (myState.compareAndSet(EMPTY, indicator)) {
if (!file.getTextRange().equals(dirtyScope)) {
@@ -351,6 +351,11 @@ public class FileStatusMap implements Disposable {
public <T> void putUserData(@NotNull Key<T> key, @Nullable T value) {
throw new UnsupportedOperationException();
}
@Override
public String toString() {
return "WHOLE_FILE";
}
};
// logging
@@ -241,8 +241,8 @@ public class SingleRootFileViewProvider extends UserDataHolderBase implements Fi
@NotNull
public FileElement[] getKnownTreeRoots() {
PsiFile psiFile = getCachedPsi(myBaseLanguage);
if (psiFile == null || !(psiFile instanceof PsiFileImpl)) return new FileElement[0];
if (((PsiFileImpl)psiFile).getTreeElement() == null) return new FileElement[0];
if (!(psiFile instanceof PsiFileImpl)) return FileElement.EMPTY_ARRAY;
if (((PsiFileImpl)psiFile).getTreeElement() == null) return FileElement.EMPTY_ARRAY;
return new FileElement[]{(FileElement)psiFile.getNode()};
}
@@ -528,9 +528,7 @@ public class SingleRootFileViewProvider extends UserDataHolderBase implements Fi
if (document == null) {
return LoadTextUtil.loadText(virtualFile);
}
else {
return getLastCommittedText(document);
}
return getLastCommittedText(document);
}
@Override
@@ -546,9 +544,7 @@ public class SingleRootFileViewProvider extends UserDataHolderBase implements Fi
if (document == null) {
return virtualFile.getModificationStamp();
}
else {
return getLastCommittedStamp(document);
}
return getLastCommittedStamp(document);
}
@NonNls
@@ -567,7 +563,7 @@ public class SingleRootFileViewProvider extends UserDataHolderBase implements Fi
private class PsiFileContent implements Content {
private final PsiFileImpl myFile;
private volatile String myContent = null;
private volatile String myContent;
private final long myModificationStamp;
@SuppressWarnings("MismatchedQueryAndUpdateOfCollection")
@@ -30,6 +30,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class FileElement extends LazyParseableElement implements FileASTNode, Getter<FileElement> {
public static final FileElement[] EMPTY_ARRAY = new FileElement[0];
private volatile CharTable myCharTable = new CharTableImpl();
private volatile boolean myDetached;