simplified javadoc root processing for modules

This commit is contained in:
nik
2012-06-20 14:52:45 +04:00
parent 18d9439ea5
commit b2c43fccbe
4 changed files with 33 additions and 13 deletions
@@ -676,10 +676,7 @@ public class JavaDocumentationProvider implements CodeDocumentationProvider, Ext
final List<OrderEntry> orderEntries = fileIndex.getOrderEntriesForFile(virtualFile);
for (OrderEntry orderEntry : orderEntries) {
if (orderEntry instanceof ModuleOrderEntry) {
continue;
}
final String[] files = orderEntry.getUrls(JavadocOrderRootType.getInstance());
final String[] files = JavadocOrderRootType.getUrls(orderEntry);
final List<String> httpRoot = PlatformDocumentationUtil.getHttpRoots(files, relPath);
if (httpRoot != null) return httpRoot;
}
@@ -15,6 +15,12 @@
*/
package com.intellij.openapi.roots;
import com.intellij.util.ArrayUtil;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* @author yole
*/
@@ -23,15 +29,33 @@ public class JavadocOrderRootType extends PersistentOrderRootType {
super("JAVADOC", "javadocPath", "javadoc-paths", "javadocPathEntry");
}
/**
* JavaDoc paths.
*/
public static OrderRootType getInstance() {
return getOrderRootType(JavadocOrderRootType.class);
}
@Override
public boolean collectFromDependentModules() {
return true;
public static String[] getUrls(OrderEntry entry) {
List<String> result = new ArrayList<String>();
RootPolicy<List<String>> policy = new RootPolicy<List<String>>() {
@Override
public List<String> visitLibraryOrderEntry(final LibraryOrderEntry orderEntry, final List<String> value) {
Collections.addAll(value, orderEntry.getRootUrls(getInstance()));
return value;
}
@Override
public List<String> visitJdkOrderEntry(final JdkOrderEntry orderEntry, final List<String> value) {
Collections.addAll(value, orderEntry.getRootUrls(getInstance()));
return value;
}
@Override
public List<String> visitModuleSourceOrderEntry(final ModuleSourceOrderEntry orderEntry,
final List<String> value) {
Collections.addAll(value, orderEntry.getRootModel().getRootUrls(getInstance()));
return value;
}
};
entry.accept(policy, result);
return ArrayUtil.toStringArray(result);
}
}
@@ -97,7 +97,9 @@ public class OrderRootType {
/**
* Whether {@link ModuleOrderEntry#getFiles(OrderRootType)} collects the list of roots from dependent modules.
* @deprecated looks like this method was introduced by mistake. It won't be called by IDEA anymore
*/
@Deprecated
public boolean collectFromDependentModules() {
return false;
}
@@ -253,9 +253,6 @@ public class ModuleRootManagerImpl extends ModuleRootManager implements ModuleCo
if (type == OrderRootType.SOURCES) {
return base.exportedOnly().recursively().sources();
}
if (type.collectFromDependentModules()) {
return base.recursively().roots(type);
}
return base.roots(type);
}