завершение обновления с настройками
This commit is contained in:
2025-01-17 01:35:43 +03:00
parent 01da3b3a70
commit 28fe6ee235
8 changed files with 135 additions and 18 deletions

View File

@@ -168,4 +168,11 @@ public class GlobalDatabase extends VisualiserDatabase {
Insert(profile);
insertProfileSettings(profile);
}
public SapforProfile getDefaultSapforProfile(){
for (SapforProfile sapforProfile: sapforProfiles.Data.values()){
if (sapforProfile.isAuto!=0)
return sapforProfile;
}
return null;
}
}

View File

@@ -1,9 +1,12 @@
package _VisualDVM.GlobalData.SapforProfile;
import Common.Database.Objects.iDBObject;
import Common.Utils.Utils_;
import _VisualDVM.Global;
import _VisualDVM.GlobalData.SapforProfileSetting.SapforProfileSetting;
import com.sun.org.glassfish.gmbal.Description;
import javax.swing.*;
import java.util.Vector;
public class SapforProfile extends iDBObject {
@Description("DEFAULT ''")
public String description = "";

View File

@@ -85,6 +85,7 @@ public class OpenCurrentProject extends Pass<db_project_info> {
//как и отображать дерево.
target = project;
target.Open();
target.SynchronizeSapforProperties();
root_changes = false;
return;
}
@@ -92,11 +93,13 @@ public class OpenCurrentProject extends Pass<db_project_info> {
target = new db_project_info(dir);
new_root = target.CreateVersionsTree();
target.Open();
target.SynchronizeSapforProperties();
break;
case ProjectInfo:
//если нам суют версию. значит уже априори корень не сменится.
root_changes = false;
target.Open();
target.SynchronizeSapforProperties();
break;
}
}

View File

@@ -415,9 +415,8 @@ public class DBProjectFile extends ProjectFile {
break;
}
languageName = parent.languageName;
if (sapforStyle) style = father.sapforProperties.FREE_FORM? LanguageStyle.free : LanguageStyle.fixed;
if (sapforStyle) style = Global.mainModule.getProject().sapforProperties.FREE_FORM? LanguageStyle.free : LanguageStyle.fixed;
// Global.mainModule.getSapfor().getStyle();
else style = parent.style;
}
public void importSourceCodeSettings(DBProjectFile parent, boolean sapforStyle) throws Exception {
@@ -431,8 +430,7 @@ public class DBProjectFile extends ProjectFile {
break;
}
languageName = parent.languageName;
// if (sapforStyle) style = Global.mainModule.getSapfor().getStyle();
if (sapforStyle) style = father.sapforProperties.FREE_FORM? LanguageStyle.free : LanguageStyle.fixed;
if (sapforStyle) style = Global.mainModule.getProject().sapforProperties.FREE_FORM? LanguageStyle.free : LanguageStyle.fixed;
else style = parent.style;
}
//------------------

View File

@@ -11,6 +11,8 @@ import _VisualDVM.Constants;
import _VisualDVM.Current;
import _VisualDVM.Global;
import _VisualDVM.GlobalData.DBLastProject.DBLastProject;
import _VisualDVM.GlobalData.SapforProfile.SapforProfile;
import _VisualDVM.GlobalData.SapforProfileSetting.SapforProfileSetting;
import _VisualDVM.Passes.PassCode;
import _VisualDVM.ProjectData.DBArray.DBArray;
import _VisualDVM.ProjectData.Files.DBProjectFile;
@@ -146,9 +148,28 @@ public class db_project_info extends DBObject {
public LinkedHashMap<String, DBProjectFile> allIncludes = new LinkedHashMap<>();
DBLastProject info = null; //обновляется при открытии проекта.
public SapforProperties sapforProperties=null;
public void SynchronizeSapforProperties() {
public void SynchronizeSapforProperties() throws Exception{
System.out.println("Syncronize Sapfor Properties...");
sapforProperties = Utils_.SynschronizeProperties(getPropertiesFile(), SapforProperties.class);
if (sapforProperties==null) {
File propertiesFile = getPropertiesFile();
System.out.println("propertiesFile="+propertiesFile.getAbsolutePath());
if (propertiesFile.exists()) {
System.out.println("properties file found.");
sapforProperties = Utils_.ReadProperties(propertiesFile,SapforProperties.class);
} else {
System.out.println("properties file not found. try get default profile..");
SapforProfile defaultProfile = Global.mainModule.getDb().getDefaultSapforProfile();
if (defaultProfile == null) {
System.out.println("Default profile not found!");
sapforProperties = Utils_.ReadProperties(propertiesFile,SapforProperties.class);
} else {
System.out.println("Default profile is " + defaultProfile.description);
sapforProperties = new SapforProperties(getPropertiesFile());
sapforProperties.applyProfile(Global.mainModule.getDb().getVectorByFK(defaultProfile, SapforProfileSetting.class));
sapforProperties.Update();
}
}
}else System.out.println("properties object found");
}
public File getPropertiesFile(){
return new File(getDataDirectory(), "properties");
@@ -228,7 +249,6 @@ public class db_project_info extends DBObject {
db.Connect();
db.prepareTablesStatements();
db.Synchronize();
SynchronizeSapforProperties();
}
public void Close() throws Exception {
db.Disconnect();