запаковка со стороны визуализатора инклудов

This commit is contained in:
2025-06-06 22:59:58 +03:00
parent 7924212fed
commit 641ce80102
3 changed files with 20 additions and 20 deletions

View File

@@ -6,6 +6,8 @@ import _VisualDVM.Passes.PassCode;
import _VisualDVM.Passes.Sapfor.SapforTransformation;
import _VisualDVM.ProjectData.SapforData.Includes.Analysis.FileInfo;
import _VisualDVM.ProjectData.SapforData.Includes.Analysis.Include;
import _VisualDVM.ProjectData.SapforData.Includes.Transformation.IncludeToInsertJson;
import _VisualDVM.ProjectData.SapforData.Includes.Transformation.IncludesToInsertJson;
import java.util.Vector;
import java.util.stream.Collectors;
@@ -24,23 +26,18 @@ public class SPF_InsertIncludesPass extends SapforTransformation {
Log.Writeln_("Не найдено файлов, имеющих зависимости по включению.");
return false;
}
Vector<String> Result = new Vector<>();
IncludesToInsertJson includes = new IncludesToInsertJson();
for (FileInfo fileInfo : target.addictedFiles.values()) {
Vector<Include> selected_children = fileInfo.dependencies.stream().filter(Selectable::isSelected).collect(Collectors.toCollection(Vector::new));
if (!selected_children.isEmpty()) {
Result.add(fileInfo.file);
Result.add(String.valueOf(selected_children.size()));
for (Include di : selected_children) {
Result.add(String.valueOf(di.line));
Result.add(di.dependencyFileName);
}
}
if (!selected_children.isEmpty())
for (Include di : selected_children)
includes.allIncludes.add(new IncludeToInsertJson(di.dependencyFileName,fileInfo.file, di.line));
}
if (Result.isEmpty()) {
if (includes.allIncludes.isEmpty()) {
Log.Writeln_("Не отмечено ни одного заголовка для подстановки");
return false;
}
Options = Utils_.toU(String.join("|", Result));
Options = Utils_.gson.toJson(includes);
return true;
}
return false;

View File

@@ -1,4 +1,5 @@
package _VisualDVM.ProjectData.SapforData.Includes.Transformation;
import Common.Utils.Utils_;
import com.google.gson.annotations.Expose;
public class IncludeToInsertJson {
@Expose
@@ -7,4 +8,14 @@ public class IncludeToInsertJson {
public String fileName;
@Expose
public int line;
//--
public IncludeToInsertJson(){
}
//--
public IncludeToInsertJson(String includeName_in, String fileName_in, int line_in){
includeName = Utils_.toU(includeName_in);
fileName = Utils_.toU(fileName_in);
line= line_in;
}
}