OrderEnumerator: call addCustomRootsForLibrary() when calculating urls

This commit is contained in:
Kirill.Safonov
2011-09-26 11:53:30 +04:00
parent 50f5edf59a
commit bf0c2aaed3
3 changed files with 22 additions and 6 deletions
@@ -60,9 +60,9 @@ public abstract class OrderEnumerationHandler {
return false;
}
public boolean addCustomOutput(@NotNull OrderEntry forOrderEntry,
@NotNull OrderRootType type,
@NotNull Collection<String> urls) {
public boolean addCustomRootsForLibrary(@NotNull OrderEntry forOrderEntry,
@NotNull OrderRootType type,
@NotNull Collection<String> urls) {
return false;
}
@@ -326,11 +326,11 @@ abstract class OrderEnumeratorBase extends OrderEnumerator implements OrderEnume
return false;
}
boolean addCustomOutput(OrderEntry forOrderEntry, OrderRootType type, Collection<VirtualFile> result) {
boolean addCustomRootsForLibrary(OrderEntry forOrderEntry, OrderRootType type, Collection<VirtualFile> result) {
for (OrderEnumerationHandler handler : myCustomHandlers) {
final List<String> urls = new ArrayList<String>();
final boolean added =
handler.addCustomOutput(forOrderEntry, type, urls);
handler.addCustomRootsForLibrary(forOrderEntry, type, urls);
for (String url : urls) {
ContainerUtil.addIfNotNull(VirtualFileManager.getInstance().findFileByUrl(url), result);
}
@@ -341,6 +341,19 @@ abstract class OrderEnumeratorBase extends OrderEnumerator implements OrderEnume
return false;
}
boolean addCustomRootUrlsForLibrary(OrderEntry forOrderEntry, OrderRootType type, Collection<String> result) {
for (OrderEnumerationHandler handler : myCustomHandlers) {
final List<String> urls = new ArrayList<String>();
final boolean added =
handler.addCustomRootsForLibrary(forOrderEntry, type, urls);
result.addAll(urls);
if (added) {
return true;
}
}
return false;
}
boolean addCustomOutputUrls(Module forModule, ModuleRootModel orderEntryRootModel, OrderRootType type, Collection<String> result) {
for (OrderEnumerationHandler handler : myCustomHandlers) {
if (handler.addCustomOutput(forModule, orderEntryRootModel, type, this, result)) {
@@ -128,7 +128,7 @@ public class OrderRootsEnumeratorImpl implements OrderRootsEnumerator {
Collections.addAll(result, myCustomRootProvider.fun(orderEntry));
return true;
}
if (myOrderEnumerator.addCustomOutput(orderEntry, type, result)) {
if (myOrderEnumerator.addCustomRootsForLibrary(orderEntry, type, result)) {
return true;
}
Collections.addAll(result, orderEntry.getFiles(type));
@@ -168,6 +168,9 @@ public class OrderRootsEnumeratorImpl implements OrderRootsEnumerator {
}
}
else {
if (myOrderEnumerator.addCustomRootUrlsForLibrary(orderEntry, type, result)) {
return true;
}
Collections.addAll(result, orderEntry.getUrls(type));
}
return true;