Java Code Examples for com.intellij.openapi.roots.OrderEnumerator#forEachModule()

The following examples show how to use com.intellij.openapi.roots.OrderEnumerator#forEachModule() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XQueryRunProfileState.java    From intellij-xquery with Apache License 2.0 6 votes vote down vote up
private Sdk getJdkToRunModule(Module module) {
    final Sdk moduleSdk = ModuleRootManager.getInstance(module).getSdk();
    if (moduleSdk == null) {
        return null;
    }

    final Set<Sdk> sdksFromDependencies = new LinkedHashSet<>();
    OrderEnumerator enumerator = OrderEnumerator.orderEntries(module).runtimeOnly().recursively();
    enumerator = enumerator.productionOnly();
    enumerator.forEachModule(module1 -> {
        Sdk sdk = ModuleRootManager.getInstance(module1).getSdk();
        if (sdk != null && sdk.getSdkType().equals(moduleSdk.getSdkType())) {
            sdksFromDependencies.add(sdk);
        }
        return true;
    });
    return findLatestVersion(moduleSdk, sdksFromDependencies);
}
 
Example 2
Source File: PantsClasspathRunConfigurationExtension.java    From intellij-pants-plugin with Apache License 2.0 4 votes vote down vote up
private void processRuntimeModules(@NotNull Module module, Processor<Module> processor) {
  final OrderEnumerator runtimeEnumerator = OrderEnumerator.orderEntries(module).runtimeOnly().recursively();
  runtimeEnumerator.forEachModule(processor);
}