本文整理汇总了Java中com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProvider类的典型用法代码示例。如果您正苦于以下问题:Java IdeModifiableModelsProvider类的具体用法?Java IdeModifiableModelsProvider怎么用?Java IdeModifiableModelsProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IdeModifiableModelsProvider类属于com.intellij.openapi.externalSystem.service.project包,在下文中一共展示了IdeModifiableModelsProvider类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: importData
import com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProvider; //导入依赖的package包/类
/**
* This function is called after change in the build.gradle file or refresh gradle dependencies call.
* @param toImport the project dependencies
* @param projectData the project data
* @param project the current project
* @param modelsProvider contains the project modules
*/
@Override
public void importData(@NotNull Collection<DataNode<LibraryDependencyData>> toImport,
@Nullable ProjectData projectData,
@NotNull Project project,
@NotNull IdeModifiableModelsProvider modelsProvider) {
if (projectData == null || !projectData.getOwner().equals(GradleConstants.SYSTEM_ID)) {
return;
}
ScanManager scanManager = ScanManagerFactory.getScanManager(project);
if (scanManager == null) {
ScanManagerFactory scanManagerFactory = ServiceManager.getService(project, ScanManagerFactory.class);
scanManagerFactory.initScanManager(project);
scanManager = ScanManagerFactory.getScanManager(project);
if (scanManager == null) {
return;
}
MessageBus messageBus = ApplicationManager.getApplication().getMessageBus();
messageBus.syncPublisher(Events.ON_IDEA_FRAMEWORK_CHANGE).update();
}
if (GlobalSettings.getInstance().isCredentialsSet()) {
scanManager.asyncScanAndUpdateResults(true, toImport);
}
}
开发者ID:JFrogDev,项目名称:jfrog-idea-plugin,代码行数:32,代码来源:XrayDependencyDataService.java
示例2: createGlobalLibrary
import com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProvider; //导入依赖的package包/类
public void createGlobalLibrary(
@NotNull final IdeModifiableModelsProvider modifiableModelsProvider,
@NotNull final File libraryDirRoot,
@NotNull final String libraryName
) {
final LibraryTable.ModifiableModel libraryTableModifiableModel = modifiableModelsProvider
.getModifiableProjectLibrariesModel();
Library library = libraryTableModifiableModel.getLibraryByName(libraryName);
if (null == library) {
library = libraryTableModifiableModel.createLibrary(libraryName);
}
if (libraryTableModifiableModel instanceof LibrariesModifiableModel) {
final ExistingLibraryEditor existingLibraryEditor = ((LibrariesModifiableModel) libraryTableModifiableModel)
.getLibraryEditor(library);
existingLibraryEditor.addJarDirectory(
VfsUtil.getUrlForLibraryRoot(libraryDirRoot), true, OrderRootType.CLASSES
);
} else {
final Library.ModifiableModel libraryModifiableModel = modifiableModelsProvider
.getModifiableLibraryModel(library);
libraryModifiableModel.addJarDirectory(VfsUtil.getUrlForLibraryRoot(libraryDirRoot), true);
}
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:26,代码来源:OotbHybrisModuleDescriptor.java
示例3: configureDependencies
import com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProvider; //导入依赖的package包/类
@Override
public void configureDependencies(
final @NotNull HybrisProjectDescriptor hybrisProjectDescriptor,
final @NotNull IdeModifiableModelsProvider modifiableModelsProvider
) {
final Map<String, ModifiableFacetModel> modifiableFacetModelMap = ContainerUtil.newHashMap();
for (Module module : modifiableModelsProvider.getModules()) {
final ModifiableFacetModel modifiableFacetModel = modifiableModelsProvider.getModifiableFacetModel(module);
modifiableFacetModelMap.put(module.getName(), modifiableFacetModel);
}
for (HybrisModuleDescriptor moduleDescriptor : hybrisProjectDescriptor.getModulesChosenForImport()) {
configureFacetDependencies(moduleDescriptor, modifiableFacetModelMap);
}
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:17,代码来源:DefaultSpringConfigurator.java
示例4: addLibsToModule
import com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProvider; //导入依赖的package包/类
private void addLibsToModule(
@NotNull final ModifiableRootModel modifiableRootModel,
@NotNull IdeModifiableModelsProvider modifiableModelsProvider,
@NotNull final String libraryName,
final boolean export
) {
Validate.notNull(modifiableRootModel);
final LibraryTable.ModifiableModel libraryTableModifiableModel = modifiableModelsProvider
.getModifiableProjectLibrariesModel();
Library library = libraryTableModifiableModel.getLibraryByName(libraryName);
if (null == library) {
library = libraryTableModifiableModel.createLibrary(libraryName);
}
modifiableRootModel.addLibraryEntry(library);
if (export) {
setLibraryEntryExported(modifiableRootModel, library);
}
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:23,代码来源:DefaultLibRootsConfigurator.java
示例5: configure
import com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProvider; //导入依赖的package包/类
@Override
public void configure(
final @NotNull HybrisProjectDescriptor hybrisProjectDescriptor,
final @NotNull IdeModifiableModelsProvider modifiableModelsProvider
) {
final List<Module> modules = Arrays.asList(modifiableModelsProvider.getModules());
final Set<HybrisModuleDescriptor> extModules = hybrisProjectDescriptor
.getModulesChosenForImport()
.stream()
.filter(moduleDescriptor -> moduleDescriptor instanceof ExtHybrisModuleDescriptor)
.collect(Collectors.toSet());
for (final HybrisModuleDescriptor nextDescriptor : hybrisProjectDescriptor.getModulesChosenForImport()) {
findModuleByNameIgnoreCase(modules, nextDescriptor.getName())
.ifPresent(nextModule -> configureModuleDependencies(
nextDescriptor,
nextModule,
modules,
extModules,
modifiableModelsProvider
));
}
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:24,代码来源:DefaultModulesDependenciesConfigurator.java
示例6: configureModuleDependencies
import com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProvider; //导入依赖的package包/类
private void configureModuleDependencies(
@NotNull final HybrisModuleDescriptor moduleDescriptor,
@NotNull final Module module,
@NotNull final Collection<Module> allModules,
@NotNull final Set<HybrisModuleDescriptor> extModules,
final @NotNull IdeModifiableModelsProvider modifiableModelsProvider
) {
final ModifiableRootModel rootModel = modifiableModelsProvider.getModifiableRootModel(module);
for (HybrisModuleDescriptor dependency : moduleDescriptor.getDependenciesTree()) {
if (moduleDescriptor instanceof OotbHybrisModuleDescriptor) {
if (extModules.contains(dependency)) {
continue;
}
}
Optional<Module> targetDependencyModule = findModuleByNameIgnoreCase(allModules, dependency.getName());
final ModuleOrderEntry moduleOrderEntry = targetDependencyModule.isPresent()
? rootModel.addModuleOrderEntry(targetDependencyModule.get())
: rootModel.addInvalidModuleEntry(dependency.getName());
moduleOrderEntry.setExported(true);
moduleOrderEntry.setScope(DependencyScope.COMPILE);
}
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:26,代码来源:DefaultModulesDependenciesConfigurator.java
示例7: importData
import com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProvider; //导入依赖的package包/类
@Override
public void importData(@NotNull Collection<DataNode<ModuleDependencyData>> toImport,
@Nullable ProjectData projectData,
@NotNull Project project,
@NotNull IdeModifiableModelsProvider modelsProvider) {
MultiMap<DataNode<ModuleData>, DataNode<ModuleDependencyData>> byModule = ExternalSystemApiUtil.groupBy(toImport, MODULE);
for (Map.Entry<DataNode<ModuleData>, Collection<DataNode<ModuleDependencyData>>> entry : byModule.entrySet()) {
Module ideModule = modelsProvider.findIdeModule(entry.getKey().getData());
if (ideModule == null) {
LOG.warn(String.format(
"Can't import module dependencies %s. Reason: target module (%s) is not found at the ide and can't be imported",
entry.getValue(), entry.getKey()
));
continue;
}
importData(entry.getValue(), ideModule, modelsProvider);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:ModuleDependencyDataService.java
示例8: importData
import com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProvider; //导入依赖的package包/类
@Override
public void importData(@NotNull Collection<DataNode<ContentRootData>> toImport,
@Nullable ProjectData projectData,
@NotNull Project project,
@NotNull IdeModifiableModelsProvider modelsProvider) {
if (toImport.isEmpty()) {
return;
}
MultiMap<DataNode<ModuleData>, DataNode<ContentRootData>> byModule = ExternalSystemApiUtil.groupBy(toImport, ProjectKeys.MODULE);
for (Map.Entry<DataNode<ModuleData>, Collection<DataNode<ContentRootData>>> entry : byModule.entrySet()) {
Module module = modelsProvider.findIdeModule(entry.getKey().getData());
if (module == null) {
LOG.warn(String.format(
"Can't import content roots. Reason: target module (%s) is not found at the ide. Content roots: %s",
entry.getKey(), entry.getValue()
));
continue;
}
importData(modelsProvider, entry.getValue(), module);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:ContentRootDataService.java
示例9: removeData
import com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProvider; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public <E, I> void removeData(@NotNull Key<E> key,
@NotNull Collection<I> toRemove,
@NotNull final Collection<DataNode<E>> toIgnore,
@NotNull final ProjectData projectData,
@NotNull Project project,
@NotNull final IdeModifiableModelsProvider modelsProvider,
boolean synchronous) {
try {
List<ProjectDataService<?, ?>> services = myServices.getValue().get(key);
for (ProjectDataService service : services) {
final long removeStartTime = System.currentTimeMillis();
service.removeData(new Computable.PredefinedValueComputable<Collection>(toRemove), toIgnore, projectData, project, modelsProvider);
final long removeTimeInMs = System.currentTimeMillis() - removeStartTime;
LOG.debug(String.format("Service %s removed data in %d ms", service.getClass().getSimpleName(), removeTimeInMs));
}
commit(modelsProvider, project, synchronous, "Removed data");
}
catch (Throwable t) {
dispose(modelsProvider, project, synchronous);
ExceptionUtil.rethrowAllAsUnchecked(t);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:ProjectDataManager.java
示例10: importData
import com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProvider; //导入依赖的package包/类
@Override
public void importData(@NotNull Collection<DataNode<ProjectData>> toImport,
@Nullable ProjectData projectData,
@NotNull final Project project,
@NotNull IdeModifiableModelsProvider modelsProvider) {
// root project can be marked as ignored
if(toImport.isEmpty()) return;
if (toImport.size() != 1) {
throw new IllegalArgumentException(String.format("Expected to get a single project but got %d: %s", toImport.size(), toImport));
}
DataNode<ProjectData> node = toImport.iterator().next();
assert projectData == node.getData();
if (!ExternalSystemApiUtil.isOneToOneMapping(project, node)) {
return;
}
if (!project.getName().equals(projectData.getInternalName())) {
renameProject(projectData.getInternalName(), projectData.getOwner(), project);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:ProjectDataServiceImpl.java
示例11: importData
import com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProvider; //导入依赖的package包/类
@Override
public void importData(@NotNull Collection<DataNode<ModuleData>> toImport,
@Nullable ProjectData projectData,
@NotNull Project project,
@NotNull IdeModifiableModelsProvider modelsProvider) {
if (toImport.isEmpty()) {
return;
}
final Collection<DataNode<ModuleData>> toCreate = filterExistingModules(toImport, modelsProvider);
if (!toCreate.isEmpty()) {
createModules(toCreate, modelsProvider);
}
for (DataNode<ModuleData> node : toImport) {
Module module = modelsProvider.findIdeModule(node.getData());
if (module != null) {
syncPaths(module, modelsProvider, node.getData());
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ModuleDataService.java
示例12: filterExistingModules
import com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProvider; //导入依赖的package包/类
@NotNull
private static Collection<DataNode<ModuleData>> filterExistingModules(@NotNull Collection<DataNode<ModuleData>> modules,
@NotNull IdeModifiableModelsProvider modelsProvider)
{
Collection<DataNode<ModuleData>> result = ContainerUtilRt.newArrayList();
for (DataNode<ModuleData> node : modules) {
ModuleData moduleData = node.getData();
Module module = modelsProvider.findIdeModule(moduleData);
if (module == null) {
result.add(node);
}
else {
setModuleOptions(module, node);
}
}
return result;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:ModuleDataService.java
示例13: syncPaths
import com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProvider; //导入依赖的package包/类
private static void syncPaths(@NotNull final Module module, @NotNull IdeModifiableModelsProvider modelsProvider, @NotNull final ModuleData data) {
final ModifiableRootModel modifiableRootModel = modelsProvider.getModifiableRootModel(module);
CompilerModuleExtension extension = modifiableRootModel.getModuleExtension(CompilerModuleExtension.class);
if (extension == null) {
modifiableRootModel.dispose();
final String errorMsg =
String.format("Can't sync paths for module '%s'. Reason: no compiler extension is found for it", module.getName());
throw new RuntimeException(errorMsg);
}
String compileOutputPath = data.getCompileOutputPath(ExternalSystemSourceType.SOURCE);
if (compileOutputPath != null) {
extension.setCompilerOutputPath(VfsUtilCore.pathToUrl(compileOutputPath));
}
String testCompileOutputPath = data.getCompileOutputPath(ExternalSystemSourceType.TEST);
if (testCompileOutputPath != null) {
extension.setCompilerOutputPathForTests(VfsUtilCore.pathToUrl(testCompileOutputPath));
}
extension.inheritCompilerOutputPath(data.isInheritProjectCompileOutputPath());
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:ModuleDataService.java
示例14: computeOrphanData
import com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProvider; //导入依赖的package包/类
@NotNull
@Override
public Computable<Collection<Library>> computeOrphanData(@NotNull Collection<DataNode<LibraryData>> toImport,
@NotNull final ProjectData projectData,
@NotNull Project project,
@NotNull final IdeModifiableModelsProvider modelsProvider) {
return new Computable<Collection<Library>>() {
@Override
public Collection<Library> compute() {
final List<Library> orphanIdeLibraries = ContainerUtil.newSmartList();
final LibraryTable.ModifiableModel librariesModel = modelsProvider.getModifiableProjectLibrariesModel();
for (Library library : librariesModel.getLibraries()) {
if (!ExternalSystemApiUtil.isExternalSystemLibrary(library, projectData.getOwner())) continue;
if (isOrphanProjectLibrary(library, modelsProvider)) {
orphanIdeLibraries.add(library);
}
}
return orphanIdeLibraries;
}
};
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:LibraryDataService.java
示例15: removeData
import com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProvider; //导入依赖的package包/类
@Override
public void removeData(@NotNull final Computable<Collection<Library>> toRemoveComputable,
@NotNull Collection<DataNode<LibraryData>> toIgnore,
@NotNull ProjectData projectData,
@NotNull final Project project,
@NotNull final IdeModifiableModelsProvider modelsProvider) {
final Collection<Library> toRemove = toRemoveComputable.compute();
if (toRemove.isEmpty()) {
return;
}
final LibraryTable.ModifiableModel librariesModel = modelsProvider.getModifiableProjectLibrariesModel();
for (Library library : toRemove) {
String libraryName = library.getName();
if (libraryName != null) {
Library libraryToRemove = librariesModel.getLibraryByName(libraryName);
if (libraryToRemove != null) {
librariesModel.removeLibrary(libraryToRemove);
}
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:LibraryDataService.java
示例16: importData
import com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProvider; //导入依赖的package包/类
@Override
public void importData(@NotNull Collection<DataNode<LibraryDependencyData>> toImport,
@Nullable ProjectData projectData,
@NotNull Project project,
@NotNull IdeModifiableModelsProvider modelsProvider) {
if (toImport.isEmpty()) {
return;
}
MultiMap<DataNode<ModuleData>, DataNode<LibraryDependencyData>> byModule = ExternalSystemApiUtil.groupBy(toImport, MODULE);
for (Map.Entry<DataNode<ModuleData>, Collection<DataNode<LibraryDependencyData>>> entry : byModule.entrySet()) {
Module module = modelsProvider.findIdeModule(entry.getKey().getData());
if (module == null) {
LOG.warn(String.format(
"Can't import library dependencies %s. Reason: target module (%s) is not found at the ide and can't be imported",
entry.getValue(), entry.getKey()
));
continue;
}
importData(entry.getValue(), module, modelsProvider);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:LibraryDependencyDataService.java
示例17: importMissing
import com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProvider; //导入依赖的package包/类
private void importMissing(@NotNull IdeModifiableModelsProvider modelsProvider,
@NotNull Set<LibraryDependencyData> toImport,
@NotNull ModifiableRootModel moduleRootModel,
@NotNull LibraryTable moduleLibraryTable,
@NotNull Module module) {
for (final LibraryDependencyData dependencyData : toImport) {
final LibraryData libraryData = dependencyData.getTarget();
final String libraryName = libraryData.getInternalName();
switch (dependencyData.getLevel()) {
case MODULE:
final Library moduleLib = moduleLibraryTable.createLibrary(libraryName);
syncExistingLibraryDependency(modelsProvider, dependencyData, moduleLib, moduleRootModel, module);
break;
case PROJECT:
final Library projectLib = modelsProvider.getLibraryByName(libraryName);
if (projectLib == null) {
syncExistingLibraryDependency(modelsProvider, dependencyData, moduleLibraryTable.createLibrary(libraryName), moduleRootModel,
module);
break;
}
LibraryOrderEntry orderEntry = moduleRootModel.addLibraryEntry(projectLib);
setLibraryScope(orderEntry, projectLib, module, dependencyData);
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:LibraryDependencyDataService.java
示例18: removeUselessDependencies
import com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProvider; //导入依赖的package包/类
private static void removeUselessDependencies(ModifiableRootModel modifiableRootModel,
IdeModifiableModelsProvider modelsProvider, MavenProject mavenProject) {
for (OrderEntry entry : modifiableRootModel.getOrderEntries()) {
if (entry instanceof ModuleOrderEntry) {
final Module depModule = ((ModuleOrderEntry)entry).getModule();
if (depModule != null && AndroidMavenUtil.isExtApklibModule(depModule)) {
modifiableRootModel.removeOrderEntry(entry);
}
}
else if (entry instanceof LibraryOrderEntry) {
final LibraryOrderEntry libOrderEntry = (LibraryOrderEntry)entry;
if (containsDependencyOnApklibFile(libOrderEntry, modelsProvider) ||
pointsIntoUnpackedLibsDir(libOrderEntry, modelsProvider, mavenProject)) {
modifiableRootModel.removeOrderEntry(entry);
}
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:AndroidFacetImporterBase.java
示例19: pointsIntoUnpackedLibsDir
import com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProvider; //导入依赖的package包/类
private static boolean pointsIntoUnpackedLibsDir(@NotNull LibraryOrderEntry entry,
@NotNull IdeModifiableModelsProvider provider,
@NotNull MavenProject mavenProject) {
final Library library = entry.getLibrary();
if (library == null) {
return false;
}
final Library.ModifiableModel libraryModel = provider.getModifiableLibraryModel(library);
final String[] urls = libraryModel.getUrls(OrderRootType.CLASSES);
final String unpackedLibsDir = FileUtil.toCanonicalPath(mavenProject.getBuildDirectory()) + "/unpacked-libs";
for (String url : urls) {
if (VfsUtilCore.urlToPath(url).startsWith(unpackedLibsDir)) {
return true;
}
}
return false;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:AndroidFacetImporterBase.java
示例20: containsDependencyOnApklibFile
import com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProvider; //导入依赖的package包/类
private static boolean containsDependencyOnApklibFile(@NotNull LibraryOrderEntry libraryOrderEntry,
@NotNull IdeModifiableModelsProvider modelsProvider) {
final Library library = libraryOrderEntry.getLibrary();
if (library == null) {
return false;
}
final Library.ModifiableModel libraryModel = modelsProvider.getModifiableLibraryModel(library);
final String[] urls = libraryModel.getUrls(OrderRootType.CLASSES);
for (String url : urls) {
final String fileName = PathUtil.getFileName(PathUtil.toPresentableUrl(url));
if (FileUtilRt.extensionEquals(fileName, "apklib")) {
return true;
}
}
return false;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:AndroidFacetImporterBase.java
注:本文中的com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProvider类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论