private void addResultAndPopulateProject(@NotNull ModuleSearchResult result,@NotNull DataNode<ProjectData> projectInfo,@NotNull List<DataNode<ModuleData>> selectedModules,@NotNull File file){
  DataNode<ModuleData> moduleNode=result.moduleNode;
  String moduleName=getNameOf(moduleNode);
  String text;
  if (result.selected) {
    String tmp=String.format("File '%1$s' is already in module '%2$s'",file.getName(),moduleName);
    SourceFileContainerInfo containerInfo=result.containerInfo;
    if (containerInfo != null) {
      containerInfo.updateSelectedVariantIn(moduleNode);
      Variant variant=containerInfo.variant;
      if (variant != null) {
        tmp+=String.format(", variant '%1$s'",variant.getName());
      }
    }
    text=tmp;
  }
 else {
    text=String.format("Module '%1$s' was added to the project.",moduleName);
    SourceFileContainerInfo containerInfo=result.containerInfo;
    if (containerInfo != null) {
      containerInfo.updateSelectedVariantIn(moduleNode);
    }
    selectedModules.add(moduleNode);
    setSelection(selectedModules);
  }
  invokeLaterIfNeeded(null);
  populate(myProject,projectInfo,selectedModules,true);
}

private void addResultAndPopulateProject ( @ NotNull ModuleSearchResult result , @ NotNull DataNode < ProjectData > projectInfo , @ NotNull List < DataNode < ModuleData > > selectedModules , @ NotNull File file ) { DataNode < ModuleData > moduleNode = result . moduleNode ; String moduleName = getNameOf ( moduleNode ) ; String text ; if ( result . selected ) { String tmp = String . format ( "File '%1$s' is already in module '%2$s'" , file . getName ( ) , moduleName ) ; SourceFileContainerInfo containerInfo = result . containerInfo ; if ( containerInfo != null ) { containerInfo . updateSelectedVariantIn ( moduleNode ) ; Variant variant = containerInfo . variant ; if ( variant != null ) { tmp += String . format ( ", variant '%1$s'" , variant . getName ( ) ) ; } } text = tmp ; } else { text = String . format ( "Module '%1$s' was added to the project." , moduleName ) ; SourceFileContainerInfo containerInfo = result . containerInfo ; if ( containerInfo != null ) { containerInfo . updateSelectedVariantIn ( moduleNode ) ; } selectedModules . add ( moduleNode ) ; setSelection ( selectedModules ) ; } invokeLaterIfNeeded ( null ) ; populate ( myProject , projectInfo , selectedModules , true ) ; }
adds the module in the given search results to the ide . if the search result indicates the variant where the file is , this method will select such variant in the android model .
