com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProvider Java Examples
The following examples show how to use
com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProvider.
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: 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 #2
Source File: QuarkusProjectDataService.java From intellij-quarkus with Eclipse Public License 2.0 | 5 votes |
@Override public void importData(@NotNull Collection<DataNode<LibraryDependencyData>> toImport, @Nullable ProjectData projectData, @NotNull Project project, @NotNull IdeModifiableModelsProvider modelsProvider) { for(DataNode<LibraryDependencyData> libraryNode : toImport) { String name = libraryNode.getData().getExternalName(); if (name.startsWith("io.quarkus:")) { Module module = modelsProvider.findIdeModule(libraryNode.getData().getOwnerModule()); if (module != null) { ensureQuarkusFacet(module, modelsProvider, libraryNode.getData().getOwner()); } } } }
Example #3
Source File: QuarkusProjectDataService.java From intellij-quarkus with Eclipse Public License 2.0 | 5 votes |
private static void ensureQuarkusFacet(Module module, IdeModifiableModelsProvider modelsProvider, ProjectSystemId externalSystemId) { FacetType<QuarkusFacet, QuarkusFacetConfiguration> facetType = QuarkusFacet.getQuarkusFacetType(); ModifiableFacetModel facetModel = modelsProvider.getModifiableFacetModel(module); QuarkusFacet facet = facetModel.getFacetByType(facetType.getId()); if (facet == null) { facet = facetType.createFacet(module, facetType.getDefaultFacetName(), facetType.createDefaultConfiguration(), (Facet)null); facetModel.addFacet(facet, ExternalSystemApiUtil.toExternalSource(externalSystemId)); } }
Example #4
Source File: MavenImporter.java From intellij-spring-assistant with MIT License | 5 votes |
@Override public void process(IdeModifiableModelsProvider ideModifiableModelsProvider, Module module, MavenRootModelAdapter mavenRootModelAdapter, MavenProjectsTree mavenProjectsTree, MavenProject mavenProject, MavenProjectChanges mavenProjectChanges, Map<MavenProject, String> map, List<MavenProjectsProcessorTask> processorTasks) { String skip = this.findConfigValue(mavenProject, "skip"); if (!"true".equals(skip)) { processorTasks.add(new MavenProcessorTask(module)); } else { debug(() -> log.debug( "Skipping index check for project " + module.getProject().getName() + " & module " + module.getName())); } }
Example #5
Source File: PantsMetadataService.java From intellij-pants-plugin with Apache License 2.0 | 5 votes |
@NotNull @Override public Computable<Collection<Module>> computeOrphanData( @NotNull Collection<DataNode<TargetMetadata>> toImport, @NotNull ProjectData projectData, @NotNull Project project, @NotNull IdeModifiableModelsProvider modelsProvider ) { return Collections::emptyList; }
Example #6
Source File: PantsMetadataService.java From intellij-pants-plugin with Apache License 2.0 | 5 votes |
@Override public void removeData( @NotNull Computable<Collection<Module>> toRemove, @NotNull Collection<DataNode<TargetMetadata>> toIgnore, @NotNull ProjectData projectData, @NotNull Project project, @NotNull IdeModifiableModelsProvider modelsProvider ) { for (Module module : toRemove.compute()) { module.clearOption(PantsConstants.PANTS_TARGET_ADDRESSES_KEY); } }
Example #7
Source File: PantsPythonSetupDataService.java From intellij-pants-plugin with Apache License 2.0 | 5 votes |
@NotNull @Override public Computable<Collection<Module>> computeOrphanData( @NotNull Collection<DataNode<PythonSetupData>> toImport, @NotNull ProjectData projectData, @NotNull Project project, @NotNull IdeModifiableModelsProvider modelsProvider ) { return new Computable<Collection<Module>>() { @Override public Collection<Module> compute() { return Collections.emptyList(); } }; }
Example #8
Source File: PantsPythonSetupDataService.java From intellij-pants-plugin with Apache License 2.0 | 5 votes |
@Override public void removeData( @NotNull Computable<Collection<Module>> toRemove, @NotNull Collection<DataNode<PythonSetupData>> toIgnore, @NotNull ProjectData projectData, @NotNull Project project, @NotNull IdeModifiableModelsProvider modelsProvider ) { }
Example #9
Source File: QuarkusMavenLibraryImporter.java From intellij-quarkus with Eclipse Public License 2.0 | 4 votes |
@Override public void preProcess(Module module, MavenProject mavenProject, MavenProjectChanges changes, IdeModifiableModelsProvider modifiableModelsProvider) { }
Example #10
Source File: QuarkusMavenLibraryImporter.java From intellij-quarkus with Eclipse Public License 2.0 | 4 votes |
@Override public void process(IdeModifiableModelsProvider modifiableModelsProvider, Module module, MavenRootModelAdapter rootModel, MavenProjectsTree mavenModel, MavenProject mavenProject, MavenProjectChanges changes, Map<MavenProject, String> mavenProjectToModuleName, List<MavenProjectsProcessorTask> postTasks) { postTasks.add(new QuarkusMavenProjectsProcessTask(module)); }
Example #11
Source File: MavenImporter.java From intellij-spring-assistant with MIT License | 4 votes |
@Override public void preProcess(Module module, MavenProject mavenProject, MavenProjectChanges mavenProjectChanges, IdeModifiableModelsProvider ideModifiableModelsProvider) { }
Example #12
Source File: PantsPythonSetupDataService.java From intellij-pants-plugin with Apache License 2.0 | 4 votes |
@Override public void importData( @NotNull final Collection<DataNode<PythonSetupData>> toImport, @Nullable ProjectData projectData, @NotNull Project project, @NotNull final IdeModifiableModelsProvider modelsProvider ) { final Set<PythonInterpreterInfo> interpreters = ContainerUtil.map2Set( toImport, node -> node.getData().getInterpreterInfo() ); if (interpreters.isEmpty()) { return; } final Map<PythonInterpreterInfo, Sdk> interpreter2sdk = new HashMap<>(); /** * TODO(yic): to move it to a thread appropriate place. * * 1) testPyTestRunConfiguration(com.twitter.intellij.pants.execution.OSSPantsPythonRunConfigurationIntegrationTest) * com.intellij.testFramework.LoggedErrorProcessor$TestLoggerAssertionError: Can't update SDK under write action, not allowed in background */ //ExternalSystemApiUtil.executeProjectChangeAction(false, new DisposeAwareProjectChange(project) { // @Override // public void execute() { // for (final PythonInterpreterInfo interpreterInfo : interpreters) { // //final String binFolder = PathUtil.getParentPath(interpreter); // //final String interpreterHome = PathUtil.getParentPath(binFolder); // final String interpreter = interpreterInfo.getBinary(); // Sdk pythonSdk = PythonSdkType.findSdkByPath(interpreter); // if (pythonSdk == null) { // final ProjectJdkTable jdkTable = ProjectJdkTable.getInstance(); // pythonSdk = jdkTable.createSdk(PathUtil.getFileName(interpreter), PythonSdkType.getInstance()); // jdkTable.addJdk(pythonSdk); // final SdkModificator modificator = pythonSdk.getSdkModificator(); // modificator.setHomePath(interpreter); // modificator.commitChanges(); // PythonSdkType.getInstance().setupSdkPaths(pythonSdk); // } // interpreter2sdk.put(interpreterInfo, pythonSdk); // } // } //}); for (DataNode<PythonSetupData> dataNode : toImport) { final PythonSetupData pythonSetupData = dataNode.getData(); final Sdk pythonSdk = interpreter2sdk.get(pythonSetupData.getInterpreterInfo()); final Module module = modelsProvider.findIdeModule(pythonSetupData.getOwnerModuleData()); if (module == null) { return; } FacetManager facetManager = FacetManager.getInstance(module); PythonFacet facet = facetManager.getFacetByType(PythonFacetType.getInstance().getId()); if (facet == null) { facet = facetManager.createFacet(PythonFacetType.getInstance(), "Python", null); facet.getConfiguration().setSdk(pythonSdk); final ModifiableFacetModel facetModel = modelsProvider.getModifiableFacetModel(module); facetModel.addFacet(facet); TestRunnerService.getInstance(module).setProjectConfiguration("py.test"); } } }
Example #13
Source File: QuarkusFacetMavenImporter.java From intellij-quarkus with Eclipse Public License 2.0 | 2 votes |
@Override protected void reimportFacet(IdeModifiableModelsProvider ideModifiableModelsProvider, Module module, MavenRootModelAdapter mavenRootModelAdapter, QuarkusFacet quarkusFacet, MavenProjectsTree mavenProjectsTree, MavenProject mavenProject, MavenProjectChanges mavenProjectChanges, Map<MavenProject, String> map, List<MavenProjectsProcessorTask> list) { }