48 lines
1.9 KiB
Java
48 lines
1.9 KiB
Java
package _VisualDVM.Passes.All;
|
||
import Common.Passes.Pass;
|
||
import Common.Utils.Utils_;
|
||
import Common.Visual.Windows.Dialog.Text.ComboTextDialog;
|
||
import _VisualDVM.Current;
|
||
import _VisualDVM.Global;
|
||
import _VisualDVM.Passes.PassCode;
|
||
import _VisualDVM.ProjectData.SapforData.Functions.FuncInfo;
|
||
|
||
import java.util.Comparator;
|
||
import java.util.Vector;
|
||
public class ApplyCurrentFunction extends Pass {
|
||
@Override
|
||
public String getIconPath() {
|
||
return "/Common/icons/Apply.png";
|
||
}
|
||
@Override
|
||
public String getButtonText() {
|
||
return "";
|
||
}
|
||
@Override
|
||
protected boolean canStart(Object... args) throws Exception {
|
||
if (Global.mainModule.getPass(PassCode.SPF_GetGraphFunctions).isDone()) {
|
||
ComboTextDialog ff = new ComboTextDialog();
|
||
Vector<String> names = new Vector<>(Global.mainModule.getProject().allFunctions.keySet());
|
||
names.sort(Comparator.naturalOrder());
|
||
if (ff.ShowDialog("Выберите имя текущей процедуры", names)) {
|
||
String func_name = ff.Result;
|
||
if (Global.mainModule.getProject().allFunctions.containsKey(func_name)) {
|
||
FuncInfo fi = Global.mainModule.getProject().allFunctions.get(func_name);
|
||
Global.mainModule.set(Current.Function, fi);
|
||
return true;
|
||
} else {
|
||
Log.Writeln_("Проект не содержит процедуры с именем " + Utils_.Brackets(func_name));
|
||
}
|
||
}
|
||
}
|
||
return false;
|
||
}
|
||
@Override
|
||
protected void showDone() throws Exception {
|
||
Global.mainModule.getUI().getMainWindow().getProjectWindow().getFunctionsWindow().ShowCurrentFunction();
|
||
if (SPF_GetGraphFunctionPositions.showByCurrentFunction) {
|
||
Global.mainModule.getPass(PassCode.SPF_GetGraphFunctionPositions).Do();
|
||
}
|
||
}
|
||
}
|