Files
VisualSapfor/src/_VisualDVM/Passes/All/SPF_InsertIncludesPass.java

48 lines
1.9 KiB
Java
Raw Normal View History

2024-10-14 12:14:01 +03:00
package _VisualDVM.Passes.All;
2024-10-11 00:00:30 +03:00
import Common.Utils.Utils_;
2024-10-07 17:46:38 +03:00
import Common.Visual.Selectable;
import _VisualDVM.Global;
2024-10-14 12:14:01 +03:00
import _VisualDVM.Passes.PassCode;
import _VisualDVM.Passes.Sapfor.SapforTransformation;
2025-04-14 21:44:19 +03:00
import _VisualDVM.ProjectData.SapforData.Includes.Include;
2024-10-14 15:19:13 +03:00
import _VisualDVM.ProjectData.SapforData.Includes.FileInfo;
2023-09-17 22:13:42 +03:00
import java.util.Vector;
import java.util.stream.Collectors;
public class SPF_InsertIncludesPass extends SapforTransformation {
@Override
2024-10-09 23:37:58 +03:00
protected PassCode necessary() {
return PassCode.SPF_GetIncludeDependencies;
2023-09-17 22:13:42 +03:00
}
@Override
protected boolean canStart(Object... args) throws Exception {
if (super.canStart(args)) {
if (target.numAddicted <= 0) {
Log.Writeln_("Не найдено файлов, имеющих зависимости по включению.");
return false;
}
Vector<String> Result = new Vector<>();
for (FileInfo fileInfo : target.addictedFiles.values()) {
2025-04-14 21:44:19 +03:00
Vector<Include> selected_children = fileInfo.dependencies.stream().filter(Selectable::isSelected).collect(Collectors.toCollection(Vector::new));
2023-09-17 22:13:42 +03:00
if (!selected_children.isEmpty()) {
Result.add(fileInfo.file);
Result.add(String.valueOf(selected_children.size()));
2025-04-14 21:44:19 +03:00
for (Include di : selected_children)
2025-04-14 21:58:11 +03:00
Result.add(di.dependencyFileName);
2023-09-17 22:13:42 +03:00
}
}
if (Result.isEmpty()) {
Log.Writeln_("Не отмечено ни одного заголовка для подстановки");
return false;
}
2024-10-11 00:00:30 +03:00
Options = Utils_.toU(String.join("|", Result));
2023-09-17 22:13:42 +03:00
return true;
}
return false;
}
@Override
protected void FocusBeforeStart() {
Global.mainModule.getUI().getMainWindow().getProjectWindow().FocusDependencies();
2023-09-17 22:13:42 +03:00
}
}