com.intellij.openapi.externalSystem.model.ExternalProjectInfo Java Examples

The following examples show how to use com.intellij.openapi.externalSystem.model.ExternalProjectInfo. 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: ExternalSystemImportingTestCase.java    From intellij-quarkus with Eclipse Public License 2.0 5 votes vote down vote up
protected void ignoreData(BooleanFunction<DataNode<?>> booleanFunction, final boolean ignored) {
  final ExternalProjectInfo externalProjectInfo = ProjectDataManagerImpl.getInstance().getExternalProjectData(
    myProject, getExternalSystemId(), getCurrentExternalProjectSettings().getExternalProjectPath());
  assertNotNull(externalProjectInfo);

  final DataNode<ProjectData> projectDataNode = externalProjectInfo.getExternalProjectStructure();
  assertNotNull(projectDataNode);

  final Collection<DataNode<?>> nodes = ExternalSystemApiUtil.findAllRecursively(projectDataNode, booleanFunction);
  for (DataNode<?> node : nodes) {
    ExternalSystemApiUtil.visit(node, dataNode -> dataNode.setIgnored(ignored));
  }
  ServiceManager.getService(ProjectDataManager.class).importData(projectDataNode, myProject, true);
}
 
Example #2
Source File: GradleMonitor.java    From spring-javaformat with Apache License 2.0 5 votes vote down vote up
private boolean hasFormatPlugin(Collection<ExternalProjectInfo> projectInfos) {
	for (ExternalProjectInfo projectInfo : projectInfos) {
		if (hasFormatPlugin(projectInfo.getExternalProjectStructure())) {
			return true;
		}
	}
	return false;
}
 
Example #3
Source File: AndroidUtils.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@NotNull
@SuppressWarnings("DuplicatedCode")
private static Map<ProjectData, MultiMap<String, String>> getTasksMap(Project project) {
  Map<ProjectData, MultiMap<String, String>> tasks = new LinkedHashMap<>();
  for (GradleProjectSettings setting : GradleSettings.getInstance(project).getLinkedProjectsSettings()) {
    final ExternalProjectInfo projectData =
      ProjectDataManager.getInstance().getExternalProjectData(project, GradleConstants.SYSTEM_ID, setting.getExternalProjectPath());
    if (projectData == null || projectData.getExternalProjectStructure() == null) continue;

    MultiMap<String, String> projectTasks = MultiMap.createOrderedSet();
    for (DataNode<ModuleData> moduleDataNode : getChildren(projectData.getExternalProjectStructure(), ProjectKeys.MODULE)) {
      String gradlePath;
      String moduleId = moduleDataNode.getData().getId();
      if (moduleId.charAt(0) != ':') {
        int colonIndex = moduleId.indexOf(':');
        gradlePath = colonIndex > 0 ? moduleId.substring(colonIndex) : ":";
      }
      else {
        gradlePath = moduleId;
      }
      for (DataNode<TaskData> node : getChildren(moduleDataNode, ProjectKeys.TASK)) {
        TaskData taskData = node.getData();
        String taskName = taskData.getName();
        if (isNotEmpty(taskName)) {
          String taskPathPrefix = ":".equals(gradlePath) || taskName.startsWith(gradlePath) ? "" : (gradlePath + ':');
          projectTasks.putValue(taskPathPrefix, taskName);
        }
      }
    }
    tasks.put(projectData.getExternalProjectStructure().getData(), projectTasks);
  }
  return tasks;
}
 
Example #4
Source File: AndroidUtils.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@NotNull
@SuppressWarnings("DuplicatedCode")
private static Map<ProjectData, MultiMap<String, String>> getTasksMap(Project project) {
  Map<ProjectData, MultiMap<String, String>> tasks = new LinkedHashMap<>();
  for (GradleProjectSettings setting : GradleSettings.getInstance(project).getLinkedProjectsSettings()) {
    final ExternalProjectInfo projectData =
      ProjectDataManager.getInstance().getExternalProjectData(project, GradleConstants.SYSTEM_ID, setting.getExternalProjectPath());
    if (projectData == null || projectData.getExternalProjectStructure() == null) continue;

    MultiMap<String, String> projectTasks = MultiMap.createOrderedSet();
    for (DataNode<ModuleData> moduleDataNode : getChildren(projectData.getExternalProjectStructure(), ProjectKeys.MODULE)) {
      String gradlePath;
      String moduleId = moduleDataNode.getData().getId();
      if (moduleId.charAt(0) != ':') {
        int colonIndex = moduleId.indexOf(':');
        gradlePath = colonIndex > 0 ? moduleId.substring(colonIndex) : ":";
      }
      else {
        gradlePath = moduleId;
      }
      for (DataNode<TaskData> node : getChildren(moduleDataNode, ProjectKeys.TASK)) {
        TaskData taskData = node.getData();
        String taskName = taskData.getName();
        if (isNotEmpty(taskName)) {
          String taskPathPrefix = ":".equals(gradlePath) || taskName.startsWith(gradlePath) ? "" : (gradlePath + ':');
          projectTasks.putValue(taskPathPrefix, taskName);
        }
      }
    }
    tasks.put(projectData.getExternalProjectStructure().getData(), projectTasks);
  }
  return tasks;
}