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

47 lines
2.1 KiB
Java
Raw Normal View History

package Visual_DVM_2021.Passes.All;
2024-10-09 22:01:19 +03:00
import _VisualDVM.Current;
import _VisualDVM.Global;
2024-10-09 22:01:19 +03:00
import _VisualDVM.Visual.UI;
2024-10-09 22:21:57 +03:00
import _VisualDVM.ProjectData.SapforData.Functions.FuncCoordinates;
import _VisualDVM.ProjectData.SapforData.Functions.UI.Graph.FunctionsGraphForm;
2024-10-10 23:57:36 +03:00
import Common.Passes.Pass;
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 = UI.getMainWindow().getProjectWindow().getFunctionsWindow().getFunctionsGraphWindow();
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);
2023-09-17 22:13:42 +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();
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
}
}
}
}