Java Code Examples for com.intellij.openapi.module.Module#setOption()
The following examples show how to use
com.intellij.openapi.module.Module#setOption() .
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: ModuleEditorImpl.java From intellij with Apache License 2.0 | 6 votes |
@Override public Module createModule(String moduleName, ModuleType moduleType) { Module module = moduleModel.findModuleByName(moduleName); if (module == null) { File imlFile = new File(imlDirectory, moduleName + ModuleFileType.DOT_DEFAULT_EXTENSION); removeImlFile(imlFile); module = moduleModel.newModule(imlFile.getPath(), moduleType.getId()); module.setOption(EXTERNAL_SYSTEM_ID_KEY, EXTERNAL_SYSTEM_ID_VALUE); } module.setOption(Module.ELEMENT_TYPE, moduleType.getId()); ModifiableRootModel modifiableModel = ModuleRootManager.getInstance(module).getModifiableModel(); modules.put(module.getName(), modifiableModel); modifiableModel.clear(); modifiableModel.inheritSdk(); CompilerModuleExtension compilerSettings = modifiableModel.getModuleExtension(CompilerModuleExtension.class); if (compilerSettings != null) { compilerSettings.inheritCompilerOutputPath(false); } return module; }
Example 2
Source File: PantsMetadataService.java From intellij-pants-plugin with Apache License 2.0 | 6 votes |
@Override public void importData( @NotNull final Collection<DataNode<TargetMetadata>> toImport, @Nullable ProjectData projectData, @NotNull Project project, @NotNull IdeModifiableModelsProvider modelsProvider ) { // for existing projects. for new projects PantsSettings.defaultSettings will provide the version. PantsSettings.getInstance(project).setResolverVersion(PantsResolver.VERSION); for (DataNode<TargetMetadata> node : toImport) { final TargetMetadata metadata = node.getData(); final Module module = modelsProvider.findIdeModule(metadata.getModuleName()); if (module != null) { module.setOption(PantsConstants.PANTS_LIBRARY_EXCLUDES_KEY, PantsUtil.dehydrateTargetAddresses(metadata.getLibraryExcludes())); module.setOption(PantsConstants.PANTS_TARGET_ADDRESSES_KEY, PantsUtil.dehydrateTargetAddresses(metadata.getTargetAddresses())); module.setOption(PantsConstants.PANTS_TARGET_ADDRESS_INFOS_KEY, gson.toJson(metadata.getTargetAddressInfoSet())); module.setOption(PantsConstants.PANTS_OPTION_LINKED_PROJECT_PATH, Paths.get(projectData.getLinkedExternalProjectPath()).normalize().toString()); ExternalSystemModulePropertyManager.getInstance(module).setExternalModuleType(PantsConstants.PANTS_TARGET_MODULE_TYPE); } } }
Example 3
Source File: IntelliJRunnerAddressInvocationTest.java From intellij-pants-plugin with Apache License 2.0 | 5 votes |
private Module createModuleWithSerializedAddresses(String path, Set addresses) { Module module = ModuleManager.getInstance(myProject).newModule(path, ModuleTypeId.JAVA_MODULE); // Make it a Pants module module.setOption(ExternalSystemConstants.EXTERNAL_SYSTEM_ID_KEY, PantsConstants.SYSTEM_ID.getId()); module.setOption(PantsConstants.PANTS_TARGET_ADDRESSES_KEY, PantsUtil.dehydrateTargetAddresses(addresses) ); return module; }
Example 4
Source File: FlutterModuleUtils.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 4 votes |
/** * Set the passed module to the module type used by Flutter, defined by {@link #getModuleTypeIDForFlutter()}. */ public static void setFlutterModuleType(@NotNull Module module) { module.setOption(Module.ELEMENT_TYPE, getModuleTypeIDForFlutter()); }
Example 5
Source File: FlutterModuleUtils.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 4 votes |
/** * Set the passed module to the module type used by Flutter, defined by {@link #getModuleTypeIDForFlutter()}. */ public static void setFlutterModuleType(@NotNull Module module) { module.setOption(Module.ELEMENT_TYPE, getModuleTypeIDForFlutter()); }