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

45 lines
2.1 KiB
Java
Raw Normal View History

2024-10-14 12:14:01 +03:00
package _VisualDVM.Passes.All;
2024-10-14 15:19:13 +03:00
import Common.Passes.Pass;
import _VisualDVM.Global;
2024-10-09 22:21:57 +03:00
import _VisualDVM.ProjectData.SapforData.Functions.FuncCoordinates;
import _VisualDVM.ProjectData.SapforData.Functions.UI.Graph.FunctionsGraphForm;
2024-10-09 23:37:58 +03:00
public class SaveFunctionsGraphCoordinates extends Pass {
2023-09-17 22:13:42 +03:00
FunctionsGraphForm graphForm = null;
@Override
protected boolean needsAnimation() {
return true;
}
@Override
public String getIconPath() {
return "/icons/ScreenShot.png";
}
@Override
protected boolean canStart(Object... args) {
graphForm = Global.mainModule.getUI().getMainWindow().getProjectWindow().getFunctionsWindow().getFunctionsGraphWindow();
2023-09-17 22:13:42 +03:00
if (!graphForm.isShown())
Log.Writeln_("Сначала отобразите граф");
if (Global.mainModule.getProject().functionsGraph.isEmpty())
2023-09-17 22:13:42 +03:00
Log.Writeln_("Граф процедур пуст");
return Log.isEmpty();
}
@Override
protected void body() throws Exception {
for (String funcName : Global.mainModule.getProject().functionsGraph.vertexCoordinates.keySet()) {
2023-09-17 22:13:42 +03:00
FuncCoordinates coords = null;
if (Global.mainModule.getProject().db.funcCoordinates.containsKey(funcName)) {
coords = Global.mainModule.getProject().db.funcCoordinates.get(funcName);
2024-10-14 15:19:13 +03:00
coords.name = funcName;
coords.X = Global.mainModule.getProject().functionsGraph.vertexCoordinates.get(funcName).getKey();
coords.Y = Global.mainModule.getProject().functionsGraph.vertexCoordinates.get(funcName).getValue();
Global.mainModule.getProject().db.Update(coords);
2023-09-17 22:13:42 +03:00
} else {
coords = new FuncCoordinates();
2024-10-14 15:19:13 +03:00
coords.name = funcName;
coords.X = Global.mainModule.getProject().functionsGraph.vertexCoordinates.get(funcName).getKey();
coords.Y = Global.mainModule.getProject().functionsGraph.vertexCoordinates.get(funcName).getValue();
Global.mainModule.getProject().db.Insert(coords);
2023-09-17 22:13:42 +03:00
}
}
}
}