private synchronized void setUp() {
clear();
List<? extends T> list1 = l1.lookup(folder, service);
List<? extends T> list2 = l2.lookup(folder, service);
if (list1 instanceof PositionedList || list2 instanceof PositionedList) {
List<PositionedElement> positioned = new ArrayList<PositionedElement>();
List<T> others = new ArrayList<T>();
boolean hp1 = false;
if (list1 instanceof PositionedList) {
PositionedList<? extends T> ml1 = (PositionedList<? extends T>) list1;
if (ml1.hasPositions()) {
fillElements(ml1, positioned, others);
hp1 = true;
}
}
boolean hp2 = false;
if (list2 instanceof PositionedList) {
PositionedList<? extends T> ml2 = (PositionedList<? extends T>) list2;
if (ml2.hasPositions()) {
fillElements(ml2, positioned, others);
hp2 = true;
}
}
if (hp1 && hp2) { // merge
if (!positioned.isEmpty()) {
Collections.sort(positioned);
Set<String> hiddenClassNames = new HashSet<String>();
addHiddenClassNames(list1, hiddenClassNames);
addHiddenClassNames(list2, hiddenClassNames);
List<T> sorted = new LookupList<T>(hiddenClassNames);
for (PositionedElement<T> pe : positioned) {
sorted.add(pe.element);
}
positionedElements = positioned;
list1 = sorted;
} else {
list1 = Collections.emptyList();
}
list2 = others;
} else if (hp1) {
positionedElements = positioned;
} else if (hp2) {
positionedElements = positioned;
List<? extends T> switchList = list1;
list1 = list2;
list2 = switchList;
}
}
addAll (list1);
addAll (list2);
sublist1 = (list1 instanceof Customizer) ? (Customizer) list1 : null;
sublist2 = (list2 instanceof Customizer) ? (Customizer) list2 : null;
}
Lookup.java 文件源码
java
阅读 30
收藏 0
点赞 0
评论 0
项目:incubator-netbeans
作者:
评论列表
文章目录