private static void setLibraryEntryExported( ModifiableRootModel rootModel, boolean exported, Library library) { for (OrderEntry orderEntry : rootModel.getOrderEntries()) { if (orderEntry instanceof LibraryOrderEntry && ((LibraryOrderEntry) orderEntry).isModuleLevel() && Comparing.equal(((LibraryOrderEntry) orderEntry).getLibrary(), library)) { ((LibraryOrderEntry) orderEntry).setExported(exported); break; } } }
private static int rearrangeOrderEntryOfType( ModifiableRootModel rootModel, Class<? extends OrderEntry> orderEntryClass) { OrderEntry[] orderEntries = rootModel.getOrderEntries(); int moduleSourcesIdx = 0; for (OrderEntry orderEntry : orderEntries) { if (orderEntryClass.isAssignableFrom(orderEntry.getClass())) { break; } moduleSourcesIdx++; } orderEntries = ArrayUtil.append(orderEntries, orderEntries[moduleSourcesIdx]); orderEntries = ArrayUtil.remove(orderEntries, moduleSourcesIdx); rootModel.rearrangeOrderEntries(orderEntries); return orderEntries.length - 1; }
public void readClasspath( ModifiableRootModel model, final Collection<String> unknownLibraries, Collection<String> unknownJdks, final Set<String> usedVariables, Set<String> refsToModules, final String testPattern, Element classpathElement) throws IOException, ConversionException { for (OrderEntry orderEntry : model.getOrderEntries()) { if (!(orderEntry instanceof ModuleSourceOrderEntry)) { model.removeOrderEntry(orderEntry); } } int idx = 0; for (Object o : classpathElement.getChildren(EclipseXml.CLASSPATHENTRY_TAG)) { try { readClasspathEntry( model, unknownLibraries, unknownJdks, usedVariables, refsToModules, testPattern, (Element) o, idx++, EclipseModuleManagerImpl.getInstance(model.getModule()), ((BasePathMacroManager) PathMacroManager.getInstance(model.getModule())) .getExpandMacroMap()); } catch (ConversionException e) { ErrorLog.rethrow(ErrorLog.Level.Warning, null, EclipseXml.CLASSPATH_FILE, e); } } if (!model.isSdkInherited() && model.getSdkName() == null) { EclipseModuleManagerImpl.getInstance(model.getModule()).setForceConfigureJDK(); model.inheritSdk(); } }