correctly init fileTypeChangedCounter (because now we store this non-roamable property in other component)

This commit is contained in:
Vladimir Krivosheev
2015-02-19 18:53:54 +01:00
parent f7eddb75a8
commit 66ea0ffaed
@@ -140,7 +140,11 @@ public class FileTypeManagerImpl extends FileTypeManagerEx implements Persistent
private final AtomicInteger counterAutoDetect = new AtomicInteger();
private final AtomicLong elapsedAutoDetect = new AtomicLong();
public FileTypeManagerImpl(MessageBus bus, SchemesManagerFactory schemesManagerFactory) {
public FileTypeManagerImpl(MessageBus bus, SchemesManagerFactory schemesManagerFactory, PropertiesComponent propertiesComponent) {
int fileTypeChangedCounter = StringUtilRt.parseInt(propertiesComponent.getValue("fileTypeChangedCounter"), 0);
fileTypeChangedCount = new AtomicInteger(fileTypeChangedCounter);
autoDetectedAttribute = new FileAttribute("AUTO_DETECTION_CACHE_ATTRIBUTE", fileTypeChangedCounter, true);
myMessageBus = bus;
mySchemesManager = schemesManagerFactory.createSchemesManager(FILE_SPEC, new BaseSchemeProcessor<AbstractFileType>() {
@NotNull
@@ -536,7 +540,7 @@ public class FileTypeManagerImpl extends FileTypeManagerEx implements Persistent
return file.getFileType();
}
private volatile FileAttribute autoDetectedAttribute = new FileAttribute("AUTO_DETECTION_CACHE_ATTRIBUTE", 0, true);
private volatile FileAttribute autoDetectedAttribute;
private void cacheAutoDetectedFileType(@NotNull VirtualFile file, @NotNull FileType fileType) {
DataOutputStream stream = autoDetectedAttribute.writeAttribute(file);
boolean wasAutodetectedAsText = fileType == FileTypes.PLAIN_TEXT;
@@ -802,7 +806,7 @@ public class FileTypeManagerImpl extends FileTypeManagerEx implements Persistent
myMessageBus.syncPublisher(TOPIC).beforeFileTypesChanged(event);
}
private final AtomicInteger fileTypeChangedCount = new AtomicInteger();
private final AtomicInteger fileTypeChangedCount;
@Override
public void fireFileTypesChanged() {
clearCaches();