2023-11-19 02:12:44 +03:00
|
|
|
|
package Visual_DVM_2021.Passes.All;
|
2024-10-08 00:39:13 +03:00
|
|
|
|
import Common.CurrentAnchestor;
|
2024-10-07 14:22:52 +03:00
|
|
|
|
import Common.Utils.CommonUtils;
|
2024-10-07 00:58:29 +03:00
|
|
|
|
import Common_old.Current;
|
|
|
|
|
|
import Common_old.UI.UI;
|
|
|
|
|
|
import Common_old.UI.Windows.Dialog.Text.ComboTextDialog;
|
2023-09-17 22:13:42 +03:00
|
|
|
|
import ProjectData.SapforData.Functions.FuncInfo;
|
2023-11-19 02:12:44 +03:00
|
|
|
|
import Visual_DVM_2021.Passes.PassCode_2021;
|
|
|
|
|
|
import Visual_DVM_2021.Passes.Pass_2021;
|
2023-09-17 22:13:42 +03:00
|
|
|
|
|
|
|
|
|
|
import java.util.Comparator;
|
|
|
|
|
|
import java.util.Vector;
|
|
|
|
|
|
public class ApplyCurrentFunction extends Pass_2021 {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public String getIconPath() {
|
|
|
|
|
|
return "/icons/Apply.png";
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public String getButtonText() {
|
|
|
|
|
|
return "";
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
protected boolean canStart(Object... args) throws Exception {
|
|
|
|
|
|
if (passes.get(PassCode_2021.SPF_GetGraphFunctions).isDone()) {
|
|
|
|
|
|
ComboTextDialog ff = new ComboTextDialog();
|
|
|
|
|
|
Vector<String> names = new Vector<>(Current.getProject().allFunctions.keySet());
|
|
|
|
|
|
names.sort(Comparator.naturalOrder());
|
|
|
|
|
|
if (ff.ShowDialog("Выберите имя текущей процедуры", names)) {
|
|
|
|
|
|
String func_name = ff.Result;
|
|
|
|
|
|
if (Current.getProject().allFunctions.containsKey(func_name)) {
|
|
|
|
|
|
FuncInfo fi = Current.getProject().allFunctions.get(func_name);
|
2024-10-08 00:39:13 +03:00
|
|
|
|
CurrentAnchestor.set(Current.Function, fi);
|
2023-09-17 22:13:42 +03:00
|
|
|
|
return true;
|
|
|
|
|
|
} else {
|
2024-10-07 14:22:52 +03:00
|
|
|
|
Log.Writeln_("Проект не содержит процедуры с именем " + CommonUtils.Brackets(func_name));
|
2023-09-17 22:13:42 +03:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
protected void showDone() throws Exception {
|
|
|
|
|
|
UI.getMainWindow().getProjectWindow().getFunctionsWindow().ShowCurrentFunction();
|
|
|
|
|
|
if (SPF_GetGraphFunctionPositions.showByCurrentFunction) {
|
|
|
|
|
|
Pass_2021.passes.get(PassCode_2021.SPF_GetGraphFunctionPositions).Do();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|