com.intellij.openapi.roots.ModuleOrderEntry Java Examples
The following examples show how to use
com.intellij.openapi.roots.ModuleOrderEntry.
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: ModuleDeleteProvider.java From consulo with Apache License 2.0 | 6 votes |
public static void removeModule(@Nonnull final Module moduleToRemove, @Nullable ModifiableRootModel modifiableRootModelToRemove, @Nonnull Collection<ModifiableRootModel> otherModuleRootModels, @Nonnull final ModifiableModuleModel moduleModel) { // remove all dependencies on the module that is about to be removed for (final ModifiableRootModel modifiableRootModel : otherModuleRootModels) { final OrderEntry[] orderEntries = modifiableRootModel.getOrderEntries(); for (final OrderEntry orderEntry : orderEntries) { if (orderEntry instanceof ModuleOrderEntry && orderEntry.isValid()) { final Module orderEntryModule = ((ModuleOrderEntry)orderEntry).getModule(); if (orderEntryModule != null && orderEntryModule.equals(moduleToRemove)) { modifiableRootModel.removeOrderEntry(orderEntry); } } } } // destroyProcess editor if (modifiableRootModelToRemove != null) { modifiableRootModelToRemove.dispose(); } // destroyProcess module moduleModel.disposeModule(moduleToRemove); }
Example #2
Source File: NavBarPresentation.java From consulo with Apache License 2.0 | 6 votes |
@SuppressWarnings("MethodMayBeStatic") @Nullable public Icon getIcon(final Object object) { if (!NavBarModel.isValid(object)) return null; if (object instanceof Project) return AllIcons.Nodes.ProjectTab; if (object instanceof Module) return AllIcons.Nodes.Module; try { if (object instanceof PsiElement) { Icon icon = TargetAWT.to(AccessRule.read(() -> ((PsiElement)object).isValid() ? IconDescriptorUpdaters.getIcon(((PsiElement)object), 0) : null)); if (icon != null && (icon.getIconHeight() > JBUI.scale(16) || icon.getIconWidth() > JBUI.scale(16))) { icon = IconUtil.cropIcon(icon, JBUI.scale(16), JBUI.scale(16)); } return icon; } } catch (IndexNotReadyException e) { return null; } if (object instanceof ModuleExtensionWithSdkOrderEntry) { return TargetAWT.to(SdkUtil.getIcon(((ModuleExtensionWithSdkOrderEntry)object).getSdk())); } if (object instanceof LibraryOrderEntry) return AllIcons.Nodes.PpLibFolder; if (object instanceof ModuleOrderEntry) return AllIcons.Nodes.Module; return null; }
Example #3
Source File: ModuleSourceItemGroup.java From consulo with Apache License 2.0 | 5 votes |
private static void collectDependentModules(final Module module, Set<Module> modules, ArtifactEditorContext context) { if (!modules.add(module)) return; for (OrderEntry entry : context.getModulesProvider().getRootModel(module).getOrderEntries()) { if (entry instanceof ModuleOrderEntry) { final ModuleOrderEntry moduleEntry = (ModuleOrderEntry)entry; final Module dependency = moduleEntry.getModule(); final DependencyScope scope = moduleEntry.getScope(); if (dependency != null && scope.isForProductionRuntime()) { collectDependentModules(dependency, modules, context); } } } }
Example #4
Source File: MavenImportingTestCase.java From intellij-quarkus with Eclipse Public License 2.0 | 4 votes |
protected void assertModuleModuleDeps(String moduleName, String... expectedDeps) { assertModuleDeps(moduleName, ModuleOrderEntry.class, expectedDeps); }
Example #5
Source File: MavenImportingTestCase.java From intellij-quarkus with Eclipse Public License 2.0 | 4 votes |
protected void assertModuleModuleDepScope(String moduleName, String depName, DependencyScope scope) { ModuleOrderEntry dep = getModuleModuleDep(moduleName, depName); assertEquals(scope, dep.getScope()); }
Example #6
Source File: MavenImportingTestCase.java From intellij-quarkus with Eclipse Public License 2.0 | 4 votes |
private ModuleOrderEntry getModuleModuleDep(String moduleName, String depName) { return getModuleDep(moduleName, depName, ModuleOrderEntry.class); }