no message

This commit is contained in:
2025-03-13 00:32:20 +03:00
parent 91e40c4393
commit 1d97048de1
204 changed files with 984 additions and 889 deletions

View File

@@ -147,28 +147,8 @@ public class db_project_info extends DBObject {
public DefaultMutableTreeNode filesTreeRoot = null;
public ProjectDatabase db = null;
public LinkedHashMap<String, DBProjectFile> allIncludes = new LinkedHashMap<>();
public SapforProperties sapforProperties = null;
DBLastProject info = null; //обновляется при открытии проекта.
public SapforProperties sapforProperties=null;
public void SynchronizeSapforProperties() throws Exception{
if (sapforProperties==null) {
File propertiesFile = getPropertiesFile();
if (propertiesFile.exists()) {
sapforProperties = Utils_.ReadProperties(propertiesFile,SapforProperties.class);
} else {
SapforProfile defaultProfile = Global.mainModule.getDb().getDefaultSapforProfile();
if (defaultProfile == null) {
sapforProperties = new SapforProperties(propertiesFile);
Utils_.jsonToFile(sapforProperties, propertiesFile);
} else {
sapforProperties = new SapforProperties(getPropertiesFile());
sapforProperties.applyProfile(Global.mainModule.getDb().getVectorByFK(defaultProfile, SapforProfileSetting.class));
}
}
}
}
public File getPropertiesFile(){
return new File(getDataDirectory(), "properties");
}
public db_project_info() {
}
//----------------------------------
@@ -239,6 +219,26 @@ public class db_project_info extends DBObject {
public static void sortVersionsByNumber(Vector<db_project_info> versions) {
versions.sort(Comparator.comparingInt(db_project_info::extractVersionNumber));
}
public void SynchronizeSapforProperties() throws Exception {
if (sapforProperties == null) {
File propertiesFile = getPropertiesFile();
if (propertiesFile.exists()) {
sapforProperties = Utils_.ReadProperties(propertiesFile, SapforProperties.class);
} else {
SapforProfile defaultProfile = Global.mainModule.getDb().getDefaultSapforProfile();
if (defaultProfile == null) {
sapforProperties = new SapforProperties(propertiesFile);
Utils_.jsonToFile(sapforProperties, propertiesFile);
} else {
sapforProperties = new SapforProperties(getPropertiesFile());
sapforProperties.applyProfile(Global.mainModule.getDb().getVectorByFK(defaultProfile, SapforProfileSetting.class));
}
}
}
}
public File getPropertiesFile() {
return new File(getDataDirectory(), "properties");
}
//-
public void Open() throws Exception {
db.Connect();
@@ -376,8 +376,8 @@ public class db_project_info extends DBObject {
return null;
}
public DBProjectFile getLastOpenedFile() {
Vector<DBProjectFile> sorted_= new Vector<>();
for (DBProjectFile f: db.files.Data.values()){
Vector<DBProjectFile> sorted_ = new Vector<>();
for (DBProjectFile f : db.files.Data.values()) {
if (!f.state.equals(FileState.Excluded) && !f.fileType.equals(FileType.forbidden)) {
sorted_.add(f);
}
@@ -389,17 +389,17 @@ public class db_project_info extends DBObject {
}
}.reversed());
LinkedHashMap<FileType, DBProjectFile> matches = new LinkedHashMap<>();
DBProjectFile sorceFile= null;
DBProjectFile sorceFile = null;
DBProjectFile headerFile = null;
for (DBProjectFile f: sorted_){
if (!matches.containsKey(f.fileType)){
for (DBProjectFile f : sorted_) {
if (!matches.containsKey(f.fileType)) {
matches.put(f.fileType, f);
}
}
Vector<FileType> priority = new Vector_<>(FileType.program, FileType.header, FileType.data, FileType.none);
for (FileType type: priority){
for (FileType type : priority) {
if (matches.containsKey(type))
return matches.get(type);
return matches.get(type);
}
return null;
}
@@ -1533,9 +1533,9 @@ public class db_project_info extends DBObject {
}
return true;
}
public DBProjectFile getMainProgramUnit(){
for (DBProjectFile file: db.files.Data.values()){
if (file.isMain!=0)
public DBProjectFile getMainProgramUnit() {
for (DBProjectFile file : db.files.Data.values()) {
if (file.isMain != 0)
return file;
}
return null;