Files
VisualSapfor/src/Visual_DVM_2021/Passes/All/ApplyCurrentFunction.java
2024-10-09 23:37:58 +03:00

49 lines
1.9 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 Visual_DVM_2021.Passes.All;
import Common.Current_;
import Common.Utils.CommonUtils;
import _VisualDVM.Current;
import _VisualDVM.Visual.UI;
import Common.Visual.Windows.Dialog.Text.ComboTextDialog;
import _VisualDVM.ProjectData.SapforData.Functions.FuncInfo;
import Visual_DVM_2021.Passes.PassCode;
import Visual_DVM_2021.Passes.Pass;
import java.util.Comparator;
import java.util.Vector;
public class ApplyCurrentFunction extends Pass {
@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.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);
Current_.set(Current.Function, fi);
return true;
} else {
Log.Writeln_("Проект не содержит процедуры с именем " + CommonUtils.Brackets(func_name));
}
}
}
return false;
}
@Override
protected void showDone() throws Exception {
UI.getMainWindow().getProjectWindow().getFunctionsWindow().ShowCurrentFunction();
if (SPF_GetGraphFunctionPositions.showByCurrentFunction) {
Pass.passes.get(PassCode.SPF_GetGraphFunctionPositions).Do();
}
}
}