void (ClasspathPanel classpathPanel, OrderEntry entry, Predicate<? super OrderEntry> dependencyEntryFilter) { if (!(entry instanceof ModuleOrderEntry entryToInline)) return; Module module = entryToInline.getModule(); if (module == null) return; ModifiableRootModel model = classpathPanel.getRootModel(); int toInlineIndex = findModuleEntryIndex(model, module); if (toInlineIndex == -1) return; model.removeOrderEntry(entryToInline); ModifiableRootModel modelImpl; if (Proxy.isProxyClass(model.getClass())) { modelImpl = (ModifiableRootModel)((ModuleEditor.ProxyDelegateAccessor)Proxy.getInvocationHandler(model)).getDelegate(); } else { modelImpl = model; } int addedCount = 0; ModuleRootModel otherModel = classpathPanel.getModuleConfigurationState().getModulesProvider().getRootModel(module); ProjectRootManagerImpl rootManager = ProjectRootManagerImpl.getInstanceImpl(classpathPanel.getProject()); VirtualFilePointerManager virtualFilePointerManager = VirtualFilePointerManager.getInstance(); for (OrderEntry depEntry : otherModel.getOrderEntries()) { if (dependencyEntryFilter.test(depEntry)) { LOG.assertTrue(depEntry instanceof ClonableOrderEntry, depEntry); ExportableOrderEntry entryToCopy = (ExportableOrderEntry)depEntry; model.addOrderEntry(((ClonableOrderEntry)depEntry).cloneEntry(modelImpl, rootManager, virtualFilePointerManager)); ExportableOrderEntry cloned = (ExportableOrderEntry)ArrayUtil.getLastElement(model.getOrderEntries()); cloned.setExported(entryToInline.isExported() && entryToCopy.isExported()); cloned.setScope(OrderEntryUtil.intersectScopes(entryToInline.getScope(), entryToCopy.getScope())); addedCount++; } } OrderEntry[] oldEntries = model.getOrderEntries(); OrderEntry[] newEntries = new OrderEntry[oldEntries.length]; System.arraycopy(oldEntries, 0, newEntries, 0, toInlineIndex); System.arraycopy(oldEntries, oldEntries.length - addedCount, newEntries, toInlineIndex, addedCount); System.arraycopy(oldEntries, toInlineIndex, newEntries, toInlineIndex + addedCount, oldEntries.length - toInlineIndex - addedCount); model.rearrangeOrderEntries(newEntries); StructureConfigurableContext context = ProjectStructureConfigurable.getInstance(classpathPanel.getProject()).getContext(); context.getDaemonAnalyzer().queueUpdate(new ModuleProjectStructureElement(context, module)); }