продолжение рефакторинга. создал предка для класса current

This commit is contained in:
2024-10-08 00:39:13 +03:00
parent 3516b58127
commit d0c08a2c7e
157 changed files with 648 additions and 421 deletions

View File

@@ -1,7 +1,7 @@
package ProjectData.DBArray;
import Common_old.Current;
import Common.Database.Tables.DBTable;
import Common_old.UI.DataSetControlForm;
import Common.Visual.DataSetControlForm;
public class ArraysDBTable extends DBTable<String, DBArray> {
public ArraysDBTable() {
super(String.class, DBArray.class);

View File

@@ -87,7 +87,7 @@ public class ProjectFile extends DBObject {
fileType = FileType.forbidden;
break;
case "":
if (CommonUtils.isDigit(name_in)) {
if (CommonUtils.isIntegerValue(name_in)) {
fileType = FileType.forbidden;
} else {
state = FileState.Excluded;

View File

@@ -1,4 +1,5 @@
package ProjectData.Files.UI;
import Common.CurrentAnchestor;
import Common_old.Current;
import Common_old.UI.Trees.DataTree;
import Common_old.UI.Trees.TreeRenderers;
@@ -22,7 +23,7 @@ public class FileGraphTree extends DataTree {
@Override
public void ShowCurrentObject() throws Exception {
Current.getFile().form.EventsOff();
Object o = Current.get(getCurrent());
Object o = CurrentAnchestor.get(getCurrent());
Current.getFile().form.getEditor().gotoLine((o instanceof FileObjectWithMessages) ? (((FileObjectWithMessages) o).line) : 1);
Current.getFile().form.ShowMessages();
Current.getFile().form.EventsOn();

View File

@@ -1,4 +1,5 @@
package ProjectData.Files.UI;
import Common.CurrentAnchestor;
import Common_old.Current;
import _VisualDVM.Global;
import Common_old.UI.DragDrop.FileDrop;
@@ -47,7 +48,7 @@ public class FilesTree extends StyledTree {
new FileDrop(System.out, this, files -> {
Pass_2021.passes.get(PassCode_2021.ImportFiles).Do(files);
});
Current.set(Current.File, null);
CurrentAnchestor.set(Current.File, null);
}
private static void forkFD(PassCode_2021 file_pass, PassCode_2021 folder_pass) {
DefaultMutableTreeNode node = Current.getProjectNode();
@@ -66,16 +67,16 @@ public class FilesTree extends StyledTree {
@Override
public void SelectionAction(TreePath e) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode) e.getLastPathComponent();
Current.set(Current.ProjectNode, node);
CurrentAnchestor.set(Current.ProjectNode, node);
Object o = node.getUserObject();
if (o instanceof File) {
Current.set(Current.SelectedDirectory, o);
Current.set(Current.SelectedFile, null);
CurrentAnchestor.set(Current.SelectedDirectory, o);
CurrentAnchestor.set(Current.SelectedFile, null);
UI.getMainWindow().getProjectWindow().ShowNoSelectedFile();
} else if (o instanceof DBProjectFile) {
Current.set(Current.SelectedFile, o);
CurrentAnchestor.set(Current.SelectedFile, o);
File file = ((DBProjectFile) o).file;
Current.set(Current.SelectedDirectory, file.getParentFile());
CurrentAnchestor.set(Current.SelectedDirectory, file.getParentFile());
UI.getMainWindow().getProjectWindow().ShowSelectedFile();
}
UI.getMainWindow().getProjectWindow().ShowSelectedDirectory();

View File

@@ -1,4 +1,5 @@
package ProjectData.Messages;
import Common.CurrentAnchestor;
import Common.Utils.CommonUtils;
import Common_old.Constants;
import Common_old.Current;
@@ -447,7 +448,7 @@ public class Message extends FileObject {
@Override
public boolean isVisible() {
if (Current.HasFile() && Current.getFile().name.equals(file)) {
Object o = Current.get(Current.FileGraphElement);
Object o = CurrentAnchestor.get(Current.FileGraphElement);
return !(o instanceof FileObjectWithMessages) || ((FileObjectWithMessages) o).HasMessage(this);
} else return false;
}

View File

@@ -2,7 +2,7 @@ package ProjectData.Messages;
import Common_old.Current;
import Common.Database.Tables.DataSet;
import Common.Database.Tables.iDBTable;
import Common_old.UI.DataSetControlForm;
import Common.Visual.DataSetControlForm;
import Common_old.UI.Tables.ColumnFilter;
import Common_old.UI.Tables.TableRenderers;

View File

@@ -1,7 +1,7 @@
package ProjectData.Messages.Recommendations;
import Common_old.Current;
import Common.Database.Tables.iDBTable;
import Common_old.UI.DataSetControlForm;
import Common.Visual.DataSetControlForm;
import Common_old.UI.Tables.TableRenderers;
import GlobalData.Settings.SettingName;
import Visual_DVM_2021.Passes.PassCode_2021;

View File

@@ -1,4 +1,5 @@
package ProjectData.Project.UI;
import Common.CurrentAnchestor;
import Common_old.Current;
import _VisualDVM.Global;
import Common_old.UI.Menus.GraphMenu;
@@ -50,7 +51,7 @@ public class VersionsTree extends DataTree {
public void LeftMouseAction1() {
if (Global.versions_multiselection) {
// только если есть режим выбора версий.
Object element = Current.get(getCurrent());
Object element = CurrentAnchestor.get(getCurrent());
if ((element instanceof Selectable)) {
((Selectable) element).SwitchSelection();
updateUI();

View File

@@ -1,5 +1,6 @@
package ProjectData.Project;
import Common.CommonConstants;
import Common.CurrentAnchestor;
import Common.Utils.CommonUtils;
import Common_old.Constants;
import Common_old.Current;
@@ -311,7 +312,7 @@ public class db_project_info extends DBObject {
}
public boolean IsMCopy() {
String lname = name.toLowerCase();
return (lname.startsWith("m") && CommonUtils.isDigit(lname.substring(1)));
return (lname.startsWith("m") && CommonUtils.isIntegerValue(lname.substring(1)));
}
public String getTitle() {
return name + " " + CommonUtils.DQuotes(description);
@@ -432,8 +433,8 @@ public class db_project_info extends DBObject {
db.ResetAI(MessageWarning.class);
db.ResetAI(MessageRecommendation.class);
//-
Current.set(Current.Function, null);
Current.set(Current.SelectedFunction, null);
CurrentAnchestor.set(Current.Function, null);
CurrentAnchestor.set(Current.SelectedFunction, null);
}
public void CleanVersions() throws Exception {
node.removeAllChildren();
@@ -845,7 +846,7 @@ public class db_project_info extends DBObject {
for (String key_ : versions.keySet()) {
String[] data_ = key_.split(letter);
String last = data_[data_.length - 1];
if (CommonUtils.isDigit(last)) {
if (CommonUtils.isIntegerValue(last)) {
int vn = Integer.parseInt(last);
if (vn > max_vn)
max_vn = vn;
@@ -1066,7 +1067,7 @@ public class db_project_info extends DBObject {
target.Close();
}
public void undoLastTransformation() throws Exception {
Current.set(Current.Version, null);
CurrentAnchestor.set(Current.Version, null);
//---
UI.getVersionsWindow().getVersionsForm().getTree().RemoveNode(last_version.node);
Utils.forceDeleteWithCheck(last_version.Home);

View File

@@ -2,7 +2,7 @@ package ProjectData.SapforData.Arrays;
import Common_old.Current;
import Common.Database.Tables.DataSet;
import _VisualDVM.Global;
import Common_old.UI.DataSetControlForm;
import Common.Visual.DataSetControlForm;
import GlobalData.Settings.SettingName;
import Visual_DVM_2021.Passes.PassCode_2021;
import Visual_DVM_2021.Passes.Pass_2021;

View File

@@ -1,7 +1,7 @@
package ProjectData.SapforData.Arrays.UI;
import Common.Visual.CommonUI;
import Common_old.Current;
import Common_old.UI.ControlForm;
import Common.Visual.ControlForm;
import Common_old.UI.Tables.Grid.GridAnchestor;
import Common_old.UI.Tables.StyledTable;
import Common_old.UI.UI;

View File

@@ -1,4 +1,5 @@
package ProjectData.SapforData.Arrays.UI;
import Common.CurrentAnchestor;
import Common_old.Current;
import Common_old.UI.Menus.GraphMenu;
import Common_old.UI.Trees.StyledTree;
@@ -15,7 +16,7 @@ public class RulesTree extends StyledTree {
setRootVisible(false);
expandRow(0);
ExpandAll();
Current.set(Current.ParallelRegion, null);
CurrentAnchestor.set(Current.ParallelRegion, null);
}
@Override
protected GraphMenu createMenu() {
@@ -38,6 +39,6 @@ public class RulesTree extends StyledTree {
region = (ParallelRegion) o;
}
}
Current.set(Current.ParallelRegion, region);
CurrentAnchestor.set(Current.ParallelRegion, region);
}
}

View File

@@ -1,7 +1,7 @@
package ProjectData.SapforData.Functions.UI.Graph;
import Common.Visual.CommonUI;
import Common_old.Current;
import Common_old.UI.ControlForm;
import Common.Visual.ControlForm;
import com.mxgraph.swing.mxGraphComponent;
import java.awt.*;

View File

@@ -1,4 +1,5 @@
package ProjectData.SapforData.Functions.UI.Graph;
import Common.CurrentAnchestor;
import Common.Utils.CommonUtils;
import Common_old.Current;
import Common_old.UI.Menus.VisualiserMenuItem;
@@ -19,7 +20,7 @@ public class FunctionsGraphMenu extends StyledPopupMenu {
@Override
public void actionPerformed(ActionEvent e) {
if (Current.HasSelectedFunction()) {
Current.set(Current.Function, Current.getSelectionFunction());
CurrentAnchestor.set(Current.Function, Current.getSelectionFunction());
UI.getMainWindow().getProjectWindow().getFunctionsWindow().ShowCurrentFunction();
if (SPF_GetGraphFunctionPositions.showByCurrentFunction) {
Pass_2021.passes.get(PassCode_2021.SPF_GetGraphFunctionPositions).Do();

View File

@@ -1,4 +1,5 @@
package ProjectData.SapforData.Functions.UI.Graph;
import Common.CurrentAnchestor;
import Common.Utils.CommonUtils;
import Common_old.Current;
import Common_old.UI.UI;
@@ -140,7 +141,7 @@ public class FunctionsGraphUI extends mxGraph {
funcInfo = Current.getProject().allFunctions.get(name);
String vertexType = funcInfo.type.toString();
if (SPF_GetGraphFunctionPositions.showByCurrentFunction) {
FuncInfo current_fi = (FuncInfo) Current.get(Current.Function);
FuncInfo current_fi = (FuncInfo) CurrentAnchestor.get(Current.Function);
if ((current_fi != null) && (funcInfo.funcName.equals(current_fi.funcName))) {
vertexType = "current";
}
@@ -233,7 +234,7 @@ public class FunctionsGraphUI extends mxGraph {
FuncInfo fi = Current.getProject().allFunctions.get(func_name);
switch (e.getClickCount()) {
case 1:
Current.set(Current.SelectedFunction, fi);
CurrentAnchestor.set(Current.SelectedFunction, fi);
break;
case 2:
switch (fi.type) {

View File

@@ -1,4 +1,5 @@
package ProjectData.SapforData.Functions.UI;
import Common.CurrentAnchestor;
import Common_old.Current;
import Common_old.UI.Menus.GraphMenu;
import Common_old.UI.Trees.SelectableTree;
@@ -18,7 +19,7 @@ public class InlineTree extends SelectableTree {
}
@Override
public void ShowCurrentObject() {
Object o = Current.get(getCurrent());
Object o = CurrentAnchestor.get(getCurrent());
if (o instanceof FileObject) {
((FileObject) o).Show(false);
}

View File

@@ -1,4 +1,5 @@
package ProjectData.SapforData.Functions.UI;
import Common.CurrentAnchestor;
import Common_old.Current;
import Common_old.UI.Menus.GraphMenu;
import Common_old.UI.Trees.SelectableTree;
@@ -22,7 +23,7 @@ public class InlineTree2 extends SelectableTree {
}
@Override
public void ShowCurrentObject() {
Object o = Current.get(getCurrent());
Object o = CurrentAnchestor.get(getCurrent());
if (o instanceof FileObject) {
((FileObject) o).Show(false);
}

View File

@@ -1,7 +1,7 @@
package ProjectData.SapforData.Regions;
import Common_old.Current;
import Common.Database.Tables.DataSet;
import Common_old.UI.DataSetControlForm;
import Common.Visual.DataSetControlForm;
import java.math.BigInteger;

View File

@@ -1,7 +1,7 @@
package ProjectData.SapforData.Variants;
import Common_old.Current;
import Common.Database.Tables.DataSet;
import Common_old.UI.DataSetControlForm;
import Common.Visual.DataSetControlForm;
import static Common_old.UI.Tables.TableRenderers.*;
public class VariantsSet extends DataSet<String, ParallelVariant> {