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


Java ProjectKeys.PROJECT属性代码示例

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


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

示例1: testPopulateModuleContentRootsWithAndroidProject

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,代码行数:24,代码来源:AndroidGradleProjectResolverIdeaTest.java

示例2: testPopulateModuleContentRootsWithJavaProject

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,代码行数:21,代码来源:AndroidGradleProjectResolverIdeaTest.java

示例3: populateProject

@NotNull
private static DataNode<ProjectData> populateProject(@NotNull IdeaProject project, @NotNull String projectPath) {
  String projectDirPath = ExternalSystemApiUtil.toCanonicalPath(projectPath);

  ProjectData projectData = new ProjectData(GradleConstants.SYSTEM_ID, projectDirPath, projectPath);
  projectData.setName(project.getName());

  // Gradle API doesn't expose project compile output path yet.
  JavaProjectData javaProjectData = new JavaProjectData(GradleConstants.SYSTEM_ID, projectDirPath + "/out");
  javaProjectData.setJdkVersion(project.getJdkName());
  javaProjectData.setLanguageLevel(project.getLanguageLevel().getLevel());

  DataNode<ProjectData> result = new DataNode<ProjectData>(ProjectKeys.PROJECT, projectData, null);
  result.createChild(JavaProjectData.KEY, javaProjectData);
  return result;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:16,代码来源:GradleProjectResolver.java

示例4: setUp

@Override
public void setUp() throws Exception {
  super.setUp();
  myProjectName = "test";
  myProjectRootDir = createTempDir(myProjectName);

  String projectRootDirPath = myProjectRootDir.getPath();
  final File projectFile = new File(myProjectRootDir, SdkConstants.FN_BUILD_GRADLE);
  final String configPath = projectFile.getPath();
  ProjectData projectData = new ProjectData(GradleConstants.SYSTEM_ID, myProjectName, projectRootDirPath, configPath);
  myCachedProject = new DataNode<ProjectData>(ProjectKeys.PROJECT, projectData, null);

  ModuleData moduleData =
    new ModuleData("", GradleConstants.SYSTEM_ID, JAVA.getId(), myModule.getName(), projectRootDirPath, configPath);
  myCachedModule = myCachedProject.createChild(ProjectKeys.MODULE, moduleData);

  GradleProjectImporter.ImporterDelegate delegate = new GradleProjectImporter.ImporterDelegate() {
    @Override
    void importProject(@NotNull Project project,
                       @NotNull ExternalProjectRefreshCallback callback,
                       @NotNull final ProgressExecutionMode progressTaskMode) throws ConfigurationException {
      assertNotNull(project);
      assertEquals(myProjectName, project.getName());
      callback.onSuccess(myCachedProject);
    }
  };

  myImporter = new GradleProjectImporter(delegate);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:GradleProjectImporterTest.java

示例5: createProjectNode

protected DataNode<ProjectData> createProjectNode() {
  final PantsResolver dependenciesResolver = new PantsResolver(PantsCompileOptionsExecutor.createMock());
  dependenciesResolver.setProjectInfo(getProjectInfo());
  final ProjectData projectData = new ProjectData(
    PantsConstants.SYSTEM_ID, "test-project", "path/to/fake/project", "path/to/fake/project/BUILD"
  );
  final DataNode<ProjectData> dataNode = new DataNode<>(ProjectKeys.PROJECT, projectData, null);
  dependenciesResolver.addInfoTo(dataNode);
  return dataNode;
}
 
开发者ID:pantsbuild,项目名称:intellij-pants-plugin,代码行数:10,代码来源:PantsResolverTestBase.java

示例6: getTargetDataKey

@NotNull
@Override
public Key<ProjectData> getTargetDataKey() {
  return ProjectKeys.PROJECT;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:ProjectDataServiceImpl.java

示例7: resolveProjectInfoImpl

@NotNull
private DataNode<ProjectData> resolveProjectInfoImpl(
  @NotNull ExternalSystemTaskId id,
  @NotNull final PantsCompileOptionsExecutor executor,
  @NotNull ExternalSystemTaskNotificationListener listener,
  boolean isPreviewMode,
  boolean isEnableIncrementalImport
) throws ExternalSystemException, IllegalArgumentException, IllegalStateException {
  // todo(fkorotkov): add ability to choose a name for a project
  final ProjectData projectData = new ProjectData(
    PantsConstants.SYSTEM_ID,
    executor.getProjectName(),
    executor.getBuildRoot().getPath() + "/.idea/pants-projects/" + executor.getProjectRelativePath(),
    executor.getProjectPath()
  );
  final DataNode<ProjectData> projectDataNode = new DataNode<>(ProjectKeys.PROJECT, projectData, null);

  PantsUtil.findPantsExecutable(executor.getProjectPath())
    .flatMap(file -> PantsUtil.getDefaultJavaSdk(file.getPath(), null))
    .ifPresent(sdk -> projectDataNode.createChild(PantsConstants.SDK_KEY, sdk));

  if (!isPreviewMode) {
    PantsExternalMetricsListenerManager.getInstance().logIsIncrementalImport(isEnableIncrementalImport);
    resolveUsingPantsGoal(id, executor, listener, projectDataNode);

    if (!containsContentRoot(projectDataNode, executor.getProjectDir())) {
      // Add a module with content root as import project directory path.
      // This will allow all the files in the imported project directory will be indexed by the plugin.
      final String moduleName = executor.getRootModuleName();
      final ModuleData moduleData = new ModuleData(
        PantsConstants.PANTS_PROJECT_MODULE_ID_PREFIX + moduleName,
        PantsConstants.SYSTEM_ID,
        ModuleTypeId.JAVA_MODULE,
        moduleName + PantsConstants.PANTS_PROJECT_MODULE_SUFFIX,
        projectData.getIdeProjectFileDirectoryPath() + "/" + moduleName,
        executor.getProjectPath()
      );
      final DataNode<ModuleData> moduleDataNode = projectDataNode.createChild(ProjectKeys.MODULE, moduleData);
      final ContentRootData contentRoot = new ContentRootData(PantsConstants.SYSTEM_ID, executor.getProjectDir());
      if (FileUtil.filesEqual(executor.getBuildRoot(), new File(executor.getProjectPath()))) {
        contentRoot.storePath(ExternalSystemSourceType.EXCLUDED, executor.getBuildRoot().getPath() + "/.idea");
      }
      moduleDataNode.createChild(ProjectKeys.CONTENT_ROOT, contentRoot);
    }
  }

  return projectDataNode;
}
 
开发者ID:pantsbuild,项目名称:intellij-pants-plugin,代码行数:48,代码来源:PantsSystemProjectResolver.java

示例8: getTargetDataKey

@Nonnull
@Override
public Key<ProjectData> getTargetDataKey() {
  return ProjectKeys.PROJECT;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:5,代码来源:ProjectDataServiceImpl.java


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