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


Java ProjectKeys类代码示例

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


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

示例1: createNodes

import com.intellij.openapi.externalSystem.model.ProjectKeys; //导入依赖的package包/类
@Override
@NotNull
public List<ExternalSystemNode<?>> createNodes(final ExternalProjectsView externalProjectsView,
                                               final MultiMap<Key<?>, DataNode<?>> dataNodes) {
  final List<ExternalSystemNode<?>> result = new SmartList<ExternalSystemNode<?>>();

  addModuleNodes(externalProjectsView, dataNodes, result);
  // add tasks
  TasksNode tasksNode = new TasksNode(externalProjectsView, dataNodes.get(ProjectKeys.TASK));
  if(externalProjectsView.useTasksNode()) {
    result.add(tasksNode);
  } else {
    ContainerUtil.addAll(result, tasksNode.getChildren());
  }

  addDependenciesNode(externalProjectsView, dataNodes, result);

  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:ExternalSystemViewDefaultContributor.java

示例2: addModuleNodes

import com.intellij.openapi.externalSystem.model.ProjectKeys; //导入依赖的package包/类
private static void addModuleNodes(@NotNull ExternalProjectsView externalProjectsView,
                                   @NotNull MultiMap<Key<?>, DataNode<?>> dataNodes,
                                   @NotNull List<ExternalSystemNode<?>> result) {
  final Collection<DataNode<?>> moduleDataNodes = dataNodes.get(ProjectKeys.MODULE);
  if (!moduleDataNodes.isEmpty()) {
    final AbstractExternalSystemSettings systemSettings =
      ExternalSystemApiUtil.getSettings(externalProjectsView.getProject(), externalProjectsView.getSystemId());

    for (DataNode<?> dataNode : moduleDataNodes) {
      final ModuleData data = (ModuleData)dataNode.getData();

      final ExternalProjectSettings projectSettings = systemSettings.getLinkedProjectSettings(data.getLinkedExternalProjectPath());
      final boolean isRoot =
        projectSettings != null && data.getLinkedExternalProjectPath().equals(projectSettings.getExternalProjectPath());
      //noinspection unchecked
      final ModuleNode moduleNode = new ModuleNode(externalProjectsView, (DataNode<ModuleData>)dataNode, isRoot);
      result.add(moduleNode);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ExternalSystemViewDefaultContributor.java

示例3: importData

import com.intellij.openapi.externalSystem.model.ProjectKeys; //导入依赖的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

示例4: setModuleOptions

import com.intellij.openapi.externalSystem.model.ProjectKeys; //导入依赖的package包/类
private static void setModuleOptions(Module module, DataNode<ModuleData> moduleDataNode) {
  ModuleData moduleData = moduleDataNode.getData();
  module.putUserData(MODULE_DATA_KEY, moduleData);

  module.setOption(ExternalSystemConstants.EXTERNAL_SYSTEM_ID_KEY, moduleData.getOwner().toString());
  module.setOption(ExternalSystemConstants.LINKED_PROJECT_ID_KEY, moduleData.getId());
  module.setOption(ExternalSystemConstants.LINKED_PROJECT_PATH_KEY, moduleData.getLinkedExternalProjectPath());
  ProjectData projectData = moduleDataNode.getData(ProjectKeys.PROJECT);
  module.setOption(ExternalSystemConstants.ROOT_PROJECT_PATH_KEY, projectData != null ? projectData.getLinkedExternalProjectPath() : "");

  if (moduleData.getGroup() != null) {
    module.setOption(ExternalSystemConstants.EXTERNAL_SYSTEM_MODULE_GROUP_KEY, moduleData.getGroup());
  }
  if (moduleData.getVersion() != null) {
    module.setOption(ExternalSystemConstants.EXTERNAL_SYSTEM_MODULE_VERSION_KEY, moduleData.getVersion());
  }

  // clear maven option
  module.clearOption("org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ModuleDataService.java

示例5: createActions

import com.intellij.openapi.externalSystem.model.ProjectKeys; //导入依赖的package包/类
private static void createActions(Project project, Collection<DataNode<TaskData>> taskNodes) {
  ActionManager actionManager = ActionManager.getInstance();
  final ExternalSystemShortcutsManager shortcutsManager = ExternalProjectsManager.getInstance(project).getShortcutsManager();
  if (actionManager != null) {
    for (DataNode<TaskData> each : taskNodes) {
      final DataNode<ModuleData> moduleData = ExternalSystemApiUtil.findParent(each, ProjectKeys.MODULE);
      if (moduleData == null || moduleData.isIgnored()) continue;
      TaskData taskData = each.getData();
      ExternalSystemTaskAction eachAction = new ExternalSystemTaskAction(project, moduleData.getData().getInternalName(), taskData);
      actionManager.unregisterAction(eachAction.getId());
      if (shortcutsManager.hasShortcuts(taskData.getLinkedExternalProjectPath(), taskData.getName())) {
        actionManager.registerAction(eachAction.getId(), eachAction);
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ExternalSystemKeymapExtension.java

示例6: getSelectionStatus

import com.intellij.openapi.externalSystem.model.ProjectKeys; //导入依赖的package包/类
private SelectionState getSelectionStatus() {
  boolean isRequiredSelectionEnabled = computeRequiredSelectionStatus();

  String stateMessage = "";
  final Object root = myTree.getModel().getRoot();
  if (root instanceof CheckedTreeNode) {

    final int[] selectedModulesCount = {0};

    TreeUtil.traverse((CheckedTreeNode)root, new TreeUtil.Traverse() {
      @Override
      public boolean accept(Object node) {
        if (node instanceof DataNodeCheckedTreeNode &&
            ((DataNodeCheckedTreeNode)node).isChecked() &&
            ((DataNodeCheckedTreeNode)node).myDataNode.getKey().equals(ProjectKeys.MODULE)) {
          selectedModulesCount[0]++;
        }
        return true;
      }
    });
    stateMessage = String.format("%1$d Modules. %2$d selected", myModulesCount, selectedModulesCount[0]);
  }

  return new SelectionState(isRequiredSelectionEnabled, stateMessage);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:ExternalProjectDataSelectorDialog.java

示例7: testPopulateModuleContentRootsWithAndroidProject

import com.intellij.openapi.externalSystem.model.ProjectKeys; //导入依赖的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

示例8: testPopulateModuleContentRootsWithJavaProject

import com.intellij.openapi.externalSystem.model.ProjectKeys; //导入依赖的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

示例9: getVariants

import com.intellij.openapi.externalSystem.model.ProjectKeys; //导入依赖的package包/类
protected List<LookupElement> getVariants(@NotNull final DataNode<ProjectData> projectDataNode, @NotNull final String modulePath) {
  final DataNode<ModuleData> moduleDataNode = findModuleDataNode(projectDataNode, modulePath);
  if (moduleDataNode == null) {
    return Collections.emptyList();
  }

  final ModuleData moduleData = moduleDataNode.getData();
  final boolean isRoot = projectDataNode.getData().getLinkedExternalProjectPath().equals(moduleData.getLinkedExternalProjectPath());
  final Collection<DataNode<TaskData>> tasks = ExternalSystemApiUtil.getChildren(moduleDataNode, ProjectKeys.TASK);
  List<LookupElement> elements = ContainerUtil.newArrayListWithCapacity(tasks.size());

  for (DataNode<TaskData> taskDataNode : tasks) {
    final TaskData taskData = taskDataNode.getData();
    elements.add(LookupElementBuilder.create(taskData.getName()).withIcon(ExternalSystemIcons.Task));
    if (!taskData.isInherited()) {
      elements.add(LookupElementBuilder.create((isRoot ? ':' : moduleData.getId() + ':') + taskData.getName())
                     .withIcon(ExternalSystemIcons.Task));
    }
  }
  return elements;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:GradleArgumentsCompletionProvider.java

示例10: addInfoTo

import com.intellij.openapi.externalSystem.model.ProjectKeys; //导入依赖的package包/类
public void addInfoTo(@NotNull DataNode<ProjectData> projectInfoDataNode) {
  if (myProjectInfo == null) return;


  LOG.debug("Amount of targets before modifiers: " + myProjectInfo.getTargets().size());
  for (PantsProjectInfoModifierExtension modifier : PantsProjectInfoModifierExtension.EP_NAME.getExtensions()) {
    modifier.modify(myProjectInfo, myExecutor, LOG);
  }
  LOG.debug("Amount of targets after modifiers: " + myProjectInfo.getTargets().size());

  Optional<BuildGraph> buildGraph = constructBuildGraph(projectInfoDataNode);

  final Map<String, DataNode<ModuleData>> modules = new HashMap<>();
  for (PantsResolverExtension resolver : PantsResolverExtension.EP_NAME.getExtensions()) {
    resolver.resolve(myProjectInfo, myExecutor, projectInfoDataNode, modules, buildGraph);
  }
  if (LOG.isDebugEnabled()) {
    final int amountOfModules = PantsUtil.findChildren(projectInfoDataNode, ProjectKeys.MODULE).size();
    LOG.debug("Amount of modules created: " + amountOfModules);
  }
}
 
开发者ID:pantsbuild,项目名称:intellij-pants-plugin,代码行数:22,代码来源:PantsResolver.java

示例11: assertSourceRoot

import com.intellij.openapi.externalSystem.model.ProjectKeys; //导入依赖的package包/类
public void assertSourceRoot(String moduleName, final String path) {
  final DataNode<ModuleData> moduleNode = findModule(moduleName);
  assertModuleExists(moduleName, moduleNode);
  final Collection<DataNode<ContentRootData>> contentRoots = ExternalSystemApiUtil.findAll(moduleNode, ProjectKeys.CONTENT_ROOT);
  assertFalse(String.format("No content root for module %s", moduleName), contentRoots.isEmpty());
  for (DataNode<ContentRootData> contentRoot : contentRoots) {
    final ContentRootData contentRootData = contentRoot.getData();
    for (PantsSourceType type : PantsSourceType.values()) {
      for (ContentRootData.SourceRoot sourceRoot : contentRootData.getPaths(type.toExternalSystemSourceType())) {
        final File expectedFile = new File(new File(""), path);
        if (StringUtil.equalsIgnoreCase(expectedFile.getPath(), sourceRoot.getPath())) {
          return;
        }
      }
    }
  }
  fail(String.format("Source root %s is not found for %s!", path, moduleName));
}
 
开发者ID:pantsbuild,项目名称:intellij-pants-plugin,代码行数:19,代码来源:PantsResolverTestBase.java

示例12: importData

import com.intellij.openapi.externalSystem.model.ProjectKeys; //导入依赖的package包/类
@Override
public void importData(@NotNull final Collection<DataNode<ContentRootData>> toImport,
                       @NotNull final Project project,
                       boolean synchronous)
{
  if (toImport.isEmpty()) {
    return;
  }

  Map<DataNode<ModuleData>, List<DataNode<ContentRootData>>> byModule = ExternalSystemApiUtil.groupBy(toImport, ProjectKeys.MODULE);
  for (Map.Entry<DataNode<ModuleData>, List<DataNode<ContentRootData>>> entry : byModule.entrySet()) {
    final Module module = myProjectStructureHelper.findIdeModule(entry.getKey().getData(), project);
    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(entry.getValue(), module, synchronous);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:ContentRootDataService.java

示例13: findIdeContentRoot

import com.intellij.openapi.externalSystem.model.ProjectKeys; //导入依赖的package包/类
@Nullable
public ModuleAwareContentRoot findIdeContentRoot(@NotNull DataNode<ContentRootData> node, @NotNull Project ideProject) {
  ModuleData moduleData = node.getData(ProjectKeys.MODULE);
  if (moduleData == null) {
    return null;
  }
  final Module module = findIdeModule(moduleData.getName(), ideProject);
  if (module == null) {
    return null;
  }
  for (ModuleAwareContentRoot contentRoot : myFacade.getContentRoots(module)) {
    final VirtualFile file = contentRoot.getFile();
    if (node.getData().getRootPath().equals(file.getPath())) {
      return contentRoot;
    }
  }
  return null;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:ProjectStructureHelper.java

示例14: doResolveProjectInfo

import com.intellij.openapi.externalSystem.model.ProjectKeys; //导入依赖的package包/类
@NotNull
private DataNode<ProjectData> doResolveProjectInfo(@NotNull final ExternalSystemTaskId id,
                                                   @NotNull String projectPath,
                                                   @Nullable GradleExecutionSettings settings,
                                                   @NotNull ProjectConnection connection,
                                                   @NotNull ExternalSystemTaskNotificationListener listener,
                                                   boolean downloadLibraries)
  throws IllegalArgumentException, IllegalStateException
{
  ModelBuilder<? extends IdeaProject> modelBuilder = myHelper.getModelBuilder(id, settings, connection, listener, downloadLibraries);
  IdeaProject project = modelBuilder.get();
  DataNode<ProjectData> result = populateProject(project, projectPath);

  // We need two different steps ('create' and 'populate') in order to handle module dependencies, i.e. when one module is
  // configured to be dependency for another one, corresponding dependency module object should be available during
  // populating dependent module object.
  Map<String, Pair<DataNode<ModuleData>, IdeaModule>> modules = createModules(project, result);
  populateModules(modules.values(), result);
  Collection<DataNode<LibraryData>> libraries = ExternalSystemApiUtil.getChildren(result, ProjectKeys.LIBRARY);
  myLibraryNamesMixer.mixNames(libraries);
  parseTasks(result, project);
  return result;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:GradleProjectResolver.java

示例15: populateProject

import com.intellij.openapi.externalSystem.model.ProjectKeys; //导入依赖的package包/类
@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,代码行数:17,代码来源:GradleProjectResolver.java


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