isUpToDate() method

This commit is contained in:
Alexey Kudravtsev
2014-10-02 13:04:38 +04:00
parent 33921f0c99
commit 5eeef1819d
4 changed files with 21 additions and 16 deletions
@@ -17,7 +17,6 @@ package com.intellij.psi;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.impl.file.impl.ResolveScopeManagerImpl;
import com.intellij.util.indexing.*;
import com.intellij.util.io.DataExternalizer;
import com.intellij.util.io.KeyDescriptor;
@@ -45,7 +44,7 @@ public class RefQueueIndex extends FileBasedIndexExtension<Void,Void> {
@NotNull
@Override
public Map<Void, Void> map(@NotNull FileContent inputData) {
if (ResolveScopeManagerImpl.ENABLED_REF_BACK) {
if (RefResolveService.ENABLED) {
Project project = inputData.getProject();
RefResolveService.getInstance(project).queue(Collections.singletonList(inputData.getFile()), "Cache updater");
}
@@ -102,7 +101,7 @@ public class RefQueueIndex extends FileBasedIndexExtension<Void,Void> {
return new FileBasedIndex.InputFilter() {
@Override
public boolean acceptInput(@NotNull VirtualFile file) {
return ResolveScopeManagerImpl.ENABLED_REF_BACK && !file.isDirectory() && RefResolveServiceImpl.isSupportedFileType(file);
return RefResolveService.ENABLED && !file.isDirectory() && RefResolveServiceImpl.isSupportedFileType(file);
}
};
}
@@ -114,6 +113,6 @@ public class RefQueueIndex extends FileBasedIndexExtension<Void,Void> {
@Override
public int getVersion() {
return ResolveScopeManagerImpl.ENABLED_REF_BACK ? 0xFF : 0;
return RefResolveService.ENABLED ? 0xFF : 0;
}
}
@@ -50,7 +50,6 @@ import com.intellij.openapi.vfs.newvfs.events.VFileEvent;
import com.intellij.openapi.vfs.newvfs.persistent.FSRecords;
import com.intellij.openapi.vfs.newvfs.persistent.PersistentFS;
import com.intellij.psi.impl.PersistentIntList;
import com.intellij.psi.impl.file.impl.ResolveScopeManagerImpl;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.util.PsiUtilCore;
import com.intellij.util.ArrayUtil;
@@ -105,7 +104,7 @@ public class RefResolveServiceImpl extends RefResolveService implements Runnable
((FutureTask)resolveProcess).run();
myApplication = application;
myProjectFileIndex = projectFileIndex;
if (ResolveScopeManagerImpl.ENABLED_REF_BACK) {
if (ENABLED) {
File indexFile = new File(getStorageDirectory(), "index");
File dataFile = new File(getStorageDirectory(), "data");
fileIsResolved = ConcurrentBitSet.readFrom(new File(getStorageDirectory(), "bitSet"));
@@ -392,8 +391,7 @@ public class RefResolveServiceImpl extends RefResolveService implements Runnable
}
private volatile Future<?> resolveProcess = new FutureTask<Object>(EmptyRunnable.getInstance(), null); // write from EDT only
private volatile ProgressIndicator resolveIndicator = new EmptyProgressIndicator();
@Override
public void run() {
while (!myDisposed) {
@@ -443,7 +441,6 @@ public class RefResolveServiceImpl extends RefResolveService implements Runnable
else {
indicator = new MyProgress();
}
resolveIndicator = indicator;
resolveProcess = ProgressManagerImpl.runProcessWithProgressAsynchronously(backgroundable, indicator, null);
}
}, myProject.getDisposed());
@@ -809,7 +806,7 @@ public class RefResolveServiceImpl extends RefResolveService implements Runnable
@Override
@Nullable
public int[] getBackwardIds(@NotNull VirtualFileWithId file) {
if (!upToDate) return null;
if (!isUpToDate()) return null;
int fileId = getAbsId((VirtualFile)file);
return storage.get(fileId);
}
@@ -879,6 +876,11 @@ public class RefResolveServiceImpl extends RefResolveService implements Runnable
return queued;
}
@Override
public boolean isUpToDate() {
return ENABLED && !myDisposed && upToDate;
}
private static class MyProgress extends ProgressIndicatorBase implements Disposable{
@Override
public void dispose() {