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

61 lines
2.5 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package _VisualDVM.Passes.All;
import Common.Utils.Utils_;
import _VisualDVM.Global;
import _VisualDVM.Passes.PassCode;
import _VisualDVM.Passes.Sapfor.SapforTransformation;
import _VisualDVM.ProjectData.SapforData.Functions.FuncCall;
import _VisualDVM.ProjectData.SapforData.Functions.FuncInfo;
import java.util.Vector;
public class SPF_InlineProcedures extends SapforTransformation {
@Override
protected PassCode necessary() {
return PassCode.SPF_GetGraphFunctions;
}
@Override
protected boolean canStart(Object... args) throws Exception {
if (super.canStart(args)) {
Vector<String> Result = new Vector<>();
for (FuncInfo fi : target.allFunctions.values()) {
Vector<FuncCall> selected_children = new Vector<>();
for (String calls_file : fi.own_calls.keySet()) {
for (FuncCall call : fi.own_calls.get(calls_file)) {
if (call.isSelected())
selected_children.add(call);
}
}
if (!selected_children.isEmpty()) {
Result.add(fi.funcName);
Result.add(String.valueOf(selected_children.size()));
for (FuncCall fc : selected_children) {
Result.add(fc.file);
Result.add(String.valueOf(fc.parent_offset));
}
}
}
if (Result.isEmpty()) {
Log.Writeln_(
(callsCount > 1) ? "Не отмечено ни одной точки вызова процедур для подстановки" :
"Для точечной подстановки следует отметить\ужные точки вызовов процедур в дереве."
);
return false;
}
Options = Utils_.toU(String.join("|", Result));
target.sapforProperties.PARSE_FOR_INLINE=true;
target.sapforProperties.Update();
SPF_ParseFilesWithOrder.silent = true;
return Global.mainModule.getPass(PassCode.SPF_ParseFilesWithOrder).Do(false);
}
return false;
}
@Override
protected void FocusBeforeStart() {
Global.mainModule.getUI().getMainWindow().getProjectWindow().FocusPoints();
}
@Override
protected void performFinish() throws Exception {
SPF_ParseFilesWithOrder.silent = false;
super.performFinish();
}
}