mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
remove NewVirtualFile.{get,set}Flag
This commit is contained in:
@@ -52,6 +52,7 @@ import com.intellij.openapi.vfs.newvfs.BulkFileListener;
|
||||
import com.intellij.openapi.vfs.newvfs.ManagingFS;
|
||||
import com.intellij.openapi.vfs.newvfs.NewVirtualFile;
|
||||
import com.intellij.openapi.vfs.newvfs.events.VFileEvent;
|
||||
import com.intellij.openapi.vfs.newvfs.impl.VirtualFileSystemEntry;
|
||||
import com.intellij.openapi.vfs.newvfs.persistent.FlushingDaemon;
|
||||
import com.intellij.openapi.vfs.newvfs.persistent.PersistentFS;
|
||||
import com.intellij.psi.*;
|
||||
@@ -119,8 +120,6 @@ public class FileBasedIndexImpl extends FileBasedIndex {
|
||||
private final ConcurrentHashSet<ID<?, ?>> myUpToDateIndices = new ConcurrentHashSet<ID<?, ?>>();
|
||||
private final Map<Document, PsiFile> myTransactionMap = new THashMap<Document, PsiFile>();
|
||||
|
||||
private static final int ALREADY_PROCESSED = 0x04000000;
|
||||
|
||||
@Nullable private final String myConfigPath;
|
||||
@Nullable private final String myLogPath;
|
||||
private final boolean myIsUnitTestMode;
|
||||
@@ -2175,7 +2174,7 @@ public class FileBasedIndexImpl extends FileBasedIndex {
|
||||
return true;
|
||||
}
|
||||
if (!file.isDirectory()) {
|
||||
if (file instanceof NewVirtualFile && ((NewVirtualFile)file).getFlag(ALREADY_PROCESSED)) {
|
||||
if (file instanceof VirtualFileSystemEntry && ((VirtualFileSystemEntry)file).isFileIndexed()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2223,8 +2222,8 @@ public class FileBasedIndexImpl extends FileBasedIndex {
|
||||
}
|
||||
IndexingStamp.flushCache(file);
|
||||
|
||||
if (oldStuff && file instanceof NewVirtualFile) {
|
||||
((NewVirtualFile)file).setFlag(ALREADY_PROCESSED, true);
|
||||
if (oldStuff && file instanceof VirtualFileSystemEntry) {
|
||||
((VirtualFileSystemEntry)file).setFileIndexed(true);
|
||||
}
|
||||
}
|
||||
finally {
|
||||
@@ -2325,16 +2324,16 @@ public class FileBasedIndexImpl extends FileBasedIndex {
|
||||
}
|
||||
|
||||
private static void cleanProcessedFlag(@NotNull final VirtualFile file) {
|
||||
if (!(file instanceof NewVirtualFile)) return;
|
||||
if (!(file instanceof VirtualFileSystemEntry)) return;
|
||||
|
||||
final NewVirtualFile nvf = (NewVirtualFile)file;
|
||||
final VirtualFileSystemEntry nvf = (VirtualFileSystemEntry)file;
|
||||
if (file.isDirectory()) {
|
||||
for (VirtualFile child : nvf.getCachedChildren()) {
|
||||
cleanProcessedFlag(child);
|
||||
}
|
||||
}
|
||||
else {
|
||||
nvf.setFlag(ALREADY_PROCESSED, false);
|
||||
nvf.setFileIndexed(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -127,7 +127,4 @@ public abstract class NewVirtualFile extends VirtualFile implements VirtualFileW
|
||||
@NotNull
|
||||
public abstract Iterable<VirtualFile> iterInDbChildren();
|
||||
|
||||
public abstract void setFlag(int flagMask, boolean value);
|
||||
|
||||
public abstract boolean getFlag(int flagMask);
|
||||
}
|
||||
|
||||
+3
-4
@@ -659,12 +659,11 @@ public class VirtualDirectoryImpl extends VirtualFileSystemEntry {
|
||||
});
|
||||
}
|
||||
|
||||
private static final int CHILDREN_CACHED = 0x08000000;
|
||||
public synchronized boolean allChildrenLoaded() {
|
||||
return getFlag(CHILDREN_CACHED);
|
||||
public boolean allChildrenLoaded() {
|
||||
return getFlagInt(CHILDREN_CACHED);
|
||||
}
|
||||
private void setChildrenLoaded() {
|
||||
setFlag(CHILDREN_CACHED, true);
|
||||
setFlagInt(CHILDREN_CACHED, true);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+19
-24
@@ -49,12 +49,14 @@ public abstract class VirtualFileSystemEntry extends NewVirtualFile {
|
||||
|
||||
private static final Key<String> SYMLINK_TARGET = Key.create("local.vfs.symlink.target");
|
||||
|
||||
private static final int DIRTY_FLAG = 0x10000000;
|
||||
private static final int IS_SYMLINK_FLAG = 0x20000000;
|
||||
private static final int DIRTY_FLAG = 0x10000000;
|
||||
private static final int IS_SYMLINK_FLAG = 0x20000000;
|
||||
private static final int HAS_SYMLINK_FLAG = 0x40000000;
|
||||
private static final int IS_SPECIAL_FLAG = 0x80000000;
|
||||
private static final int RESERVED_FLAGS_MASK = 0xf0000000;
|
||||
private static final int ALL_FLAGS_MASK = 0xff000000;
|
||||
private static final int IS_SPECIAL_FLAG = 0x80000000;
|
||||
private static final int INDEXED_FLAG = 0x04000000;
|
||||
static final int CHILDREN_CACHED = 0x08000000;
|
||||
private static final int ALL_FLAGS_MASK =
|
||||
DIRTY_FLAG | IS_SYMLINK_FLAG | HAS_SYMLINK_FLAG | IS_SPECIAL_FLAG | INDEXED_FLAG | CHILDREN_CACHED;
|
||||
|
||||
private volatile int myNameId;
|
||||
private volatile VirtualDirectoryImpl myParent;
|
||||
@@ -133,28 +135,13 @@ public abstract class VirtualFileSystemEntry extends NewVirtualFile {
|
||||
myFlags = (myFlags & ALL_FLAGS_MASK) | ((int)modificationStamp & ~ALL_FLAGS_MASK);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getFlag(int mask) {
|
||||
checkCustomFlagRange(mask);
|
||||
return getFlagInt(mask);
|
||||
}
|
||||
|
||||
private static void checkCustomFlagRange(int mask) {
|
||||
assert (mask & RESERVED_FLAGS_MASK) == 0 : "Mask '" + Integer.toBinaryString(mask) + "' is in reserved range.";
|
||||
assert (mask & ~ALL_FLAGS_MASK) == 0 : "Mask '" + Integer.toBinaryString(mask) + "' is outside flag range.";
|
||||
}
|
||||
|
||||
private boolean getFlagInt(int mask) {
|
||||
boolean getFlagInt(int mask) {
|
||||
assert (mask & ~ALL_FLAGS_MASK) == 0 : "Unexpected flag";
|
||||
return (myFlags & mask) != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFlag(int mask, boolean value) {
|
||||
checkCustomFlagRange(mask);
|
||||
setFlagInt(mask, value);
|
||||
}
|
||||
|
||||
private synchronized void setFlagInt(int mask, boolean value) {
|
||||
synchronized void setFlagInt(int mask, boolean value) {
|
||||
assert (mask & ~ALL_FLAGS_MASK) == 0 : "Unexpected flag";
|
||||
if (value) {
|
||||
myFlags |= mask;
|
||||
}
|
||||
@@ -163,6 +150,14 @@ public abstract class VirtualFileSystemEntry extends NewVirtualFile {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isFileIndexed() {
|
||||
return getFlagInt(INDEXED_FLAG);
|
||||
}
|
||||
|
||||
public void setFileIndexed(boolean indexed) {
|
||||
setFlagInt(INDEXED_FLAG, indexed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markClean() {
|
||||
setFlagInt(DIRTY_FLAG, false);
|
||||
|
||||
Reference in New Issue
Block a user