当前位置: 首页>>代码示例>>Java>>正文


Java DataNode.createChild方法代码示例

本文整理汇总了Java中com.intellij.openapi.externalSystem.model.DataNode.createChild方法的典型用法代码示例。如果您正苦于以下问题:Java DataNode.createChild方法的具体用法?Java DataNode.createChild怎么用?Java DataNode.createChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.externalSystem.model.DataNode的用法示例。


在下文中一共展示了DataNode.createChild方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testPopulateModuleContentRootsWithAndroidProject

import com.intellij.openapi.externalSystem.model.DataNode; //导入方法依赖的package包/类
public void testPopulateModuleContentRootsWithAndroidProject() {
  ProjectData project = myProjectResolver.createProject();
  DataNode<ProjectData> projectNode = new DataNode<ProjectData>(ProjectKeys.PROJECT, project, null);
  ModuleData module = myProjectResolver.createModule(myAndroidModule, project);
  DataNode<ModuleData> moduleDataNode = projectNode.createChild(ProjectKeys.MODULE, module);

  myProjectResolver.populateModuleContentRoots(myAndroidModule, moduleDataNode);

  // Verify module has IdeaAndroidProject.
  Collection<DataNode<IdeaAndroidProject>> androidProjects =
    ExternalSystemApiUtil.getChildren(moduleDataNode, AndroidProjectKeys.IDE_ANDROID_PROJECT);
  assertEquals(1, androidProjects.size());
  DataNode<IdeaAndroidProject> androidProjectNode = ContainerUtil.getFirstItem(androidProjects);
  assertNotNull(androidProjectNode);
  assertSame(myAndroidProject, androidProjectNode.getData().getDelegate());

  // Verify module has IdeaGradleProject.
  Collection<DataNode<IdeaGradleProject>> gradleProjects =
    ExternalSystemApiUtil.getChildren(moduleDataNode, AndroidProjectKeys.IDE_GRADLE_PROJECT);
  assertEquals(1, gradleProjects.size());
  DataNode<IdeaGradleProject> gradleProjectNode = ContainerUtil.getFirstItem(gradleProjects);
  assertNotNull(gradleProjectNode);
  assertEquals(myAndroidModule.getGradleProject().getPath(), gradleProjectNode.getData().getGradlePath());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:AndroidGradleProjectResolverIdeaTest.java

示例2: testPopulateModuleContentRootsWithJavaProject

import com.intellij.openapi.externalSystem.model.DataNode; //导入方法依赖的package包/类
public void testPopulateModuleContentRootsWithJavaProject() {
  ProjectData project = myProjectResolver.createProject();
  DataNode<ProjectData> projectNode = new DataNode<ProjectData>(ProjectKeys.PROJECT, project, null);
  ModuleData module = myProjectResolver.createModule(myUtilModule, project);
  DataNode<ModuleData> moduleDataNode = projectNode.createChild(ProjectKeys.MODULE, module);

  myProjectResolver.populateModuleContentRoots(myUtilModule, moduleDataNode);

  // Verify module does not have IdeaAndroidProject.
  Collection<DataNode<IdeaAndroidProject>> androidProjects =
    ExternalSystemApiUtil.getChildren(moduleDataNode, AndroidProjectKeys.IDE_ANDROID_PROJECT);
  assertEquals(0, androidProjects.size());

  // Verify module has IdeaGradleProject.
  Collection<DataNode<IdeaGradleProject>> gradleProjects =
    ExternalSystemApiUtil.getChildren(moduleDataNode, AndroidProjectKeys.IDE_GRADLE_PROJECT);
  assertEquals(1, gradleProjects.size());
  DataNode<IdeaGradleProject> gradleProjectNode = ContainerUtil.getFirstItem(gradleProjects);
  assertNotNull(gradleProjectNode);
  assertEquals(myUtilModule.getGradleProject().getPath(), gradleProjectNode.getData().getGradlePath());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:AndroidGradleProjectResolverIdeaTest.java

示例3: populateModuleExtraModels

import com.intellij.openapi.externalSystem.model.DataNode; //导入方法依赖的package包/类
@Override
public void populateModuleExtraModels(@NotNull IdeaModule gradleModule, @NotNull DataNode<ModuleData> ideModule) {
  final List<War> warModels;
  final WebConfiguration webConfiguration = resolverCtx.getExtraProject(gradleModule, WebConfiguration.class);
  if (webConfiguration != null) {
    warModels = ContainerUtil.map(webConfiguration.getWarModels(), new Function<WebConfiguration.WarModel, War>() {
        @Override
        public War fun(WebConfiguration.WarModel model) {
          War war = new War(model.getWarName(), model.getWebAppDirName(), model.getWebAppDir());
          war.setWebXml(model.getWebXml());
          war.setWebResources(map(model.getWebResources()));
          war.setClasspath(model.getClasspath());
          war.setManifestContent(model.getManifestContent());
          return war;
        }
      });
    ideModule.createChild(WebConfigurationModelData.KEY, new WebConfigurationModelData(GradleConstants.SYSTEM_ID, warModels));
  }
  nextResolver.populateModuleExtraModels(gradleModule, ideModule);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:JavaEEGradleProjectResolverExtension.java

示例4: populateModuleExtraModels

import com.intellij.openapi.externalSystem.model.DataNode; //导入方法依赖的package包/类
@Override
public void populateModuleExtraModels(@NotNull IdeaModule gradleModule, @NotNull DataNode<ModuleData> ideModule) {
  final BuildScriptClasspathModel buildScriptClasspathModel = resolverCtx.getExtraProject(gradleModule, BuildScriptClasspathModel.class);
  final List<BuildScriptClasspathData.ClasspathEntry> classpathEntries;
  if (buildScriptClasspathModel != null) {
    classpathEntries = ContainerUtil
      .map(buildScriptClasspathModel.getClasspath(), new Function<ClasspathEntryModel, BuildScriptClasspathData.ClasspathEntry>() {
        @Override
        public BuildScriptClasspathData.ClasspathEntry fun(ClasspathEntryModel model) {
          return new BuildScriptClasspathData.ClasspathEntry(model.getClasses(), model.getSources(), model.getJavadoc());
        }
      });
  }
  else {
    classpathEntries = ContainerUtil.emptyList();
  }
  BuildScriptClasspathData buildScriptClasspathData = new BuildScriptClasspathData(GradleConstants.SYSTEM_ID, classpathEntries);
  ideModule.createChild(BuildScriptClasspathData.KEY, buildScriptClasspathData);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:BaseGradleProjectResolverExtension.java

示例5: createJavaProject

import com.intellij.openapi.externalSystem.model.DataNode; //导入方法依赖的package包/类
private void createJavaProject(@NotNull IdeaModule gradleModule,
                               @NotNull DataNode<ModuleData> ideModule,
                               boolean androidProjectWithoutVariants) {
  ModuleExtendedModel model = resolverCtx.getExtraProject(gradleModule, ModuleExtendedModel.class);
  IdeaJavaProject javaProject = newJavaProject(gradleModule, model, androidProjectWithoutVariants);
  ideModule.createChild(IDE_JAVA_PROJECT, javaProject);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:AndroidGradleProjectResolver.java

示例6: createModule

import com.intellij.openapi.externalSystem.model.DataNode; //导入方法依赖的package包/类
@NotNull
private static DataNode<ModuleData> createModule(@NotNull String name, boolean isGradleProject) {
  String path = "~/project/" + name;
  ModuleData data = new ModuleData(name, GradleConstants.SYSTEM_ID, StdModuleTypes.JAVA.getId(), name, path, path);
  DataNode<ModuleData> module = new DataNode<ModuleData>(MODULE, data, null);
  if (isGradleProject) {
    List<String> taskNames = Collections.emptyList();
    module.createChild(IDE_GRADLE_PROJECT, new IdeaGradleProject("app", taskNames, ":" + name, null, null));
  }
  return module;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:ModulesToImportDialogTest.java

示例7: populateModuleExtraModels

import com.intellij.openapi.externalSystem.model.DataNode; //导入方法依赖的package包/类
@Override
public void populateModuleExtraModels(@NotNull IdeaModule gradleModule, @NotNull DataNode<ModuleData> ideModule) {
  ScalaModel scalaModel = resolverCtx.getExtraProject(gradleModule, ScalaModel.class);
  if (scalaModel != null) {
    ScalaModelData scalaModelData = create(scalaModel);
    ideModule.createChild(ScalaModelData.KEY, scalaModelData);
  }

  nextResolver.populateModuleExtraModels(gradleModule, ideModule);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:ScalaGradleProjectResolverExtension.java

示例8: populateProjectExtraModels

import com.intellij.openapi.externalSystem.model.DataNode; //导入方法依赖的package包/类
@Override
public void populateProjectExtraModels(@NotNull IdeaProject gradleProject, @NotNull DataNode<ProjectData> ideProject) {
  final ExternalProject externalProject = resolverCtx.getExtraProject(ExternalProject.class);
  if (externalProject != null) {
    ideProject.createChild(ExternalProjectDataService.KEY, externalProject);
    ideProject.getData().setDescription(externalProject.getDescription());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:BaseGradleProjectResolverExtension.java

示例9: populateModuleContentRoots

import com.intellij.openapi.externalSystem.model.DataNode; //导入方法依赖的package包/类
@Override
public void populateModuleContentRoots(@NotNull IdeaModule gradleModule, @NotNull DataNode<ModuleData> ideModule) {
  ImportedModule importedModule = new ImportedModule(gradleModule);
  ideModule.createChild(AndroidProjectKeys.IMPORTED_MODULE, importedModule);

  GradleProject gradleProject = gradleModule.getGradleProject();
  GradleScript buildScript = null;
  try {
    buildScript = gradleProject.getBuildScript();
  } catch (UnsupportedOperationException ignore) {}

  if (buildScript == null || !inAndroidGradleProject(gradleModule)) {
    nextResolver.populateModuleContentRoots(gradleModule, ideModule);
    return;
  }

  File moduleFilePath = new File(toSystemDependentName(ideModule.getData().getModuleFilePath()));
  File moduleRootDirPath = moduleFilePath.getParentFile();

  AndroidProject androidProject = resolverCtx.getExtraProject(gradleModule, AndroidProject.class);

  boolean androidProjectWithoutVariants = false;
  if (androidProject != null) {
    Variant selectedVariant = getVariantToSelect(androidProject);
    if (selectedVariant == null) {
      // If an Android project does not have variants, it would be impossible to build. This is a possible but invalid use case.
      // For now we are going to treat this case as a Java library module, because everywhere in the IDE (e.g. run configurations,
      // editors, test support, variants tool window, project building, etc.) we have the assumption that there is at least one variant
      // per Android project, and changing that in the code base is too risky, for very little benefit.
      // See https://code.google.com/p/android/issues/detail?id=170722
      androidProjectWithoutVariants = true;
    }
    else {
      IdeaAndroidProject ideaAndroidProject = new IdeaAndroidProject(GRADLE_SYSTEM_ID, gradleModule.getName(), moduleRootDirPath,
                                                                     androidProject, selectedVariant.getName(), DEFAULT_TEST_ARTIFACT);
      ideModule.createChild(IDE_ANDROID_PROJECT, ideaAndroidProject);
    }
  }

  File gradleSettingsFile = new File(moduleRootDirPath, FN_SETTINGS_GRADLE);
  if (gradleSettingsFile.isFile() && androidProject == null) {
    // This is just a root folder for a group of Gradle projects. We don't set an IdeaGradleProject so the JPS builder won't try to
    // compile it using Gradle. We still need to create the module to display files inside it.
    createJavaProject(gradleModule, ideModule, false);
    return;
  }

  BuildScriptClasspathModel buildScriptModel = resolverCtx.getExtraProject(BuildScriptClasspathModel.class);
  String gradleVersion = buildScriptModel != null ? buildScriptModel.getGradleVersion() : null;

  File buildFilePath = buildScript.getSourceFile();
  IdeaGradleProject ideaGradleProject = newIdeaGradleProject(gradleModule.getName(), gradleProject, buildFilePath, gradleVersion);
  ideModule.createChild(IDE_GRADLE_PROJECT, ideaGradleProject);

  if (androidProject == null || androidProjectWithoutVariants) {
    // This is a Java lib module.
    createJavaProject(gradleModule, ideModule, androidProjectWithoutVariants);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:60,代码来源:AndroidGradleProjectResolver.java

示例10: populateModuleContentRoots

import com.intellij.openapi.externalSystem.model.DataNode; //导入方法依赖的package包/类
@Override
public void populateModuleContentRoots(@NotNull IdeaModule gradleModule,
                                       @NotNull DataNode<ModuleData> ideModule) {
  DomainObjectSet<? extends IdeaContentRoot> contentRoots;
  ModuleExtendedModel moduleExtendedModel = resolverCtx.getExtraProject(gradleModule, ModuleExtendedModel.class);
  if (moduleExtendedModel != null) {
    contentRoots = moduleExtendedModel.getContentRoots();
  }
  else {
    contentRoots = gradleModule.getContentRoots();
  }

  if (contentRoots == null) {
    return;
  }
  for (IdeaContentRoot gradleContentRoot : contentRoots) {
    if (gradleContentRoot == null) continue;

    File rootDirectory = gradleContentRoot.getRootDirectory();
    if (rootDirectory == null) continue;

    ContentRootData ideContentRoot = new ContentRootData(GradleConstants.SYSTEM_ID, rootDirectory.getAbsolutePath());
    ideModule.getData().setModuleFileDirectoryPath(ideContentRoot.getRootPath());
    populateContentRoot(ideContentRoot, ExternalSystemSourceType.SOURCE, gradleContentRoot.getSourceDirectories());
    populateContentRoot(ideContentRoot, ExternalSystemSourceType.TEST, gradleContentRoot.getTestDirectories());

    if (gradleContentRoot instanceof ExtIdeaContentRoot) {
      ExtIdeaContentRoot extIdeaContentRoot = (ExtIdeaContentRoot)gradleContentRoot;
      populateContentRoot(ideContentRoot, ExternalSystemSourceType.RESOURCE, extIdeaContentRoot.getResourceDirectories());
      populateContentRoot(ideContentRoot, ExternalSystemSourceType.TEST_RESOURCE, extIdeaContentRoot.getTestResourceDirectories());
    }

    Set<File> excluded = gradleContentRoot.getExcludeDirectories();
    if (excluded != null) {
      for (File file : excluded) {
        ideContentRoot.storePath(ExternalSystemSourceType.EXCLUDED, file.getAbsolutePath());
      }
    }
    ideModule.createChild(ProjectKeys.CONTENT_ROOT, ideContentRoot);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:42,代码来源:BaseGradleProjectResolverExtension.java


注:本文中的com.intellij.openapi.externalSystem.model.DataNode.createChild方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。