From 4ceed2256a15423119fc7f01b34226049cbfb35d Mon Sep 17 00:00:00 2001 From: David Craine Date: Sat, 10 Aug 2002 00:31:27 +0000 Subject: [PATCH] Final changes to PMD integration. This code should be ready for a new release. git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@682 51baf565-9d33-0410-a72c-fc3788e3496d --- pmd-jbuilder/copyfile.bat | 2 +- pmd-jbuilder/lib/PMDOpenTool.jar | Bin 119544 -> 120554 bytes .../sourceforge/pmd/jbuilder/PMDOpenTool.java | 24 +++++++++++++++--- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/pmd-jbuilder/copyfile.bat b/pmd-jbuilder/copyfile.bat index a5576fa1a1..1d42991455 100755 --- a/pmd-jbuilder/copyfile.bat +++ b/pmd-jbuilder/copyfile.bat @@ -1,2 +1,2 @@ copy lib\PMDOpenTool.jar %1 -copy lib\pmd-0.8.jar %1 \ No newline at end of file +rem copy lib\pmd-0.8.jar %1 \ No newline at end of file diff --git a/pmd-jbuilder/lib/PMDOpenTool.jar b/pmd-jbuilder/lib/PMDOpenTool.jar index 774c2cf8d62cf4be7436e3e369a02d75147f25bf..b9ddc55546ceb9d982cd0d2dc0c05402e167af22 100644 GIT binary patch delta 7870 zcma($2|$%qvophT?)^A|f*=&Ybhj9DZG^F2AC5|Gr+{ z2FQ)%RB~!Rw8+7S8hDi~eejJ?@8gf801r z0B6ayIklX{ZaO-aw)VXs*|r$l&gY@>XOzpUlydeT0&M`x@3 zh1A|!-mmoEY`s4>c$0+(3_D`s$a{}j`0B{~D3Kd7t5twy$$|qNE|xd|N*v~{WNd6E z%|yesdvSoXivi2QRPdC73IkTa(*}6KN(1`CGj@o8X9cVh@SK3v0-jf}#sCd3$je#* zFN*v+q1G$dU_cj_UNs;DHW{!PwkX&t%t|}F2CuU|CsY~WhHVPoFu41h zGRAfpZHJw~TMBmCV3z^AVUL2n1~i6!0`?1dTfhMWn!!OE91{GFa1P5j@5(qw#K@xx zjv3Gfj@#h`oD^NB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=3751R>n>^{s8ym=oE6CAT29~C@xKRzb-`y$-+K(N3201g#; zwSzc9@Jk2XaW5aj;nE#hgwGb?tPg|qtse%5#~#M+ZX$Z`&DZ1}4!U~mFvd~cbxz0i z51H`&s1qa|o=|Dek!xH6$(Qbi><(zWfhE(7?<0(MB^zz6)UP@3Zu#om5pwaQt!CRt znCVJAle_1sQd~94SNA@t$ahWD5p3#8-7CBR9=uO#!XCDo;A~wSZPpw?$=%J4BkXtf zL6^Sjd>LnSn=of<6U&{0@T-5!{AGvl@{b?$n4J9>;nmR+2!tr;jnOSHgY-6m&3fKctMdD{)s(z zt>B#`U+R5ctZgdd70uuRj1l9$0@kshgAi+&Lj_nui06f9cM1}BbwOoPPX?W7aFRLo zx&=90p(!(mId1GfoB8`y)8r(_KA~rjf9WKaaD#ZSZUd-wpF38cpeR>zLD5tLeqE2HRUvI}x@y}S#)4}QGFpZ{-464g# zqU+?n%21w%|M?f5BcjP>*H~Vba%X~(sD6f(G~Xbc3QqBJmKk-XDEI@*zY_BrzX!;7 b|52X5<&Jo$*`0?`=F}N1?wRtwRQ&$|k9mJu diff --git a/pmd-jbuilder/src/net/sourceforge/pmd/jbuilder/PMDOpenTool.java b/pmd-jbuilder/src/net/sourceforge/pmd/jbuilder/PMDOpenTool.java index 3fcfae3ac1..768146a928 100644 --- a/pmd-jbuilder/src/net/sourceforge/pmd/jbuilder/PMDOpenTool.java +++ b/pmd-jbuilder/src/net/sourceforge/pmd/jbuilder/PMDOpenTool.java @@ -364,7 +364,8 @@ public class PMDOpenTool { Tile t = (Tile)iter.next(); resultCount++; int tileLineCount = cpd.getLineCountFor(t); - CPDMessage msg = CPDMessage.createMessage("Duplicate code set: " + resultCount, t.getImage()); + int dupCount = results.getOccurrenceCountFor(t); + CPDMessage msg = CPDMessage.createMessage(String.valueOf(dupCount)+" duplicates in code set: " + resultCount, cpd.getImage(t)); for (Iterator iter2 = results.getOccurrences(t); iter2.hasNext(); ) { TokenEntry te = (TokenEntry)iter2.next(); msg.addChildMessage(te.getBeginLine(), tileLineCount, te.getTokenSrcID()); @@ -373,7 +374,6 @@ public class PMDOpenTool { } } cpdd.close(); - } catch (Exception e) { Browser.getActiveBrowser().getMessageView().addMessage(cpdCat, e.toString()); @@ -459,6 +459,8 @@ class PMDMessage extends Message { */ class CPDMessage extends Message { final static LineMark MARK = new HighlightMark(true); + static Font PARENT_FONT = new Font("SansSerif", Font.BOLD, 12); + static Font CHILD_FONT = new Font("SansSerif", Font.PLAIN, 12); String filename; FileNode javaNode = null; int startline = 0; @@ -498,6 +500,7 @@ class CPDMessage extends Message { public static CPDMessage createMessage(String msg, String codeBlock) { CPDMessage cpdm = new CPDMessage(msg, codeBlock); cpdm.isParent = true; + cpdm.setFont(PARENT_FONT); return cpdm; } @@ -508,6 +511,7 @@ class CPDMessage extends Message { String msg = fileName.substring(fileName.lastIndexOf(sep.charAt(0))+1)+": line: " + String.valueOf(startline); CPDMessage cpdmsg = new CPDMessage(msg, startline, endline, fileName); cpdmsg.isParent = false; + cpdmsg.setFont(CHILD_FONT); childMessages.add(cpdmsg); } @@ -572,6 +576,7 @@ class CPDMessage extends Message { class CodeFragmentMessage extends Message { String codeFragment = null; + static Font CODE_FONT = new Font("Monospaced", Font.ITALIC, 12); public CodeFragmentMessage(String codeFragment) { super("View Code"); this.setLazyFetchChildren(true); @@ -579,8 +584,19 @@ class CodeFragmentMessage extends Message { } public void fetchChildren(Browser browser) { - browser.getMessageView().addMessage(PMDOpenTool.cpdCat, this, new Message(codeFragment)); - } + BufferedReader reader = new BufferedReader(new StringReader(codeFragment)); + try { + String line = reader.readLine(); + while (line != null) { + Message msg = new Message(line); + msg.setFont(CODE_FONT); + browser.getMessageView().addMessage(PMDOpenTool.cpdCat, this, msg); + line = reader.readLine(); + } + } + catch (Exception e){} + + } }