json для инклудов

This commit is contained in:
2025-04-14 21:44:19 +03:00
parent cb1f19cfb7
commit 28eee09056
8 changed files with 47 additions and 21 deletions

10
.idea/workspace.xml generated
View File

@@ -7,10 +7,14 @@
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment=""> <list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/SapforData/Includes/Json/FileIncludesJson.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/SapforData/Includes/Json/IncludesJson.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/properties" beforeDir="false" afterPath="$PROJECT_DIR$/properties" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/SPF_GetGraphLoops.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/SPF_GetGraphLoops.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Constants.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Constants.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/SPF_GetIncludeDependencies.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/SPF_GetIncludeDependencies.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/SPF_GetGraphFunctionPositions.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/SPF_GetGraphFunctionPositions.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/SPF_InsertIncludesPass.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/SPF_InsertIncludesPass.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/SapforData/Includes/DependencyInfo.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/SapforData/Includes/Include.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/SapforData/Includes/FileInfo.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/SapforData/Includes/FileInfo.java" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />

View File

@@ -38,7 +38,6 @@ public class SPF_GetGraphLoops extends SapforAnalysis {
LoopsJson loopsJson = Utils_.gson.fromJson(packed, LoopsJson.class); LoopsJson loopsJson = Utils_.gson.fromJson(packed, LoopsJson.class);
for (FileLoopsJson fileLoopsJson : loopsJson.allLoops) { for (FileLoopsJson fileLoopsJson : loopsJson.allLoops) {
fileLoopsJson.file = Utils_.toW(fileLoopsJson.file); fileLoopsJson.file = Utils_.toW(fileLoopsJson.file);
System.out.println(fileLoopsJson.file);
DBProjectFile projectFile = target.db.files.get(fileLoopsJson.file); DBProjectFile projectFile = target.db.files.get(fileLoopsJson.file);
projectFile.saveLoops(fileLoopsJson.loops); projectFile.saveLoops(fileLoopsJson.loops);
target.numLoops += projectFile.AllLoops.size(); target.numLoops += projectFile.AllLoops.size();

View File

@@ -4,14 +4,7 @@ import _VisualDVM.Global;
import _VisualDVM.Passes.PassCode; import _VisualDVM.Passes.PassCode;
import _VisualDVM.Passes.Sapfor.SapforAnalysis; import _VisualDVM.Passes.Sapfor.SapforAnalysis;
import _VisualDVM.ProjectData.Files.DBProjectFile; import _VisualDVM.ProjectData.Files.DBProjectFile;
import _VisualDVM.ProjectData.Files.FileType; import _VisualDVM.ProjectData.SapforData.Includes.Json.IncludesJson;
import _VisualDVM.ProjectData.Files.LanguageStyle;
import _VisualDVM.ProjectData.LanguageName;
import _VisualDVM.ProjectData.SapforData.Includes.DependencyInfo;
import _VisualDVM.ProjectData.SapforData.Includes.FileInfo;
import _VisualDVM.Utils;
import javax.swing.tree.DefaultMutableTreeNode;
public class SPF_GetIncludeDependencies extends SapforAnalysis { public class SPF_GetIncludeDependencies extends SapforAnalysis {
boolean update_current = false; boolean update_current = false;
@Override @Override
@@ -34,6 +27,9 @@ public class SPF_GetIncludeDependencies extends SapforAnalysis {
} }
@Override @Override
public void unpack(String packed) throws Exception { public void unpack(String packed) throws Exception {
IncludesJson includesJson = Utils_.gson.fromJson(packed, IncludesJson.class);
System.out.println("packed="+packed);
/*
// update_current = false; // update_current = false;
FileInfo fileInfo = null; FileInfo fileInfo = null;
String[] data_ = packed.split("@"); String[] data_ = packed.split("@");
@@ -49,7 +45,7 @@ public class SPF_GetIncludeDependencies extends SapforAnalysis {
for (int j = 0; j < data__.length; ++j) { for (int j = 0; j < data__.length; ++j) {
if (data__[j].length() > 0) { if (data__[j].length() > 0) {
fileInfo.dependencies.add( fileInfo.dependencies.add(
new DependencyInfo(data__[j])); new Include(data__[j]));
//------------------------------------- //-------------------------------------
if (!target.addictedFiles.containsKey(fileInfo.file)) if (!target.addictedFiles.containsKey(fileInfo.file))
target.addictedFiles.put(fileInfo.file, fileInfo); target.addictedFiles.put(fileInfo.file, fileInfo);
@@ -84,13 +80,14 @@ public class SPF_GetIncludeDependencies extends SapforAnalysis {
for (FileInfo file : target.addictedFiles.values()) { for (FileInfo file : target.addictedFiles.values()) {
DefaultMutableTreeNode node = new DefaultMutableTreeNode( DefaultMutableTreeNode node = new DefaultMutableTreeNode(
file); file);
for (DependencyInfo h : file.dependencies) { for (Include h : file.dependencies) {
node.add(new DefaultMutableTreeNode(h)); node.add(new DefaultMutableTreeNode(h));
} }
target.includes_root.add(node); target.includes_root.add(node);
} }
target.numAddicted += target.addictedFiles.size(); target.numAddicted += target.addictedFiles.size();
target.UpdateAddictedCount(); target.UpdateAddictedCount();
*/
} }
@Override @Override
protected void showDone() throws Exception { protected void showDone() throws Exception {

View File

@@ -4,7 +4,7 @@ import Common.Visual.Selectable;
import _VisualDVM.Global; import _VisualDVM.Global;
import _VisualDVM.Passes.PassCode; import _VisualDVM.Passes.PassCode;
import _VisualDVM.Passes.Sapfor.SapforTransformation; import _VisualDVM.Passes.Sapfor.SapforTransformation;
import _VisualDVM.ProjectData.SapforData.Includes.DependencyInfo; import _VisualDVM.ProjectData.SapforData.Includes.Include;
import _VisualDVM.ProjectData.SapforData.Includes.FileInfo; import _VisualDVM.ProjectData.SapforData.Includes.FileInfo;
import java.util.Vector; import java.util.Vector;
@@ -23,11 +23,11 @@ public class SPF_InsertIncludesPass extends SapforTransformation {
} }
Vector<String> Result = new Vector<>(); Vector<String> Result = new Vector<>();
for (FileInfo fileInfo : target.addictedFiles.values()) { for (FileInfo fileInfo : target.addictedFiles.values()) {
Vector<DependencyInfo> selected_children = fileInfo.dependencies.stream().filter(Selectable::isSelected).collect(Collectors.toCollection(Vector::new)); Vector<Include> selected_children = fileInfo.dependencies.stream().filter(Selectable::isSelected).collect(Collectors.toCollection(Vector::new));
if (!selected_children.isEmpty()) { if (!selected_children.isEmpty()) {
Result.add(fileInfo.file); Result.add(fileInfo.file);
Result.add(String.valueOf(selected_children.size())); Result.add(String.valueOf(selected_children.size()));
for (DependencyInfo di : selected_children) for (Include di : selected_children)
Result.add(di.file); Result.add(di.file);
} }
} }

View File

@@ -8,7 +8,7 @@ import java.util.List;
import java.util.Vector; import java.util.Vector;
public class FileInfo extends FileObject { public class FileInfo extends FileObject {
@Expose @Expose
public List<DependencyInfo> dependencies = new Vector<>(); public List<Include> dependencies = new Vector<>();
public FileInfo(String file_in) { public FileInfo(String file_in) {
super(file_in); super(file_in);
} }
@@ -23,7 +23,7 @@ public class FileInfo extends FileObject {
return Utils_.getIcon("/Common/icons/File.png"); return Utils_.getIcon("/Common/icons/File.png");
} }
public void SelectAllChildren(boolean select) { public void SelectAllChildren(boolean select) {
for (DependencyInfo di : dependencies) for (Include di : dependencies)
di.Select(select); di.Select(select);
} }
} }

View File

@@ -1,9 +1,15 @@
package _VisualDVM.ProjectData.SapforData.Includes; package _VisualDVM.ProjectData.SapforData.Includes;
import Common.Utils.Utils_; import Common.Utils.Utils_;
import _VisualDVM.ProjectData.SapforData.FileObject; import _VisualDVM.ProjectData.SapforData.FileObject;
public class DependencyInfo extends FileObject { import com.google.gson.annotations.Expose;
public DependencyInfo(String file_in) { public class Include extends FileObject {
//JSON-
@Expose
public String dependencyName= "";
//-----
public Include(String file_in, String dependencyName_in) {
super(file_in); super(file_in);
dependencyName = dependencyName_in;
} }
@Override @Override
public String getSelectionText() { public String getSelectionText() {

View File

@@ -0,0 +1,12 @@
package _VisualDVM.ProjectData.SapforData.Includes.Json;
import _VisualDVM.ProjectData.SapforData.Includes.Include;
import com.google.gson.annotations.Expose;
import java.util.List;
import java.util.Vector;
public class FileIncludesJson {
@Expose
public String file;
@Expose
public List<Include> includes = new Vector<>();
}

View File

@@ -0,0 +1,8 @@
package _VisualDVM.ProjectData.SapforData.Includes.Json;
import com.google.gson.annotations.Expose;
import java.util.Vector;
public class IncludesJson {
@Expose
public Vector<FileIncludesJson> allIncludes = new Vector<>();
}