Search in sources :

Example 11 with HashMap

use of com.intellij.util.containers.hash.HashMap in project intellij-community by JetBrains.

the class SvnPropertiesDiffViewer method collectRecords.

@NotNull
private static List<PropertyRecord> collectRecords(@NotNull SvnPropertiesDiffRequest request) {
    List<DiffContent> originalContents = request.getContents();
    List<PropertyData> properties1 = getProperties(originalContents.get(0));
    List<PropertyData> properties2 = getProperties(originalContents.get(1));
    Map<String, PropertyValue> before = new HashMap<>();
    Map<String, PropertyValue> after = new HashMap<>();
    if (properties1 != null) {
        for (PropertyData data : properties1) {
            before.put(data.getName(), data.getValue());
        }
    }
    if (properties2 != null) {
        for (PropertyData data : properties2) {
            after.put(data.getName(), data.getValue());
        }
    }
    List<PropertyRecord> records = new ArrayList<>();
    for (String name : ContainerUtil.union(before.keySet(), after.keySet())) {
        records.add(createRecord(name, before.get(name), after.get(name)));
    }
    ContainerUtil.sort(records, (o1, o2) -> StringUtil.naturalCompare(o1.getName(), o2.getName()));
    return records;
}
Also used : PropertyData(org.jetbrains.idea.svn.properties.PropertyData) HashMap(com.intellij.util.containers.hash.HashMap) ArrayList(java.util.ArrayList) PropertyValue(org.jetbrains.idea.svn.properties.PropertyValue) DiffContent(com.intellij.diff.contents.DiffContent) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

HashMap (com.intellij.util.containers.hash.HashMap)11 ArrayList (java.util.ArrayList)5 NotNull (org.jetbrains.annotations.NotNull)5 Project (com.intellij.openapi.project.Project)3 PsiElement (com.intellij.psi.PsiElement)3 DataContext (com.intellij.openapi.actionSystem.DataContext)2 VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 FileModificationService (com.intellij.codeInsight.FileModificationService)1 DiffContent (com.intellij.diff.contents.DiffContent)1 MessageDiffRequest (com.intellij.diff.requests.MessageDiffRequest)1 AllIcons (com.intellij.icons.AllIcons)1 DataManager (com.intellij.ide.DataManager)1 DnDAwareTree (com.intellij.ide.dnd.aware.DnDAwareTree)1 GotoFileCellRenderer (com.intellij.ide.util.gotoByName.GotoFileCellRenderer)1 AbstractTreeNode (com.intellij.ide.util.treeView.AbstractTreeNode)1 com.intellij.lang.properties (com.intellij.lang.properties)1 PropertiesFile (com.intellij.lang.properties.psi.PropertiesFile)1 PlatformDataKeys (com.intellij.openapi.actionSystem.PlatformDataKeys)1 WriteCommandAction (com.intellij.openapi.command.WriteCommandAction)1 Logger (com.intellij.openapi.diagnostic.Logger)1