From bf0c2aaed33f927ef12c33243c6297fb0442f539 Mon Sep 17 00:00:00 2001 From: "Kirill.Safonov" Date: Mon, 26 Sep 2011 11:53:30 +0400 Subject: [PATCH] OrderEnumerator: call addCustomRootsForLibrary() when calculating urls --- .../openapi/roots/OrderEnumerationHandler.java | 6 +++--- .../openapi/roots/impl/OrderEnumeratorBase.java | 17 +++++++++++++++-- .../roots/impl/OrderRootsEnumeratorImpl.java | 5 ++++- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/openapi/roots/OrderEnumerationHandler.java b/platform/lang-impl/src/com/intellij/openapi/roots/OrderEnumerationHandler.java index 9ab27bcb3f6d..2bce96ba7010 100644 --- a/platform/lang-impl/src/com/intellij/openapi/roots/OrderEnumerationHandler.java +++ b/platform/lang-impl/src/com/intellij/openapi/roots/OrderEnumerationHandler.java @@ -60,9 +60,9 @@ public abstract class OrderEnumerationHandler { return false; } - public boolean addCustomOutput(@NotNull OrderEntry forOrderEntry, - @NotNull OrderRootType type, - @NotNull Collection urls) { + public boolean addCustomRootsForLibrary(@NotNull OrderEntry forOrderEntry, + @NotNull OrderRootType type, + @NotNull Collection urls) { return false; } diff --git a/platform/lang-impl/src/com/intellij/openapi/roots/impl/OrderEnumeratorBase.java b/platform/lang-impl/src/com/intellij/openapi/roots/impl/OrderEnumeratorBase.java index 097f4d11b450..56c54f109960 100644 --- a/platform/lang-impl/src/com/intellij/openapi/roots/impl/OrderEnumeratorBase.java +++ b/platform/lang-impl/src/com/intellij/openapi/roots/impl/OrderEnumeratorBase.java @@ -326,11 +326,11 @@ abstract class OrderEnumeratorBase extends OrderEnumerator implements OrderEnume return false; } - boolean addCustomOutput(OrderEntry forOrderEntry, OrderRootType type, Collection result) { + boolean addCustomRootsForLibrary(OrderEntry forOrderEntry, OrderRootType type, Collection result) { for (OrderEnumerationHandler handler : myCustomHandlers) { final List urls = new ArrayList(); 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 result) { + for (OrderEnumerationHandler handler : myCustomHandlers) { + final List urls = new ArrayList(); + 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 result) { for (OrderEnumerationHandler handler : myCustomHandlers) { if (handler.addCustomOutput(forModule, orderEntryRootModel, type, this, result)) { diff --git a/platform/lang-impl/src/com/intellij/openapi/roots/impl/OrderRootsEnumeratorImpl.java b/platform/lang-impl/src/com/intellij/openapi/roots/impl/OrderRootsEnumeratorImpl.java index f2190475d33f..3f9232a12461 100644 --- a/platform/lang-impl/src/com/intellij/openapi/roots/impl/OrderRootsEnumeratorImpl.java +++ b/platform/lang-impl/src/com/intellij/openapi/roots/impl/OrderRootsEnumeratorImpl.java @@ -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;