Java Code Examples for com.intellij.util.containers.MultiMap#createOrderedSet()

The following examples show how to use com.intellij.util.containers.MultiMap#createOrderedSet() . 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: 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 2
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 3
Source File: NewMappings.java    From consulo with Apache License 2.0 5 votes vote down vote up
public NewMappings(Project project,
                   ProjectLevelVcsManagerImpl vcsManager,
                   FileStatusManager fileStatusManager) {
  myProject = project;
  myVcsManager = vcsManager;
  myFileStatusManager = fileStatusManager;
  myLock = new Object();
  myVcsToPaths = MultiMap.createOrderedSet();
  myFileWatchRequestsManager = new FileWatchRequestsManager(myProject, this);
  myDefaultVcsRootPolicy = DefaultVcsRootPolicy.getInstance(project);
  myActiveVcses = new AbstractVcs[0];

  if (!myProject.isDefault()) {
    VcsDirectoryMapping mapping = new VcsDirectoryMapping("", "");
    myVcsToPaths.putValue("", mapping);
    mySortedMappings = new VcsDirectoryMapping[]{mapping};
  }
  else {
    mySortedMappings = VcsDirectoryMapping.EMPTY_ARRAY;
  }
  myActivated = false;

  vcsManager.addInitializationRequest(VcsInitObject.MAPPINGS, (DumbAwareRunnable)() -> {
    if (!myProject.isDisposed()) {
      activateActiveVcses();
    }
  });
}