mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
revert fix: IDEA-75575 (maven: don't offer to re-import after formatting pom.xml)
This commit is contained in:
+3
-40
@@ -56,7 +56,6 @@ import org.jetbrains.idea.maven.utils.MavenMergingUpdateQueue;
|
||||
import org.jetbrains.idea.maven.utils.MavenUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
public class MavenProjectsManagerWatcher {
|
||||
@@ -396,9 +395,9 @@ public class MavenProjectsManagerWatcher {
|
||||
filesToUpdate.removeAll(filesToRemove);
|
||||
scheduleUpdate(filesToUpdate, filesToRemove, false, forceImportAndResolve);
|
||||
}
|
||||
|
||||
clearLists();
|
||||
}
|
||||
|
||||
clearLists();
|
||||
}
|
||||
|
||||
private boolean areFileSetsInitialised() {
|
||||
@@ -427,9 +426,6 @@ public class MavenProjectsManagerWatcher {
|
||||
}
|
||||
|
||||
private static abstract class MyFileChangeListenerBase implements BulkFileListener {
|
||||
|
||||
private static final Key<Integer> CONTENT_CRC_KEY = Key.create("MyFileChangeListenerBase");
|
||||
|
||||
protected abstract boolean isRelevant(String path);
|
||||
|
||||
protected abstract void updateFile(VirtualFile file);
|
||||
@@ -457,21 +453,6 @@ public class MavenProjectsManagerWatcher {
|
||||
deleteRecursively(moveEvent.getFile());
|
||||
}
|
||||
}
|
||||
else if (each instanceof VFileContentChangeEvent) {
|
||||
VirtualFile virtualFile = each.getFile();
|
||||
if (virtualFile == null) continue;
|
||||
|
||||
if (virtualFile.getLength() < 40 * 1024) {
|
||||
try {
|
||||
String content = VfsUtil.loadText(virtualFile);
|
||||
int crc = MavenUtil.getXmlCrc(content);
|
||||
virtualFile.putUserData(CONTENT_CRC_KEY, crc);
|
||||
}
|
||||
catch (IOException e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -508,25 +489,7 @@ public class MavenProjectsManagerWatcher {
|
||||
}
|
||||
}
|
||||
else if (each instanceof VFileContentChangeEvent) {
|
||||
VirtualFile virtualFile = each.getFile();
|
||||
if (virtualFile == null) continue;
|
||||
|
||||
Integer oldCrc = virtualFile.getUserData(CONTENT_CRC_KEY);
|
||||
if (oldCrc != null) {
|
||||
try {
|
||||
virtualFile.putUserData(CONTENT_CRC_KEY, null);
|
||||
|
||||
String content = VfsUtil.loadText(virtualFile);
|
||||
int newCrc = MavenUtil.getXmlCrc(content);
|
||||
|
||||
if (newCrc == oldCrc) continue;
|
||||
}
|
||||
catch (IOException e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
|
||||
updateFile(virtualFile);
|
||||
updateFile(each.getFile());
|
||||
}
|
||||
else if (each instanceof VFilePropertyChangeEvent) {
|
||||
if (isRenamed(each)) {
|
||||
|
||||
@@ -19,8 +19,6 @@ import com.intellij.codeInsight.template.TemplateManager;
|
||||
import com.intellij.codeInsight.template.impl.TemplateImpl;
|
||||
import com.intellij.ide.fileTemplates.FileTemplate;
|
||||
import com.intellij.ide.fileTemplates.FileTemplateManager;
|
||||
import com.intellij.lexer.Lexer;
|
||||
import com.intellij.lexer.XmlLexer;
|
||||
import com.intellij.notification.Notification;
|
||||
import com.intellij.notification.NotificationType;
|
||||
import com.intellij.notification.Notifications;
|
||||
@@ -46,8 +44,6 @@ import com.intellij.openapi.vfs.JarFileSystem;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.xml.XmlTokenType;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.SystemProperties;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
@@ -69,7 +65,6 @@ import java.util.concurrent.Future;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.regex.PatternSyntaxException;
|
||||
import java.util.zip.CRC32;
|
||||
|
||||
public class MavenUtil {
|
||||
public static final String MAVEN_NOTIFICATION_GROUP = "Maven";
|
||||
@@ -635,42 +630,4 @@ public class MavenUtil {
|
||||
public interface MavenTaskHandler {
|
||||
void waitFor();
|
||||
}
|
||||
|
||||
public static int getXmlCrc(@NotNull String xmlText) {
|
||||
String trimmedText = xmlText.trim();
|
||||
Lexer lexer = new XmlLexer();
|
||||
lexer.start(trimmedText);
|
||||
|
||||
CRC32 crc = new CRC32();
|
||||
|
||||
while (true) {
|
||||
IElementType tokenType = lexer.getTokenType();
|
||||
if (tokenType == null) break;
|
||||
|
||||
if (XmlTokenType.XML_REAL_WHITE_SPACE == tokenType
|
||||
|| XmlTokenType.XML_WHITE_SPACE == tokenType
|
||||
|| XmlTokenType.COMMENTS.contains(tokenType)) {
|
||||
crc.update(1);
|
||||
|
||||
do {
|
||||
lexer.advance();
|
||||
tokenType = lexer.getTokenType();
|
||||
}
|
||||
while (XmlTokenType.XML_REAL_WHITE_SPACE == tokenType
|
||||
|| XmlTokenType.XML_WHITE_SPACE == tokenType
|
||||
|| XmlTokenType.COMMENTS.contains(tokenType));
|
||||
}
|
||||
else {
|
||||
for (int start = lexer.getTokenStart(), end = lexer.getTokenEnd(); start < end; start++) {
|
||||
char a = trimmedText.charAt(start);
|
||||
crc.update(a);
|
||||
crc.update(a >>> 8);
|
||||
}
|
||||
|
||||
lexer.advance();
|
||||
}
|
||||
}
|
||||
|
||||
return (int)crc.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user