mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
sort elements for disabled facet auto detection in misc.xml
This commit is contained in:
+11
-4
@@ -16,15 +16,16 @@
|
||||
|
||||
package com.intellij.facet.impl.autodetecting;
|
||||
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.containers.SortedList;
|
||||
import com.intellij.util.xmlb.annotations.AbstractCollection;
|
||||
import com.intellij.util.xmlb.annotations.Attribute;
|
||||
import com.intellij.util.xmlb.annotations.Tag;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
@@ -33,8 +34,14 @@ import java.util.List;
|
||||
*/
|
||||
@Tag("facet-type")
|
||||
public class DisabledAutodetectionByTypeElement {
|
||||
public static final Comparator<DisabledAutodetectionByTypeElement> COMPARATOR = new Comparator<DisabledAutodetectionByTypeElement>() {
|
||||
@Override
|
||||
public int compare(DisabledAutodetectionByTypeElement o1, DisabledAutodetectionByTypeElement o2) {
|
||||
return StringUtil.compare(o1.getFacetTypeId(), o2.getFacetTypeId(), true);
|
||||
}
|
||||
};
|
||||
private String myFacetTypeId;
|
||||
private List<DisabledAutodetectionInModuleElement> myModuleElements = new ArrayList<DisabledAutodetectionInModuleElement>();
|
||||
private List<DisabledAutodetectionInModuleElement> myModuleElements = new SortedList<DisabledAutodetectionInModuleElement>(DisabledAutodetectionInModuleElement.COMPARATOR);
|
||||
|
||||
public DisabledAutodetectionByTypeElement() {
|
||||
}
|
||||
|
||||
+8
@@ -16,10 +16,12 @@
|
||||
|
||||
package com.intellij.facet.impl.autodetecting;
|
||||
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.xmlb.annotations.AbstractCollection;
|
||||
import com.intellij.util.xmlb.annotations.Attribute;
|
||||
import com.intellij.util.xmlb.annotations.Tag;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -28,6 +30,12 @@ import java.util.Set;
|
||||
*/
|
||||
@Tag("module")
|
||||
public class DisabledAutodetectionInModuleElement {
|
||||
public static final Comparator<DisabledAutodetectionInModuleElement> COMPARATOR = new Comparator<DisabledAutodetectionInModuleElement>() {
|
||||
@Override
|
||||
public int compare(DisabledAutodetectionInModuleElement o1, DisabledAutodetectionInModuleElement o2) {
|
||||
return StringUtil.compare(o1.getModuleName(), o2.getModuleName(), true);
|
||||
}
|
||||
};
|
||||
private String myModuleName;
|
||||
private Set<String> myFiles = new LinkedHashSet<String>();
|
||||
private Set<String> myDirectories = new LinkedHashSet<String>();
|
||||
|
||||
+5
-10
@@ -16,20 +16,19 @@
|
||||
|
||||
package com.intellij.facet.impl.autodetecting;
|
||||
|
||||
import com.intellij.util.containers.SortedList;
|
||||
import com.intellij.util.xmlb.annotations.AbstractCollection;
|
||||
import com.intellij.util.xmlb.annotations.Tag;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
public class DisabledAutodetectionInfo {
|
||||
private List<DisabledAutodetectionByTypeElement> myElements = new ArrayList<DisabledAutodetectionByTypeElement>();
|
||||
private List<DisabledAutodetectionByTypeElement> myElements = new SortedList<DisabledAutodetectionByTypeElement>(DisabledAutodetectionByTypeElement.COMPARATOR);
|
||||
|
||||
@Tag("autodetection-disabled")
|
||||
@AbstractCollection(surroundWithTag = false)
|
||||
@@ -47,13 +46,9 @@ public class DisabledAutodetectionInfo {
|
||||
}
|
||||
|
||||
public void replaceElement(@NotNull String facetTypeId, @Nullable DisabledAutodetectionByTypeElement element) {
|
||||
Iterator<DisabledAutodetectionByTypeElement> iterator = myElements.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
DisabledAutodetectionByTypeElement typeElement = iterator.next();
|
||||
if (typeElement.getFacetTypeId().equals(facetTypeId)) {
|
||||
iterator.remove();
|
||||
break;
|
||||
}
|
||||
final DisabledAutodetectionByTypeElement old = findElement(facetTypeId);
|
||||
if (old != null) {
|
||||
myElements.remove(old);
|
||||
}
|
||||
if (element != null) {
|
||||
myElements.add(element);
|
||||
|
||||
Reference in New Issue
Block a user