diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 81ab0018..05c046d0 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -7,8 +7,17 @@ - - + + + + + + + + + + + - diff --git a/properties b/properties index 3b795484..b6b77579 100644 --- a/properties +++ b/properties @@ -2,9 +2,9 @@ "Mode": "Normal", "ServerAddress": "alex-freenas.ddns.net", "ServerUserName": "testuser", - "ServerUserSHHPort": 23, + "ServerUserSHHPort": 2000, "ComponentsServerPort": 7995, - "TestingServerPort": 7996, + "TestingServerPort": 7998, "SocketTimeout": 5000, "OldServer": false, "SMTPHost": "smtp.mail.ru", @@ -33,8 +33,11 @@ "InstructionPath": "", "PerformanceAnalyzerPath": "", "ComponentsBackUpsCount": 10, - "AutoCheckTesting": true, + "AutoCheckTesting": false, "CheckTestingIntervalSeconds": 10, - "EmailOnTestingProgress": true, - "eraseTestingWorkspaces": true + "EmailOnTestingProgress": false, + "eraseTestingWorkspaces": true, + "lastMachineId": 13, + "lastUserId": 24, + "lastCompilerId": 52 } \ No newline at end of file diff --git a/src/Common/Visual/DataSetControlForm.java b/src/Common/Visual/DataSetControlForm.java index 1e7ad789..d6e0ec79 100644 --- a/src/Common/Visual/DataSetControlForm.java +++ b/src/Common/Visual/DataSetControlForm.java @@ -566,4 +566,7 @@ public abstract class DataSetControlForm extends ControlForm public PassCode_ getDeletePassCode() { return null; } + public Object getCurrentPK(Object nanValue){ + return current==null? nanValue: current.getPK(); + } } diff --git a/src/_VisualDVM/GlobalData/GlobalDatabase.java b/src/_VisualDVM/GlobalData/GlobalDatabase.java index f086b7b6..63edbde0 100644 --- a/src/_VisualDVM/GlobalData/GlobalDatabase.java +++ b/src/_VisualDVM/GlobalData/GlobalDatabase.java @@ -1,16 +1,19 @@ package _VisualDVM.GlobalData; +import Common.CommonConstants; import Common.Database.VisualiserDatabase; import Common.MainModule_; import _VisualDVM.Current; import _VisualDVM.Global; import _VisualDVM.GlobalData.Account.Account; import _VisualDVM.GlobalData.Account.AccountsDBTable; +import _VisualDVM.GlobalData.Compiler.Compiler; import _VisualDVM.GlobalData.Compiler.CompilersDBTable; import _VisualDVM.GlobalData.Credentials.Credentials; import _VisualDVM.GlobalData.Credentials.CredentialsDBTable; import _VisualDVM.GlobalData.DBLastProject.LastProjectsDBTable; import _VisualDVM.GlobalData.DVMParameter.DVMParameterDBTable; import _VisualDVM.GlobalData.EnvironmentValue.EnvironmentValuesDBTable; +import _VisualDVM.GlobalData.Machine.Machine; import _VisualDVM.GlobalData.Machine.MachinesDBTable; import _VisualDVM.GlobalData.Makefile.MakefilesDBTable; import _VisualDVM.GlobalData.Module.ModulesDBTable; @@ -24,6 +27,7 @@ import _VisualDVM.GlobalData.Settings.SettingName; import _VisualDVM.GlobalData.Settings.SettingsDBTable; import _VisualDVM.GlobalData.Tasks.CompilationTask.CompilationTasksDBTable; import _VisualDVM.GlobalData.Tasks.RunTask.RunTasksDBTable; +import _VisualDVM.GlobalData.User.User; import _VisualDVM.GlobalData.User.UsersDBTable; import _VisualDVM.Passes.PassCode; import _VisualDVM.Repository.Component.ComponentType; @@ -98,40 +102,20 @@ public class GlobalDatabase extends VisualiserDatabase { } //todo централизованное сохранение текущих объектов в базах public void SaveCredentials() { - /* - try { - - - Credentials credentials = MainModule_.instance.getDb().getTable(Credentials.class).getUI().getCurrent(); - if (MainModule_.instance.getDb().getTable(Machine.class).getUI().getCurrent()!=null) - credentials.machine_id = MainModule_.instance.getDb().getTable(Machine.class).getUI().getCurrent().id; - - if (MainModule_.instance.getDb().getTable(User.class).getUI().getCurrent()!=null) - credentials.user_id = MainModule_.instance.getDb().getTable(User.class).getUI().getCurrent().id; - - if (MainModule_.instance.getDb().getTable(Compiler.class).getUI().getCurrent()!=null) - credentials.compiler_id = MainModule_.instance.getDb().getTable(Compiler.class).getUI().getCurrent().id; - - if (MainModule_.instance.getDb().getTable(Makefile.class).getUI().getCurrent()!=null) - credentials.makefile_id =MainModule_.instance.getDb().getTable(Makefile.class).getUI().getCurrent().id; - - if (MainModule_.instance.getDb().getTable(RunConfiguration.class).getUI().getCurrent()!=null) - credentials.runconfiguration_id = MainModule_.instance.getDb().getTable(RunConfiguration.class).getUI().getCurrent().id; - Update(credentials); - } catch (Exception ex) { - ex.printStackTrace(); - } - */ + Global.properties.updateField("lastMachineId", getTable(Machine.class).getUI().getCurrentPK(CommonConstants.Nan)); + Global.properties.updateField("lastUserId", getTable(User.class).getUI().getCurrentPK(CommonConstants.Nan)); + Global.properties.updateField("lastCompilerId", getTable(Compiler.class).getUI().getCurrentPK(CommonConstants.Nan)); } - public void UpdateCredentials() { - /* + public void RestoreCredentials() { + if (Global.properties.lastMachineId != CommonConstants.Nan) { + getTable(Machine.class).getUI().SetCurrentByPK(Global.properties.lastMachineId); + //- + if (Global.properties.lastUserId != CommonConstants.Nan) + getTable(User.class).getUI().SetCurrentByPK(Global.properties.lastUserId); + //-- + if (Global.properties.lastCompilerId != CommonConstants.Nan) + getTable(Compiler.class).getUI().SetCurrentByPK(Global.properties.lastCompilerId); } - try { - Update(MainModule_.instance.getDb().getTable(Credentials.class).getUI().getCurrent()); - } catch (Exception ex) { - Utils_.MainLog.PrintException(ex); - } - */ } //-- public LinkedHashMap getSapforSettingsForProfile() { diff --git a/src/_VisualDVM/GlobalProperties.java b/src/_VisualDVM/GlobalProperties.java index 26cbff14..5b9bea8e 100644 --- a/src/_VisualDVM/GlobalProperties.java +++ b/src/_VisualDVM/GlobalProperties.java @@ -1,4 +1,5 @@ package _VisualDVM; +import Common.CommonConstants; import Common.Utils.Utils_; import Common.Visual.Controls.StableMenuItem; import _VisualDVM.Passes.PassCode; @@ -85,6 +86,14 @@ public class GlobalProperties { public boolean EmailOnTestingProgress = false; //включено ли оповещение по email о результатах тестирования. @Expose public boolean eraseTestingWorkspaces = true; //удалять ли рабочее пространство пакетов тестирования после его завершения + + @Expose + public int lastMachineId = CommonConstants.Nan; + @Expose + public int lastUserId = CommonConstants.Nan; + @Expose + public int lastCompilerId = CommonConstants.Nan; + public GlobalProperties(GlobalProperties p) { super(); Mode = p.Mode; @@ -125,6 +134,10 @@ public class GlobalProperties { CheckTestingIntervalSeconds = p.CheckTestingIntervalSeconds; EmailOnTestingProgress = p.EmailOnTestingProgress; eraseTestingWorkspaces = p.eraseTestingWorkspaces; + //- + lastMachineId = p.lastMachineId; + lastUserId = p.lastUserId; + lastCompilerId = p.lastCompilerId; } //-- public GlobalProperties() { diff --git a/src/_VisualDVM/Passes/All/CheckAccount.java b/src/_VisualDVM/Passes/All/CheckAccount.java index 6281497c..03eb5e12 100644 --- a/src/_VisualDVM/Passes/All/CheckAccount.java +++ b/src/_VisualDVM/Passes/All/CheckAccount.java @@ -1,5 +1,6 @@ package _VisualDVM.Passes.All; import Common.Passes.Pass; +import Common.Visual.UI; import _VisualDVM.Global; import _VisualDVM.Passes.PassCode; public class CheckAccount extends Pass { @@ -54,7 +55,7 @@ public class CheckAccount extends Pass { } @Override protected void showDone() throws Exception { - if (Global.mainModule.getUI().getMainWindow() != null) { + if (Global.mainModule.getUI().hasMainWindow()) { Global.mainModule.getUI().getMainWindow().getCallbackWindow().ShowAccount(); if (Global.componentsServer.db.bugReports.getUI().getCurrent() != null) Global.mainModule.getUI().getMainWindow().getCallbackWindow().ShowCurrentBugReport(); diff --git a/src/_VisualDVM/Visual/MainUI.java b/src/_VisualDVM/Visual/MainUI.java index d7908247..425d49e7 100644 --- a/src/_VisualDVM/Visual/MainUI.java +++ b/src/_VisualDVM/Visual/MainUI.java @@ -6,7 +6,7 @@ import _VisualDVM.TestingSystem.Common.TestingMenuBar; import _VisualDVM.Visual.Interface.DebugWindow; import _VisualDVM.Visual.Interface.VersionsWindow; import _VisualDVM.Visual.Menus.CredentialsBar.CredentialsMenuBar; -import _VisualDVM.Visual.Menus.MainMenuBar.MainWindow; +import _VisualDVM.Visual.Windows.MainWindow; import _VisualDVM.Visual.Menus.VersionsMenuBar.VersionsMenuBar; import _VisualDVM.Visual.Syntax.LightSPFEditorTheme; import _VisualDVM.Visual.Windows.*; diff --git a/src/_VisualDVM/Visual/Menus/MainMenuBar/MainMenuBar.java b/src/_VisualDVM/Visual/Menus/MainMenuBar/MainMenuBar.java index 6f83fe59..b7238394 100644 --- a/src/_VisualDVM/Visual/Menus/MainMenuBar/MainMenuBar.java +++ b/src/_VisualDVM/Visual/Menus/MainMenuBar/MainMenuBar.java @@ -53,6 +53,7 @@ public class MainMenuBar extends VisualiserMenuBar { //- setPreferredSize(new Dimension(0, 30)); //--- + /* add(new MenuBarButton() { { setIcon("/Common/icons/Apply.png"); @@ -62,6 +63,7 @@ public class MainMenuBar extends VisualiserMenuBar { }); } }); + */ ShowProject(false); } public void ShowUpdatesIcon() { diff --git a/src/_VisualDVM/Visual/Windows/MainForm.java b/src/_VisualDVM/Visual/Windows/MainForm.java index 6ae3c132..cd3e9a98 100644 --- a/src/_VisualDVM/Visual/Windows/MainForm.java +++ b/src/_VisualDVM/Visual/Windows/MainForm.java @@ -13,7 +13,6 @@ import _VisualDVM.Visual.Interface.ProjectWindow; import _VisualDVM.Visual.Interface.TestingWindow; import _VisualDVM.Visual.Interface.TestsWindow; import _VisualDVM.Visual.Menus.MainMenuBar.MainMenuBar; -import _VisualDVM.Visual.Menus.MainMenuBar.MainWindow; import javax.swing.*; import java.awt.*; diff --git a/src/_VisualDVM/Visual/Menus/MainMenuBar/MainWindow.java b/src/_VisualDVM/Visual/Windows/MainWindow.java similarity index 93% rename from src/_VisualDVM/Visual/Menus/MainMenuBar/MainWindow.java rename to src/_VisualDVM/Visual/Windows/MainWindow.java index 79242413..3df17718 100644 --- a/src/_VisualDVM/Visual/Menus/MainMenuBar/MainWindow.java +++ b/src/_VisualDVM/Visual/Windows/MainWindow.java @@ -1,4 +1,4 @@ -package _VisualDVM.Visual.Menus.MainMenuBar; +package _VisualDVM.Visual.Windows; import _VisualDVM.Visual.Interface.CallbackWindow; import _VisualDVM.Visual.Interface.ProjectWindow; import _VisualDVM.Visual.Interface.TestingWindow; diff --git a/src/_VisualDVM/Visual/Windows/TestingForm.java b/src/_VisualDVM/Visual/Windows/TestingForm.java index 8c3cee43..ce9f4004 100644 --- a/src/_VisualDVM/Visual/Windows/TestingForm.java +++ b/src/_VisualDVM/Visual/Windows/TestingForm.java @@ -1,4 +1,5 @@ package _VisualDVM.Visual.Windows; +import Common.CommonConstants; import Common.MainModule_; import Common.Visual.FormWithSplitters; import Common.Visual.TextField.StyledTextField; @@ -157,7 +158,7 @@ public class TestingForm implements FormWithSplitters, TestingWindow { Global.testingServer.db.dvmSettings.ShowUI(); Global.testingServer.db.sapforSettings.ShowUI(); //--- - RestoreLastCredentials(); + Global.mainModule.getDb().RestoreCredentials(); //--- if (Global.properties.AutoCheckTesting) TestingServer.TimerOn(); @@ -267,50 +268,7 @@ public class TestingForm implements FormWithSplitters, TestingWindow { sapforPackageTreeMaster.DoComparePass(); testingTabs.setSelectedIndex(3); } - public void RestoreLastCredentials() { - /* - Credentials credentials = MainModule_.instance.getDb().getTable(Credentials.class).get; - if (credentials.machine_id != CommonConstants.Nan) { - if (Global.mainModule.getDb().machines.containsKey(credentials.machine_id)) { - (Global.mainModule.getDb()).machines.ShowUI(credentials.machine_id); - if ((Global.mainModule.getDb()).users.containsKey(credentials.user_id)) { - (Global.mainModule.getDb()).users.ShowUI(credentials.user_id); - } else { - credentials.user_id = CommonConstants.Nan; - (Global.mainModule.getDb()).UpdateCredentials(); - } - if ((Global.mainModule.getDb()).compilers.containsKey(credentials.compiler_id)) { - (Global.mainModule.getDb()).compilers.ShowUI(credentials.compiler_id); - } else { - credentials.compiler_id = CommonConstants.Nan; - (Global.mainModule.getDb()).UpdateCredentials(); - } - //- - if ((Global.mainModule.getDb()).makefiles.containsKey(credentials.makefile_id)) { - (Global.mainModule.getDb()).makefiles.ShowUI(credentials.makefile_id); - } else { - credentials.makefile_id = CommonConstants.Nan; - (Global.mainModule.getDb()).UpdateCredentials(); - } - //- - if ((Global.mainModule.getDb()).runConfigurations.containsKey(credentials.runconfiguration_id)) { - (Global.mainModule.getDb()).runConfigurations.ShowUI(credentials.runconfiguration_id); - } else { - credentials.runconfiguration_id = CommonConstants.Nan; - (Global.mainModule.getDb()).UpdateCredentials(); - } - } else { - credentials.machine_id = CommonConstants.Nan; - credentials.user_id = CommonConstants.Nan; - credentials.compiler_id = CommonConstants.Nan; - credentials.remotesapfor_id = CommonConstants.Nan; - credentials.makefile_id = CommonConstants.Nan; - credentials.runconfiguration_id = CommonConstants.Nan; - (Global.mainModule.getDb()).UpdateCredentials(); - } - } - */ - } + @Override public void CollapseCredentials() { Global.mainModule.getDb().splitters.get("SC71").position = SC71.getDividerLocation();