Skip to content
Permalink
Browse files

graphlib for detecting code structure on graph view

  • Loading branch information
jindrapetrik committed Feb 10, 2018
1 parent 1abdd0b commit 7810a84ad229ad2fadf33842160a1432d9fbdc7b
BIN -42.6 KB (94%) antlib/jacocoant.jar
Binary file not shown.
BIN +89.1 KB lib/graphs.jar
Binary file not shown.
Binary file not shown.
@@ -239,7 +239,7 @@ auxiliary.show.customizer.message=<message>
<java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/4">
<compilation-unit>
<package-root>src</package-root>
<classpath mode="compile">../../lib/LZMA.jar;../../lib/avi.jar;../../lib/gif.jar;../../lib/gnujpdf.jar;../../lib/jl1.0.1.jar;../../lib/jpacker.jar;../../lib/nellymoser.jar;../../lib/sfntly.jar;../../lib/ttf.jar;../../lib/cmykjpeg.jar;../../src;../../lib/flashdebugger.jar</classpath>
<classpath mode="compile">../../lib/LZMA.jar;../../lib/avi.jar;../../lib/gif.jar;../../lib/gnujpdf.jar;../../lib/jl1.0.1.jar;../../lib/jpacker.jar;../../lib/nellymoser.jar;../../lib/sfntly.jar;../../lib/ttf.jar;../../lib/cmykjpeg.jar;../../src;../../lib/flashdebugger.jar;../../lib/graphs.jar</classpath>
<built-to>build</built-to>
<built-to>reports</built-to>
<built-to>dist</built-to>
@@ -48,6 +48,9 @@

private final String BLOCK_STYLE = "shape=\"box\"";

private static final int INS_LEN_LIMIT = 50;
private static final String ELIPSIS = "...";

private String getBlockName(GraphSource list, GraphPart part) {
return "loc" + Helper.formatAddress(list.pos2adr(part.start, true));
}
@@ -108,7 +111,11 @@ public void export(Graph graph, GraphTextWriter writer) throws InterruptedExcept
if (knownAddresses.contains(graphSource.get(j).getAddress())) {
blkCodeBuilder.append("loc").append(Helper.formatAddress(graphSource.get(j).getAddress())).append(":\r\n");
}
blkCodeBuilder.append(graphSource.insToString(j)).append("\r\n");
String insStr = graphSource.insToString(j);
if (insStr.length() > INS_LEN_LIMIT) {
insStr = insStr.substring(0, INS_LEN_LIMIT - ELIPSIS.length()) + ELIPSIS;
}
blkCodeBuilder.append(insStr).append("\r\n");
}
}
String labelStr = blkCodeBuilder.toString();
@@ -323,7 +323,7 @@
<java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/4">
<compilation-unit>
<package-root>src</package-root>
<classpath mode="compile">lib/LZMA.jar;lib/jna-3.5.1.jar;lib/jpproxy.jar;lib/trident-6.2.jar;lib/substance-flamingo-6.2.jar;lib/flamingo-6.2.jar;lib/substance-6.2.jar;lib/jl1.0.1.jar;lib/nellymoser.jar;lib/gif.jar;lib/avi.jar;lib/ttf.jar;lib/jpacker.jar;lib/sfntly.jar;lib/gnujpdf.jar;libsrc/ffdec_lib/src;lib/tablelayout.jar;lib/jsyntaxpane-0.9.5.jar;lib/JavactiveX.jar;lib/flashdebugger.jar;lib/treetable.jar;lib/minimal-json-0.9.5.jar</classpath>
<classpath mode="compile">lib/LZMA.jar;lib/jna-3.5.1.jar;lib/jpproxy.jar;lib/trident-6.2.jar;lib/substance-flamingo-6.2.jar;lib/flamingo-6.2.jar;lib/substance-6.2.jar;lib/jl1.0.1.jar;lib/nellymoser.jar;lib/gif.jar;lib/avi.jar;lib/ttf.jar;lib/jpacker.jar;lib/sfntly.jar;lib/gnujpdf.jar;libsrc/ffdec_lib/src;lib/tablelayout.jar;lib/jsyntaxpane-0.9.5.jar;lib/JavactiveX.jar;lib/flashdebugger.jar;lib/treetable.jar;lib/minimal-json-0.9.5.jar;lib/graphs.jar</classpath>
<built-to>build</built-to>
<built-to>javadoc</built-to>
<built-to>reports</built-to>
@@ -21,6 +21,7 @@
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
import com.jpexs.decompiler.flash.helpers.StringBuilderTextWriter;
import com.jpexs.decompiler.graph.Graph;
import com.jpexs.graphs.graphviz.graph.operations.codestructure.CodeStructureModifyOperation;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
@@ -51,8 +52,11 @@ public GraphVizGraphPanel(Graph graph) throws InterruptedException {
StringBuilder sb = new StringBuilder();
StringBuilderTextWriter sbWriter = new StringBuilderTextWriter(null, sb);
ex.export(graph, sbWriter);
String original = sb.toString();
CodeStructureModifyOperation structureModify = new CodeStructureModifyOperation();
String structured = structureModify.execute(original, null);
try {
image = new GraphVizDotCommands().dotToImage(sb.toString());
image = new GraphVizDotCommands().dotToImage(structured);
} catch (IOException ex1) {
logger.log(Level.SEVERE, "Exporting image failed", ex1);
image = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB);

0 comments on commit 7810a84

Please sign in to comment.
You can’t perform that action at this time.