From 66ea0ffaed459b78c6ed001abff841694fe37e9a Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Thu, 19 Feb 2015 18:51:44 +0100 Subject: [PATCH] correctly init fileTypeChangedCounter (because now we store this non-roamable property in other component) --- .../openapi/fileTypes/impl/FileTypeManagerImpl.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/fileTypes/impl/FileTypeManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/fileTypes/impl/FileTypeManagerImpl.java index c2a03d709f47..26d3994eab58 100644 --- a/platform/platform-impl/src/com/intellij/openapi/fileTypes/impl/FileTypeManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/fileTypes/impl/FileTypeManagerImpl.java @@ -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() { @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();