mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
simplified javadoc root processing for modules
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
-3
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user