временное сохранение последнийх выбранных машины юзера и компилятора в пропертиес. концепция пропертиес будет дорабатываться потом.

This commit is contained in:
2024-11-17 16:24:47 +03:00
parent 493b19c5e4
commit 3dd7845d76
11 changed files with 61 additions and 89 deletions

View File

@@ -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<SettingName, String> getSapforSettingsForProfile() {