Main Page   Packages   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

CodeBrowserPane.java

00001 package edu.ksu.cis.bandera.pdgslicer.dependency;
00002 
00003 import javax.swing.*;
00004 import javax.swing.tree.*;
00005 import java.util.*;
00006 import java.awt.Color;
00007 import ca.mcgill.sable.soot.*;
00008 import ca.mcgill.sable.soot.jimple.*;
00009 import edu.ksu.cis.bandera.util.Preferences;
00010 import edu.ksu.cis.bandera.jjjc.CompilationManager;
00011 import edu.ksu.cis.bandera.bui.session.datastructure.Session;
00012 import edu.ksu.cis.bandera.jjjc.symboltable.Name;
00013 import edu.ksu.cis.bandera.jjjc.symboltable.Package;
00014 import edu.ksu.cis.bandera.jjjc.symboltable.Method;
00015 import edu.ksu.cis.bandera.jjjc.symboltable.Variable;
00016 import edu.ksu.cis.bandera.annotation.*;
00017 import edu.ksu.cis.bandera.bui.BUI;
00018 import edu.ksu.cis.bandera.bui.BUISessionPane;
00019 import edu.ksu.cis.bandera.bui.IconLibrary;
00020 import edu.ksu.cis.bandera.specification.predicate.datastructure.PredicateSet;
00021 import edu.ksu.cis.bandera.specification.predicate.datastructure.Predicate;
00022 import edu.ksu.cis.bandera.specification.assertion.datastructure.Assertion;
00023 import edu.ksu.cis.bandera.specification.assertion.datastructure.AssertionSet;
00024 import edu.ksu.cis.bandera.pdgslicer.PostProcessOnAnnotation;
00025 import edu.ksu.cis.bandera.pdgslicer.datastructure.*;
00026 /**
00027  * Insert the type's description here.
00028  * Creation date: (00-10-23 15:13:56)
00029  * @author: 
00030  */
00031 public class CodeBrowserPane extends JPanel implements java.awt.event.MouseListener, javax.swing.event.TreeSelectionListener {
00032     private PostProcessOnAnnotation postProcessOnAnnotation = null;
00033     private ca.mcgill.sable.util.Set removablePackages = new ca.mcgill.sable.util.ArraySet();
00034     private ca.mcgill.sable.util.Set modifiedPackages = new ca.mcgill.sable.util.ArraySet();
00035     private ca.mcgill.sable.util.Set removableSootClasses = new ca.mcgill.sable.util.ArraySet();
00036      ca.mcgill.sable.util.Set unreachableSootClasses = new ca.mcgill.sable.util.ArraySet();
00037     private ca.mcgill.sable.util.Set modifiedSootClasses = new ca.mcgill.sable.util.ArraySet();
00038     private ca.mcgill.sable.util.Set removableSootFields = new ca.mcgill.sable.util.ArraySet();
00039     private ca.mcgill.sable.util.Set removableSootMethods = new ca.mcgill.sable.util.ArraySet();
00040      ca.mcgill.sable.util.Set reachableSootMethods = new ca.mcgill.sable.util.ArraySet();
00041     private ca.mcgill.sable.util.Set modifiedSootMethods = new ca.mcgill.sable.util.ArraySet();
00042     private ca.mcgill.sable.util.Set parameterModifiedMethods = new ca.mcgill.sable.util.ArraySet();
00043     private Dependencies dependFrame;
00044     private boolean setSelectedByProgram = false;
00045     private JSplitPane ivjCodeSplitPane = null;
00046     private DraggableHierTree ivjHierTree = null;
00047     private JScrollPane ivjHierTreeScrollPane = null;
00048     private DraggableMethodTree ivjMethodTree = null;
00049     private JScrollPane ivjMethodTreeScrollPane = null;
00050 /**
00051  * CodeBrowserPane constructor comment.
00052  */
00053 public CodeBrowserPane() {
00054     super();
00055     initialize();
00056 }
00057 /**
00058  * CodeBrowserPane constructor comment.
00059  * @param layout java.awt.LayoutManager
00060  */
00061 public CodeBrowserPane(java.awt.LayoutManager layout) {
00062     super(layout);
00063 }
00064 /**
00065  * CodeBrowserPane constructor comment.
00066  * @param layout java.awt.LayoutManager
00067  * @param isDoubleBuffered boolean
00068  */
00069 public CodeBrowserPane(java.awt.LayoutManager layout, boolean isDoubleBuffered) {
00070     super(layout, isDoubleBuffered);
00071 }
00072 /**
00073  * CodeBrowserPane constructor comment.
00074  * @param isDoubleBuffered boolean
00075  */
00076 public CodeBrowserPane(boolean isDoubleBuffered) {
00077     super(isDoubleBuffered);
00078 }
00079 /**
00080  * 
00081  * @return javax.swing.tree.DefaultMutableTreeNode
00082  * @param sc ca.mcgill.sable.soot.SootClass
00083  */
00084 private DefaultMutableTreeNode buildClassNode(SootClass sc) {
00085     AnnotationManager am = CompilationManager.getAnnotationManager();
00086     Set ts = new TreeSet();
00087     for (ca.mcgill.sable.util.Iterator i = sc.getFields().iterator(); i.hasNext();) {
00088         ts.add(am.getAnnotation(sc, i.next()));
00089     }
00090     for (ca.mcgill.sable.util.Iterator i = sc.getMethods().iterator(); i.hasNext();) {
00091         ts.add(am.getAnnotation(sc, i.next()));
00092     }
00093     DefaultMutableTreeNode node = new DefaultMutableTreeNode(sc);
00094     for (Iterator i = ts.iterator(); i.hasNext();) {
00095         node.add(new DefaultMutableTreeNode(i.next()));
00096     }
00097     return node;
00098 }
00099 /**
00100  * 
00101  * @return javax.swing.tree.DefaultMutableTreeNode
00102  * @param p edu.ksu.cis.bandera.jjjc.symboltable.Package
00103  */
00104 private DefaultMutableTreeNode buildPackageNode(Package p) {
00105     DefaultMutableTreeNode pNode = new DefaultMutableTreeNode(p);
00106     Hashtable compiledClasses = CompilationManager.getAnnotationManager().getAnnotationTable();
00107     ca.mcgill.sable.util.Set scs = new ca.mcgill.sable.util.ArraySet();
00108     for (Enumeration e = compiledClasses.keys(); e.hasMoreElements();) {
00109         SootClass sc = (SootClass) e.nextElement();
00110         Name cName = new Name(sc.getName());
00111         if (cName.getSuperName().equals(p.getName()))
00112             scs.add(sc);
00113     }
00114     for (ca.mcgill.sable.util.Iterator j = scs.iterator(); j.hasNext();) {
00115         SootClass sc = (SootClass) j.next();
00116         //Hashtable scHashtable = (Hashtable) compiledClasses.get(sc);
00117         pNode.add(buildClassNode(sc));
00118     }
00119     return pNode;
00120 }
00121 /**
00122  * connEtoC1:  (HierTree.treeSelection. --> CodeBrowserPane.hierTree_TreeSelectionEvents()V)
00123  */
00124 /* WARNING: THIS METHOD WILL BE REGENERATED. */
00125 private void connEtoC1() {
00126     try {
00127         // user code begin {1}
00128         if (!setSelectedByProgram)
00129             
00130             // user code end
00131             this.hierTree_TreeSelectionEvents();
00132         // user code begin {2}
00133         // user code end
00134     } catch (java.lang.Throwable ivjExc) {
00135         // user code begin {3}
00136         // user code end
00137         handleException(ivjExc);
00138     }
00139 }
00140 /**
00141  * connEtoC3:  (MethodTree.mouse.mouseClicked(java.awt.event.MouseEvent) --> CodeBrowserPane.methodTree_MouseClicked(Ljava.awt.event.MouseEvent;)V)
00142  * @param arg1 java.awt.event.MouseEvent
00143  */
00144 /* WARNING: THIS METHOD WILL BE REGENERATED. */
00145 private void connEtoC3(java.awt.event.MouseEvent arg1) {
00146     try {
00147         // user code begin {1}
00148         // user code end
00149         this.methodTree_MouseClicked(arg1);
00150         // user code begin {2}
00151         // user code end
00152     } catch (java.lang.Throwable ivjExc) {
00153         // user code begin {3}
00154         // user code end
00155         handleException(ivjExc);
00156     }
00157 }
00158 /**
00159  * connEtoC4:  (MethodTree.treeSelection. --> CodeBrowserPane.methodTree_TreeSelectionEvents()V)
00160  */
00161 /* WARNING: THIS METHOD WILL BE REGENERATED. */
00162 private void connEtoC4() {
00163     try {
00164         // user code begin {1}
00165         if (!setSelectedByProgram)
00166         // user code end
00167         this.methodTree_TreeSelectionEvents();
00168         // user code begin {2}
00169         // user code end
00170     } catch (java.lang.Throwable ivjExc) {
00171         // user code begin {3}
00172         // user code end
00173         handleException(ivjExc);
00174     }
00175 }
00176 /**
00177  * 
00178  */
00179 /* WARNING: THIS METHOD WILL BE REGENERATED. */
00180 private static void getBuilderData() {
00181 /*V1.1
00182 **start of data**
00183     D0CB838494G88G88GAA0C01A9GGGGGGGGGGGG8CGGGE2F5E9ECE4E5F2A0E4E1F4E135BB8DF4D4551969CAB53B07DA5CCDD7568D676091ADEEF35C28000028D18103A6889294B1EAD0EA719C34584DD6FA162DF706C423D28CC2B516D8A3A4E1C2E29212E883DACD488F89A4A4B2E3928AADF9B3731899B319995F3C18C0515D6F3B77FDEF5ECCE6A6810FB967634D7D6E3D5F7D6E77F73F6F3E875B755E4CFC13F997E326FC267D7D4944D842C70CBDF94550F942D525E61A18616FFD009D6C
00184     05B3F9707C847A32FE1EE9AAE4BF3597C03B975A5B207DB67C5E4912FBD39B60C70CF592216F135F3AE647DF6759D6DA67955EFEFF6FB6F8EE873081EE8CE0F1AA2EFFF0EF1106CF0676F66DB702498CFB3A99473CD4DFE440975CAC4659606986A83D8547587696EB7D690043B1B9G395A58EDB066D54E5DD7BD0D5A38C5853319DAF7527CBBDC4BC01F40FB0B18BBCDFB9682C7A8082D2C68742738375EA1572732F324FAA8B8D26D70842B6D124FA9ABD2F540698AFABD8ED929F64A8199F0BE4739C307DA7C
00185     CE7930629F8D4ACA2F641301402D48F7D9C3812789FC43BAD3B9EEC6834A2A95FE1F86D0EFA55E1F6F7EC463ED7039392C7689FBCC5ED75CAAF84E3DB5447B0A97EFB74F1A03743F613A40F98D50768288DE166CA5DEB64CA1DE3AEBF1EC495CCCD3A3C06FDC426FBA00F8B73493G264FA59E1F7A0CF8743A97305C9A17790D98BC264E953C2D199B62F156419B725E6176B2520EBA5FB58F5685688288GCC83C885584D6D3436EDBFBC1B6DEA0BFFF8586FEB8E848EFB1DCAB7885A8B3F8F9D029E8DF7C2F678
00186     95A7E3429677B7D4C56107A0FDDE389DA2083D75B3321D69661BD862FB8A3707483D594E9EB1E7EBB4B64D8B6D4DF29B4AED4707A837C2780D73109F01FF17633D863C5055F55C9630BD857AB65CC6F2CE3290AF5B7EF996CBF11DB03F920517417BFC662E790287677C90AFC246BD9DA863E900CF81D88C108D308520F8814978FCDB7DC4B26E74293262133C5691FBC0D25443A39EAF7801A66B4B764613F5B490732E3A68F9C2AE336B0DBAAA383DAF2ADC9296594D0D8B04BCFA970464A2563EBF665A018563
00187     EDE33B2E433B392FCCD9A0F438D547BF4071C9863C502D1563F99B7A8A96E61A4478C46EDB5E0511B6124471D396C65A489F8E100DA4C39F3BBD53A4747BDCA746C4A73493G268324822CG58884096110E173455CC520FFA8D7A95F33FEDFF8B1E72182AC81D3E20AA799CF21F24F8A43BD78EB2ED4C956D481BBDEC5ED46E5F8ED863086C032829FA7CBE20AE8D4BE0CCC1B166A76DBBF00CA273DE1BE7D8068506830C684EE85F09F212026A978127244A2191227F7AF634092F25BE208884D0570BD0DE4DBC
00188     6616406FCF96112C7EF08CF1C950CE5165D2F264CDF89E8363163D078E35FA9C4806241CA39BFD1B7BEC9A0CAF3E83E4FB079E27874886B77F7CA636E61EB52A8DF21B3BD35813654EC89B5C4BE97782BEGB06DCEBAC7EFEC9808E11B48C7AC5FC07E6279CE2A56AF5638A7669ADB6350481F40BFDF511EC25E09DD383FD458D7864046BBC966270E1488DBBCAC85E5323E9E858CC7F606B4A0468EF46059A2FFAD7B54D66D24D5031A6E4FF43C9A324B33FE5DE6E40E47B8558206935471C39DBB849EE8982D1C
00189     7A033CDFD2D545E39FD1E52B2C2A9E1FABB47F6F1C17E0D8888CEAFB7D27EE5CEB5EDDE0A7GD5F751DE73BAF79A6C2B4B6F9F9A895850F3B4BBDD474F63A698BFF097697F3EDA4C2BAE686D153C9D6ABFD99BCBF75F85F03D10FDA85F4B9AE4DBE20DAB7518162F49D8602F61786940CF9A4086FD5FA5870CBC659B6CEDA258BD09B1E20D03635608678F51ECFFA2BEF63297BBE35B74EFBB235BF45E5168B67D5A5178B67B6651E8B6AB7A5EB90A7B730F7A8CBE704723988F9DFE1FCF660E28CF51E4713C8D77
00190     6171F954FE0F53A52BD64FF948F39B53501687F84CAD045F25E994A7C777D21CF4765D481A3EE9091ACF4D5C61B5DFC853F27134D01C94BC3DF78C6DC1764A43A028967F08CF9578B29E4FB5FCF0AB47ADEC6B01E7092543A3ABB6C5162BD478478AE378EE2ACBBE7860531208B43D4A2D0DBDE3B30EEDC37D84AD95FD9575CC507E8F6F651CF6372C3A7DCECEFD58BF92142B793FADD08F8C49CE4B175257D235B42AD6F385D7F7E39F27D591F571E11D5819EEA3192E18F4BE86166A18465366F6DBA4CF135831
00191     E15198FBBED0AF625A9D47F98C871DAC8648CE2338F66DB16C273826856F963FD7A384FD363B51A67ABE5CE550F3EE1A288B1B20CF744FE80C563FDD1F3FACEAFF725D444715DD05E85F72D7A3D0024998D80F4967A83768FAB3222FCF720E04F21699DD2F4353EB084982BF2DBB3A3D7DEBB74661A11D7EB55DAFB34CBD84CD619F2992528CA81EE1B8427010516A5B4DFB0D75EDAA700F35F096BCB7G0839F3C651D7A30B4804FBF0FE66812AFD99340BG9A6F91B4EC7788F909F109F5B4AE835A6B81726E95
00192     631A6EB50EBBD6CF63265CAB46913DE4EDDC463DB84E2F572EB5BA6EF20E5B87816F33BC4A493B8B0DB537F725BD2A1FF33FDEAC6817AE0E2CD5FE5503F4DB81EFDBCC7A5DF55CF8FEB68703FE0707270A1A2E6EBDEE0C818217FE7CB5F81E75A8C128DB1C729869FB79F16495F3C98D2D696CE715FFE663F363B627C775AB141E340CF25F3079D1BD9DE0B2ADFA086C734823A882DEB37F68C31217FBB14540EB6A0CB57D5453ED6657E348E626A613B403ECF220DE963459C1224D16104D7CD7855A953F274000
00193     B1D69D9C0578FF6850D1349D2F18E7AFAD50765A3804EA7BAB77210D87201D88B093C054993F66E7AF0E1D8F38CDCB48CFEB2B0CFEE8D91AE9D281268308B87457BA4407079E126FF5956F21BC62C7D94D0ED8EF1336C6CAEBAAF36F9F08FA37106D795C1C32D448A8EBE9C8D6E3A7EF481B8AA076F2F39D6D2564BE482F6E233DE4159B77B28D70B9GF9693417227A8F60F9D121DD3725607007B877D202BA23DACF2DA73E0B00275EF452F5510E7743E9471024FE17D19766137F1B9053A79353058C1353A3FD
00194     72614F51F66683BEA31DFC3233E70741A7CF4072124F65456BAEAD3F69C1B9C21C545A7F53036B72B849A84F9AE83C185ABFA71DEA381DD654DDAE348B17C1AD8D5084B0380CF87B075E896FB25A46625CE5649F3C983E9216D1EE6AAA0D1C1734ACD40F4DDEB63EB693753E59023ADE34AC72BEE19B47E7AC0B3CCFC85AC777895938777BE97DAD87A2571FF5FF781AE991EDB16F353A48F955916D75917304ADDE7B897A69C55E0F36AA124B0587ADE5E762EC3CE63F71EC5C826BD99E48B4F5818CBEC077162E
00195     AA0AE1E38F10ADF8ECF80625C2BB83E0BD0E4D005C9320894019C1B63132B7DAFC8F3709D841BDD4A38AF95DB6CEDE13137312F1737E98511E1291CD4EAFFEFB78BB48B9149552BD7BBF16C613F5B22C1D1AC132FEFD9F49BABD036C6BFC7D256DBBF15C3CC87BE219617304EEEF7C82F9A802BECBA669317AF33C8B2738536B7778D4C6B167314FB19773AB9E1747C7389C0EF37895DE6008FA5B5F08F49B0126CD273B5B9A3B9E5BE30DDE0FD92C516B31EAEB7CBB060F2C316AB541DF71C1624F8DA0F05F7273
00196     7B8234276938D365081B836D0CCC52D101857353CDFA7BCD5EC67DEAF575BEE3ED3BA9B37EFD514502D8635630B5A6DBBBCF965E65B4173D758617F1B0A887396336CA2A24757DC27DBD0BD23F9E1706E5C6B5D3FD5D2B5A18B6555FF2C077B5D75B3BACEAAEE5F5A8D059E82FF4049F35D80CFE34ED39383FE900E747F272230776D33EB6381C722E3FD7723B8DE8278224AFA75DF82BE21DBBB9B0A6F779F8DDE9F7D6365836FB5E965DF693EC68C7C17F086210A36D738ADB115E970A021D2ABC0CA2546AA3BE
00197     DF1594287FA367DF4D670B3ED873E75AE27900504F73E17A4173DC4873EE6E87A82F0287C91E6F1523BC1B20BDG90F81064D938AF16BC93E1CC72036365A9563E395E38F6033E2F1B3E40F3F8CCEF5F425B67F45B111B376B7BEE73B935602455CBBC667C8260B7E64255F3BF5F8B13F71AE86D1F14E23C72CA677CA3B037F8850ECB5163F5AA701C8E3089A0EF0530B731764D23D8CF1CD524E19023B5A0BB58E6BED7A92739CEE80F81CC87188F30E685653AD3BBD117F86ED983DE0F2A5938207B6F5545B17C
00198     C19FAAEC5AC267C553CA524B53952817B1E8CF83183D127472487EF879D55A4AD8F952AF395FE42D0C4C13FE43716BD7C666C9BF2824BCA9977A869E2238F9994FA396C1BBCB472D9D22D83A61A162F3291E4FEDDB15E9AAD9954ED7432AD8FC7E8B37470ED511FC4E607801D511FC1615931FEE684BD8C5BC6D5BC7FC56E6912E300678EC4D22FAAD2B145E733A81B7B30BEC62196A5DC65DE14DF16850E1BF5E53F4E9864675D4DCD6204DDF13C53ABBDA465FDF2E06339720E9B555316737D29D3B25E29E3B70
00199     72D054F753D5371FB48F2C96723930BAD4CFCC536B5869653466FC685F349AF1CB43EAB21447E7E611AB087E4DE17D98BF30668A756F5FE76CC7FEDF5CEA6CBF9D561FEF18AF76D6F90A76E67BE8A1EB3C2CA766FB774607451ECEEB4F5E9BBA5946E797EB6FF492AC716CBB6961F03B197DB03D8F6C5F4F6B000705FD646BF6E3677895863C507B3395D4A32E073E0EC748C61E5FCFB61272885972FFD7E29E30C6EF3F445BF807A45AD7D4DE4ADDBF521BFCDEB073125618EC7EA0E259B5D5F86FE3179CC3AE45
00200     BF62F3B2D63A86E5F28B77790D406FE6849E9BDF9822586806B197G12819681E42FA1D9BE4E4F1BAD50AEF914F09FF1FFE90076E99DF7D59949BC70A849745F4AD14649FA7BBA5EDE2F4B3C327C3B3EDFC15A71E55E7A1D5708A7FFA15BDE9E2766GAFE90F12EC775510ECB7820E2D857981B4818C2E257D2F9DD7AFCF4E0EB6DC623C774BAEF61E703FE29E1F93568A7FB369F89137279A7042AFFB4BA89ECF073EADEB29D6F57623CC869F83DB83C882C88148G58709855A1FF6A2BE5935429B6FF208B12BD
00201     2F2134907B1BD1FEE95FD23CE2233817741F57B33737BD665D641647043D95E70BE776551D9CAF767762G6E2F8B7A5CGD381E6814C87D811CD7B7B3F3EAA31BF3CDAEDD6D5496166373634B93CC88D21B111917EF535057CEBFDB6795C65957CDD536319262A4749267E4AE3DF933487F51C1B63702E926F78846E17956497B8EEA2B9B5CDE24CF8FBAB58CFEBCC744EFCA2BF0B86339EC79964D716E86D04A8BCA6E9B8919BFFB808F220FB170D0F6377FC3FBE43747E8707700E56A70F1668D714ADFE2FDF31
00202     5455B6D4E9D021594CBAE63CD7ACDCF4AE663DE26D930207D66DB96BE71DDA5E31F78F650C971E209C60541E489C60AAE6BC43FF34A7B287B005755F35A7B2871891567F421E489C00668B996416623711DF4B0A6AF1C8DED1749D1614DE3F5763B827453BB7F82C475CE14E9314C3F717218F387D0A673C5F270E1FC93152436762DDD4AE4C95BA1CDDC6BAECFCF23C8E3B1EB46AF0579EBC5F0CF7BAC20F4DD2C80F79B513512350C1F78D69E070C952418FEB626B60361A78BAF836A63E8EF657465201701BBD
00203     65CC7FDDE9785DD776FDFC0F906E337E6FF58D9183077BE3576BEAFF74FA7DFCFF743B26047E786F7E937BE33F7B7FF13F715D3F0861BB6C281B69E08BF3G56GEC84E0B9943F5F9D5843F87C0E923B5B1CAE3CAF402F43D4DA1F1D0C3D57D7CECE7CCDD961C91E4F79D555BF0C74897F56C954176A8FF024F607F792E524F8DCEED58C55706F1FC49B774AE7B93AB687ED70A68B79DCB4A84EB17A5C0C8A5C0353733587ABA73FC33CFB947EBC0F1FC157820C65D0AC7855BB784E19622C7162C8740F3C05B28E
00204     7930E18477498FAA49A793F51AB24F57F18FA27EFE330D4E6C0DC7D2D8FA364BCCFE983917B4EDAF9BF3C2F59879A5E3B50D46B83E785DF633A9861D52F5E2FE6D3A4877C38B9D482F9370896B48CEBE9E2C04E71F746578B729006CD57C8188316784163F11577C4F324718434C84FAF35645BFFB05FC4A4B701E46F0C5D1ED38312B6EEBBBE16BECE96EBAE3EDB9515355F538794419E66B1963EDED2DED2DE2FEC259C7F166F7741C687CCB4FF1DBF48ACC0B25AB4A74BB73F524370272FC32C9C6B166C40DF1
00205     0F6C29CC532E27626FD17BD6479E5B17CA6C937BD2857FBFGB278006DDCC03B072B3673BB7333E703326E337576C29D57996C7587BDE870E2BF8FD8F0FC0B0C5F82138DD50F99EDB1BBE9B426ADDA34FD5A1E8A37C5C1BB33824AFD56D8CBF22A2BB44AA99166A4CFA0A7E10FF5B27AF6AA0C4DG5884D070F426299820812083E070E932532576F8F62ADFF2713026C8F821276572E7192E17ED0E32D8B4A0AA9E851B6A31FFA9BBD41B6452675C65C0FE7538ADDCC06BDB6A4078005FD7F9A42F67BC8FB7D698
00206     68F3093C77B31EB7DD00BD6039AAF02D9C1784382BF4BBDB9DD66F24C25F6227634BCF5072540C276F2BB15297B2385C05F2DE8338DC0022751926DA00D60053G81004475A467AE27A50E1C4525D4C848E24D4ECA6263C89E71F13C1278D8E2A6F97DD90E6D972D7244FE51ADC7BFE32C7278B3E6C00EFE467CCDB61EB1826760F49559857A93AF9F845EA3633D1238636D16FC120B1F3F624ECE62B525267BFE0FD3F58BFC71586FC2788ED90BA7C2A69B4BC8CE1F69F2FA21EC3C1C2EF2451653F45744F23A56
00207     95DDCEBFF50D17D30AAB3A1CEEF10D1753ED9ADDC5FFC9A370F7382249C97C5F259F7C6DF6F826BC4772038A5B9E1E671A2EFF7B32429F570F18594B6D6C653312B76016BAD9BE7F78200B199DC1156D66DFE15440149A87CE2961932D8149A1FFFC0A3DFAD6F15979F01519CF351F82A23C75957B16193B58EB2A9B83028A52D2595BA1CA3DE83ADA4747E3787DBAFBA9A3A3A3GFFC11C4A0C98ADF6AEEAB31E3FD53B7E92330EAAFAC678EE55B311676F86DE573981BF6599723746418F6244A46B306475C215
00208     B2546CF3E2FCBAFCCE15C3B963F303C8BFC8E334CE5117BB08FCFFE918737FD0CB87880F7FC761FD93GG28B6GGD0CB818294G94G88G88GAA0C01A90F7FC761FD93GG28B6GG8CGGGGGGGGGGGGGGGGGE2F5E9ECE4E5F2A0E4E1F4E1D0CB8586GGGG81G81GBAGGG3793GGGG
00209 **end of data**/
00210 }
00211 /**
00212  * Return the JSplitPane1 property value.
00213  * @return javax.swing.JSplitPane
00214  */
00215 /* WARNING: THIS METHOD WILL BE REGENERATED. */
00216 public javax.swing.JSplitPane getCodeSplitPane() {
00217     if (ivjCodeSplitPane == null) {
00218         try {
00219             ivjCodeSplitPane = new javax.swing.JSplitPane(javax.swing.JSplitPane.HORIZONTAL_SPLIT);
00220             ivjCodeSplitPane.setName("CodeSplitPane");
00221             ivjCodeSplitPane.setDividerLocation(80);
00222             getCodeSplitPane().add(getHierTreeScrollPane(), "left");
00223             getCodeSplitPane().add(getMethodTreeScrollPane(), "right");
00224             // user code begin {1}
00225             getCodeSplitPane().setDividerLocation(180);
00226             // user code end
00227         } catch (java.lang.Throwable ivjExc) {
00228             // user code begin {2}
00229             // user code end
00230             handleException(ivjExc);
00231         }
00232     }
00233     return ivjCodeSplitPane;
00234 }
00235 /**
00236  * Return the HierTree property value.
00237  * @return edu.ksu.cis.bandera.pdgslicer.dependency.DraggableHierTree
00238  */
00239 /* WARNING: THIS METHOD WILL BE REGENERATED. */
00240 private DraggableHierTree getHierTree() {
00241     if (ivjHierTree == null) {
00242         try {
00243             ivjHierTree = new edu.ksu.cis.bandera.pdgslicer.dependency.DraggableHierTree();
00244             ivjHierTree.setName("HierTree");
00245             ivjHierTree.setBackground(new java.awt.Color(204, 204, 204));
00246             ivjHierTree.setBounds(0, 0, 78, 72);
00247             // user code begin {1}
00248             ivjHierTree.setUI(new javax.swing.plaf.metal.MetalTreeUI() {
00249                 public javax.swing.plaf.metal.MetalTreeUI setAngledColor() {
00250                     setHashColor(java.awt.Color.black);
00251                     return this;
00252                 }
00253             }
00254             .setAngledColor());
00255             ivjHierTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
00256             ivjHierTree.setCellRenderer(new DefaultTreeCellRenderer() {
00257                 public java.awt.Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
00258                     super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
00259                     setIcon(null);
00260                     setForeground(Color.black);
00261                     
00262                     Object o = ((DefaultMutableTreeNode) value).getUserObject();
00263                     if (o instanceof Package) {
00264                         String name = ((Package) o).getName().toString().trim();
00265                         name = "".equals(name) ? "<default package>" : name;
00266                         setText(name);
00267                         setIcon(IconLibrary.packageIcon);
00268                         if (CodeBrowserPane.this.removablePackages.contains(o))
00269                             setForeground(Preferences.getSlicedColor());
00270                         else
00271                             if (CodeBrowserPane.this.modifiedPackages.contains(o))
00272                                 setForeground(Preferences.getModifiedColor());
00273                     } else
00274                         if (o instanceof SootClass) {
00275                             SootClass sc = (SootClass) o;
00276                             Name cName = new Name(sc.getName());
00277                             setText(cName.getLastIdentifier());
00278                             setIcon(IconLibrary.classIcon);
00279                             try {
00280                                 if (Package.getClassOrInterfaceType(cName).isInterface()) {
00281                                     setIcon(IconLibrary.interfaceIcon);
00282                                 }
00283                             } catch (Exception e) {
00284                             }
00285                             if (CodeBrowserPane.this.unreachableSootClasses.contains(o)) {
00286                                 setForeground(Preferences.getUnreachableColor());
00287                                 
00288                             } else
00289                                 if (CodeBrowserPane.this.removableSootClasses.contains(o))
00290                                     setForeground(Preferences.getSlicedColor());
00291                                 else
00292                                     if (CodeBrowserPane.this.modifiedSootClasses.contains(o))
00293                                         setForeground(Preferences.getModifiedColor());
00294                         } else
00295                             if (o instanceof FieldDeclarationAnnotation) {
00296                                 FieldDeclarationAnnotation fda = (FieldDeclarationAnnotation) o;
00297                                 setText(fda.getField().getType() + " " + fda.getField().getName());
00298                                 setIcon(IconLibrary.fieldIcon);
00299                                 if (CodeBrowserPane.this.removableSootFields.contains(fda.getSootField()))
00300                                     setForeground(Preferences.getSlicedColor());
00301                             } else
00302                                 if (o instanceof ConstructorDeclarationAnnotation) {
00303                                     ConstructorDeclarationAnnotation cda = (ConstructorDeclarationAnnotation) o;
00304                                     SootMethod sm = cda.getSootMethod();
00305                                     try {
00306                                         Method m = cda.getConstructor();
00307                                         String result = m.getDeclaringClassOrInterface().getName().getLastIdentifier().trim() + "(";
00308                                         JimpleBody body = (JimpleBody) sm.getBody(Jimple.v());
00309                                         String parm = "";
00310                                         for (Enumeration e = m.getParameters().elements(); e.hasMoreElements();) {
00311                                             Variable v = (Variable) e.nextElement();
00312                                             if (body.declaresLocal(v.getName().toString().trim())) {
00313                                                 parm += (v.toString() + ", ");
00314                                             }
00315                                         }
00316                                         if (parm.length() > 1)
00317                                             parm = parm.substring(0, parm.length() - 2);
00318                                         result += (parm + ")");
00319                                         setText(result);
00320                                     } catch (Exception e) {
00321                                     }
00322                                     setIcon(IconLibrary.methodIcon);
00323                                     if (!CodeBrowserPane.this.reachableSootMethods.contains(sm))
00324                                         setForeground(Preferences.getUnreachableColor());
00325                                     else
00326                                         if (CodeBrowserPane.this.removableSootMethods.contains(sm))
00327                                             setForeground(Preferences.getSlicedColor());
00328                                         else
00329                                             if (CodeBrowserPane.this.modifiedSootMethods.contains(sm))
00330                                                 setForeground(Preferences.getModifiedColor());
00331                                 } else
00332                                     if (o instanceof MethodDeclarationAnnotation) {
00333                                         MethodDeclarationAnnotation mda = (MethodDeclarationAnnotation) o;
00334                                         SootMethod sm = mda.getSootMethod();
00335                                         Method m = mda.getMethod();
00336                                         String result = sm.getReturnType().toString().trim() + " " + sm.getName().trim() + "(";
00337                                         JimpleBody body = (JimpleBody) sm.getBody(Jimple.v());
00338                                         String parm = "";
00339                                         for (Enumeration e = m.getParameters().elements(); e.hasMoreElements();) {
00340                                             Variable v = (Variable) e.nextElement();
00341                                             if (body.declaresLocal(v.getName().toString().trim())) {
00342                                                 parm += (v.toString() + ", ");
00343                                             }
00344                                         }
00345                                         if (parm.length() > 1)
00346                                             parm = parm.substring(0, parm.length() - 2);
00347                                         result += (parm + ")");
00348                                         setText(result);
00349                                         setIcon(IconLibrary.methodIcon);
00350                                         if (!CodeBrowserPane.this.reachableSootMethods.contains(sm))
00351                                             setForeground(Preferences.getUnreachableColor());
00352                                         else
00353                                             if (CodeBrowserPane.this.removableSootMethods.contains(sm))
00354                                                 setForeground(Preferences.getSlicedColor());
00355                                             else
00356                                                 if (CodeBrowserPane.this.modifiedSootMethods.contains(sm))
00357                                                     setForeground(Preferences.getModifiedColor());
00358                                     }
00359                     return this;
00360                 }
00361             });
00362             ((DefaultTreeCellRenderer) ivjHierTree.getCellRenderer()).setBackgroundNonSelectionColor(new Color(204, 204, 204));
00363             ((DefaultTreeCellRenderer) ivjHierTree.getCellRenderer()).setBackgroundSelectionColor(Preferences.getHighlightColor());
00364             ivjHierTree.putClientProperty("JTree.lineStyle", "Angled");
00365 
00366             // user code end
00367         } catch (java.lang.Throwable ivjExc) {
00368             // user code begin {2}
00369             // user code end
00370             handleException(ivjExc);
00371         }
00372     }
00373     return ivjHierTree;
00374 }
00375 /**
00376  * Return the JScrollPane1 property value.
00377  * @return javax.swing.JScrollPane
00378  */
00379 /* WARNING: THIS METHOD WILL BE REGENERATED. */
00380 public javax.swing.JScrollPane getHierTreeScrollPane() {
00381     if (ivjHierTreeScrollPane == null) {
00382         try {
00383             ivjHierTreeScrollPane = new javax.swing.JScrollPane();
00384             ivjHierTreeScrollPane.setName("HierTreeScrollPane");
00385             getHierTreeScrollPane().setViewportView(getHierTree());
00386             // user code begin {1}
00387             // user code end
00388         } catch (java.lang.Throwable ivjExc) {
00389             // user code begin {2}
00390             // user code end
00391             handleException(ivjExc);
00392         }
00393     }
00394     return ivjHierTreeScrollPane;
00395 }
00396 /**
00397  * Insert the method's description here.
00398  * Creation date: (00-12-7 14:08:21)
00399  * @return int
00400  * @param ldsa edu.ksu.cis.bandera.annotation.LocalDeclarationStmtAnnotation
00401  */
00402 private int getLocalDecState(LocalDeclarationStmtAnnotation ldsa) {
00403     Annotation mdAnnotation = CompilationManager.getAnnotationManager().getMethodAnnotationContainingAnnotation(ldsa);
00404     SootMethod sootMethod = null;
00405     if (mdAnnotation instanceof MethodDeclarationAnnotation)
00406         sootMethod = ((MethodDeclarationAnnotation) mdAnnotation).getSootMethod();
00407     else
00408         if (mdAnnotation instanceof ConstructorDeclarationAnnotation)
00409             sootMethod = ((ConstructorDeclarationAnnotation) mdAnnotation).getSootMethod();
00410     if (sootMethod == null)
00411         throw new edu.ksu.cis.bandera.pdgslicer.exceptions.SlicerException("sootMethod is null");
00412     if (postProcessOnAnnotation == null)
00413         return Statements.REMAINED;
00414     ca.mcgill.sable.util.Set removableLocals = postProcessOnAnnotation.getRemovableLocals(sootMethod);
00415     if (removableLocals == null)
00416         return ldsa.getAnnotationState();
00417     int removeNum = 0;
00418     for (Enumeration elem = ldsa.getDeclaredLocals().elements(); elem.hasMoreElements();) {
00419         Local decLocal = (Local) elem.nextElement();
00420         if (removableLocals.contains(decLocal))
00421             removeNum++;
00422     }
00423     if (removeNum == 0)
00424 
00425         
00426         //return Statements.REMAINED;
00427         return ldsa.getAnnotationState();
00428     else
00429         if (removeNum == ldsa.getDeclaredLocals().size())
00430             return Statements.SLICED;
00431         else
00432             return Statements.MODIFIED;
00433 }
00434 /**
00435  * Return the MethodTree property value.
00436  * @return edu.ksu.cis.bandera.pdgslicer.dependency.DraggableMethodTree
00437  */
00438 /* WARNING: THIS METHOD WILL BE REGENERATED. */
00439 public DraggableMethodTree getMethodTree() {
00440     if (ivjMethodTree == null) {
00441         try {
00442             ivjMethodTree = new edu.ksu.cis.bandera.pdgslicer.dependency.DraggableMethodTree();
00443             ivjMethodTree.setName("MethodTree");
00444             ivjMethodTree.setBackground(new java.awt.Color(204, 204, 204));
00445             ivjMethodTree.setBounds(0, 0, 78, 72);
00446             // user code begin {1}
00447             ivjMethodTree.setUI(new javax.swing.plaf.metal.MetalTreeUI() {
00448                 public javax.swing.plaf.metal.MetalTreeUI setAngledColor() {
00449                     setHashColor(Color.black);
00450                     return this;
00451                 }
00452             }
00453             .setAngledColor());
00454             ivjMethodTree.setModel(new DefaultTreeModel(new DefaultMutableTreeNode("")));
00455             ivjMethodTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
00456             ivjMethodTree.setCellRenderer(new DefaultTreeCellRenderer() {
00457                 public java.awt.Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
00458                     super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
00459                     setIcon(null);
00460                     Object o = ((DefaultMutableTreeNode) value).getUserObject();
00461                     setForeground(Color.black);
00462                     if (o instanceof Predicate) {
00463                         setForeground(Preferences.getPredicateColor());
00464                         if (!((Predicate) o).isValid())
00465                             setIcon(IconLibrary.errorIcon);
00466                     } else
00467                         if (o instanceof Assertion) {
00468                             setForeground(Preferences.getAssertionColor());
00469                             if (!((Assertion) o).isValid())
00470                                 setIcon(IconLibrary.errorIcon);
00471                         }
00472                     if (o instanceof Annotation) {
00473                         Annotation a = (Annotation) o;
00474                         if (a instanceof MethodDeclarationAnnotation) {
00475                             SootMethod sm = ((MethodDeclarationAnnotation) a).getSootMethod();
00476                             if (parameterModifiedMethods.contains(sm))
00477                                 setForeground(Preferences.getModifiedColor());
00478                         } else
00479                             if (a instanceof ConstructorDeclarationAnnotation) {
00480                                 SootMethod sm = ((ConstructorDeclarationAnnotation) a).getSootMethod();
00481                                 if (parameterModifiedMethods.contains(sm))
00482                                     setForeground(Preferences.getModifiedColor());
00483                             } else
00484                                 if (!((DefaultMutableTreeNode) value).isRoot() && !(a instanceof LocalDeclarationStmtAnnotation)) {
00485                                     switch (a.getAnnotationState()) {
00486                                         case Statements.SLICED :
00487                                             setForeground(Preferences.getSlicedColor());
00488                                             break;
00489                                         case Statements.MODIFIED :
00490                                             setForeground(Preferences.getModifiedColor());
00491                                             break;
00492                                         default :
00493                                             ;
00494                                     }
00495                                 } else
00496                                     if ((a instanceof LocalDeclarationStmtAnnotation)) {
00497                                         int localDecState = CodeBrowserPane.this.getLocalDecState((LocalDeclarationStmtAnnotation) a);
00498                                         switch (localDecState) {
00499                                             case Statements.SLICED :
00500                                                 setForeground(Preferences.getSlicedColor());
00501                                                 break;
00502                                             case Statements.MODIFIED :
00503                                                 setForeground(Preferences.getModifiedColor());
00504                                                 break;
00505                                             default :
00506                                                 ;
00507                                         }
00508                                     }
00509                     }
00510                     return this;
00511                 }
00512             });
00513             ((DefaultTreeCellRenderer) ivjMethodTree.getCellRenderer()).setBackgroundNonSelectionColor(new Color(204, 204, 204));
00514             ((DefaultTreeCellRenderer) ivjMethodTree.getCellRenderer()).setBackgroundSelectionColor(Preferences.getHighlightColor());
00515             ivjMethodTree.putClientProperty("JTree.lineStyle", "Angled");
00516 
00517             // user code end
00518         } catch (java.lang.Throwable ivjExc) {
00519             // user code begin {2}
00520             // user code end
00521             handleException(ivjExc);
00522         }
00523     }
00524     return ivjMethodTree;
00525 }
00526 /**
00527  * Return the JScrollPane2 property value.
00528  * @return javax.swing.JScrollPane
00529  */
00530 /* WARNING: THIS METHOD WILL BE REGENERATED. */
00531 public javax.swing.JScrollPane getMethodTreeScrollPane() {
00532     if (ivjMethodTreeScrollPane == null) {
00533         try {
00534             ivjMethodTreeScrollPane = new javax.swing.JScrollPane();
00535             ivjMethodTreeScrollPane.setName("MethodTreeScrollPane");
00536             ivjMethodTreeScrollPane.setVerticalScrollBarPolicy(javax.swing.JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
00537             ivjMethodTreeScrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
00538             getMethodTreeScrollPane().setViewportView(getMethodTree());
00539             // user code begin {1}
00540             //ivjMethodTreeScrollPane.setCorner(JScrollPane.LOWER_RIGHT_CORNER,getJimpCritToggleButton());
00541             // user code end
00542         } catch (java.lang.Throwable ivjExc) {
00543             // user code begin {2}
00544             // user code end
00545             handleException(ivjExc);
00546         }
00547     }
00548     return ivjMethodTreeScrollPane;
00549 }
00550 private StmtTreeNode getSelectedTreeNode() {
00551     //get Package and MethodDeclaration
00552     JTree hierTree = getHierTree();
00553     JTree methodTree = getMethodTree();
00554     DefaultMutableTreeNode hierTreeSelected = (DefaultMutableTreeNode) hierTree.getLastSelectedPathComponent();
00555     if (hierTreeSelected==null) return null;
00556     Object hierTreeSelectedObj = hierTreeSelected.getUserObject();
00557     Annotation mda = null;
00558     SootClass sc = null;
00559     Annotation stmtAnn = null;
00560     if ((hierTreeSelectedObj instanceof MethodDeclarationAnnotation) ||
00561         (hierTreeSelectedObj instanceof ConstructorDeclarationAnnotation)) {
00562         mda = (Annotation) hierTreeSelectedObj;
00563         DefaultMutableTreeNode classNode = (DefaultMutableTreeNode) hierTreeSelected.getParent();
00564         Object classObj = classNode.getUserObject();
00565         if (classObj instanceof SootClass)
00566             sc = (SootClass) classObj;
00567         else
00568             System.out.println("error: classObj is not SootClass");
00569     } else
00570         System.out.println("we do not deal with other selection currently rather than methodDeclarationAnnotation");
00571     //get StmtAnnotation
00572     DefaultMutableTreeNode methodTreeSelected = (DefaultMutableTreeNode) methodTree.getLastSelectedPathComponent();
00573     Object methodTreeSelectedObj = methodTreeSelected.getUserObject();
00574     if (methodTreeSelectedObj instanceof Annotation) {
00575         stmtAnn = (Annotation) methodTreeSelectedObj;
00576     } else
00577         System.out.println("error: methodTreeSelected is not Annotation");
00578     dependFrame.currentMethodDecAnn = mda;
00579     return new StmtTreeNode(sc, mda, stmtAnn);
00580 }
00581 /**
00582  * Called whenever the part throws an exception.
00583  * @param exception java.lang.Throwable
00584  */
00585 private void handleException(java.lang.Throwable exception) {
00586 
00587     /* Uncomment the following lines to print uncaught exceptions to stdout */
00588     // System.out.println("--------- UNCAUGHT EXCEPTION ---------");
00589     // exception.printStackTrace(System.out);
00590 }
00591 /**
00592  * Comment
00593  */
00594 public void hierTree_MouseClicked(java.awt.event.MouseEvent mouseEvent) {
00595     
00596          int selRow = getHierTree().getRowForLocation(mouseEvent.getX(), mouseEvent.getY());
00597          TreePath selPath = getHierTree().getPathForLocation(mouseEvent.getX(), mouseEvent.getY());
00598          if(selRow != -1) {
00599              if(mouseEvent.getClickCount() == 1) {
00600                  //mySingleClick(selRow, selPath);
00601                  System.out.println("My sigle click on the tree");
00602              }
00603              else if(mouseEvent.getClickCount() == 2) {
00604                  //myDoubleClick(selRow, selPath);
00605                  System.out.println("My DOUBLE click on the tree");
00606              }
00607          }
00608      
00609     return;
00610 }
00611 /**
00612  * Comment
00613  */
00614 public void hierTree_TreeSelectionAction(Object selectedObj, boolean showJimple) {
00615     if (selectedObj instanceof MethodDeclarationAnnotation) {
00616         updateMethodTree((MethodDeclarationAnnotation) selectedObj, null);
00617         SootMethod sm = ((MethodDeclarationAnnotation) selectedObj).getSootMethod();
00618         if (showJimple)
00619         dependFrame.jimpleCodeForSootMethod(sm);
00620         //repaintDependTree(null);
00621     } else
00622         if (selectedObj instanceof ConstructorDeclarationAnnotation) {
00623             ConstructorDeclarationAnnotation cda = (ConstructorDeclarationAnnotation) selectedObj;
00624             if (showJimple)
00625             dependFrame.jimpleCodeForSootMethod(cda.getSootMethod());
00626             if (cda.getNode() == null) {
00627                 getMethodTree().setRootVisible(true);
00628                 getMethodTree().setModel(new DefaultTreeModel(new DefaultMutableTreeNode("Source code unavailable")));
00629                 getMethodTreeScrollPane().validate();
00630                 getMethodTreeScrollPane().repaint();
00631                 return;
00632             }
00633             DefaultMutableTreeNode root = new DefaultMutableTreeNode("root");
00634             root.add((DefaultMutableTreeNode) BUISessionPane.buildTree(cda).elementAt(0));
00635             JTree rightTree = getMethodTree();
00636             rightTree.setRootVisible(false);
00637             rightTree.setModel(new DefaultTreeModel(root));
00638             for (int i = 0; i < rightTree.getRowCount(); i++) {
00639                 rightTree.expandPath(rightTree.getPathForRow(i));
00640             }
00641             getMethodTreeScrollPane().validate();
00642             getMethodTreeScrollPane().repaint();
00643         } else
00644             if (selectedObj instanceof FieldDeclarationAnnotation) {
00645                 FieldDeclarationAnnotation fda = (FieldDeclarationAnnotation) selectedObj;
00646                 getMethodTree().setRootVisible(true);
00647                 getMethodTree().setModel(new DefaultTreeModel(new DefaultMutableTreeNode(fda)));
00648                 getMethodTreeScrollPane().validate();
00649                 getMethodTreeScrollPane().repaint();
00650             } else {
00651                 if (selectedObj instanceof SootClass) {
00652                     //Annotation classAnnotation= annotationManager.getAnnotation((SootClass)selectedObj);
00653                     if (showJimple)
00654                     dependFrame.jimpleCodeForSootClass((SootClass) selectedObj);
00655                 }
00656                 getMethodTree().setRootVisible(false);
00657                 getMethodTree().setModel(new DefaultTreeModel(new DefaultMutableTreeNode("")));
00658                 getMethodTreeScrollPane().validate();
00659                 getMethodTreeScrollPane().repaint();
00660             }
00661     return;
00662 }
00663 /**
00664  * Comment
00665  */
00666 public void hierTree_TreeSelectionEvents() {
00667     Object selectedObj = ((DefaultMutableTreeNode) getHierTree().getLastSelectedPathComponent()).getUserObject();
00668     boolean showJimple = true;
00669     if (selectedObj != null)
00670         hierTree_TreeSelectionAction(selectedObj, showJimple);
00671     return;
00672 }
00673 /**
00674  * Initializes connections
00675  * @exception java.lang.Exception The exception description.
00676  */
00677 /* WARNING: THIS METHOD WILL BE REGENERATED. */
00678 private void initConnections() throws java.lang.Exception {
00679     // user code begin {1}
00680     // user code end
00681     getHierTree().addTreeSelectionListener(this);
00682     getMethodTree().addMouseListener(this);
00683     getMethodTree().addTreeSelectionListener(this);
00684 }
00685 /**
00686  * Initialize the class.
00687  */
00688 /* WARNING: THIS METHOD WILL BE REGENERATED. */
00689 private void initialize() {
00690     try {
00691         // user code begin {1}
00692         // user code end
00693         setName("CodeBrowserPane");
00694         setLayout(new java.awt.BorderLayout());
00695         setSize(507, 287);
00696         add(getCodeSplitPane(), "Center");
00697         initConnections();
00698     } catch (java.lang.Throwable ivjExc) {
00699         handleException(ivjExc);
00700     }
00701     // user code begin {2}
00702     // user code end
00703 }
00704 /**
00705  * main entrypoint - starts the part when it is run as an application
00706  * @param args java.lang.String[]
00707  */
00708 public static void main(java.lang.String[] args) {
00709     try {
00710         JFrame frame = new javax.swing.JFrame();
00711         CodeBrowserPane aCodeBrowserPane;
00712         aCodeBrowserPane = new CodeBrowserPane();
00713         frame.setContentPane(aCodeBrowserPane);
00714         frame.setSize(aCodeBrowserPane.getSize());
00715         frame.addWindowListener(new java.awt.event.WindowAdapter() {
00716             public void windowClosing(java.awt.event.WindowEvent e) {
00717                 System.exit(0);
00718             };
00719         });
00720         frame.setVisible(true);
00721     } catch (Throwable exception) {
00722         System.err.println("Exception occurred in main() of javax.swing.JPanel");
00723         exception.printStackTrace(System.out);
00724     }
00725 }
00726 /**
00727  * Comment
00728  */
00729 public void methodTree_MouseClicked(java.awt.event.MouseEvent mouseEvent) {
00730     /*
00731     int selRow = getMethodTree().getRowForLocation(mouseEvent.getX(), mouseEvent.getY());
00732     TreePath selPath = getMethodTree().getPathForLocation(mouseEvent.getX(), mouseEvent.getY());
00733     if (selRow != -1) {
00734         if (mouseEvent.getClickCount() == 1) {
00735             //mySingleClick(selRow, selPath);
00736             System.out.println("Do nothing --- My sigle click on the tree");
00737         } else
00738             if (mouseEvent.getClickCount() == 2) {
00739                 //myDoubleClick(selRow, selPath);
00740                 System.out.println("My DOUBLE click on the tree");
00741                 StmtTreeNode selectedNode = getSelectedTreeNode();
00742                 dependFrame.addSelectedNodeToDependFrame(selectedNode);
00743                 System.out.println("End adding by double clicking");
00744             }
00745     }
00746     */
00747     return;
00748 }
00749 /**
00750  * Comment
00751  */
00752 public void methodTree_TreeSelectionAction(Annotation ann) {
00753     if (ann instanceof MethodDeclarationAnnotation) {
00754         SootMethod sm = ((MethodDeclarationAnnotation) ann).getSootMethod();
00755         dependFrame.jimpleCodeForSootMethod(sm);
00756     } else
00757         if (ann instanceof ConstructorDeclarationAnnotation) {
00758             SootMethod sm = ((ConstructorDeclarationAnnotation) ann).getSootMethod();
00759             dependFrame.jimpleCodeForSootMethod(sm);
00760         } else {
00761             dependFrame.jimpleCodeForAnnotation(ann);
00762             StmtTreeNode selectedNode = getSelectedTreeNode();
00763             dependFrame.addSelectedNodeToDependFrame(selectedNode);
00764         }
00765     return;
00766 }
00767 /**
00768  * Comment
00769  */
00770 public void methodTree_TreeSelectionActionByProgram(Annotation ann) {
00771     if (ann instanceof MethodDeclarationAnnotation) {
00772         SootMethod sm = ((MethodDeclarationAnnotation) ann).getSootMethod();
00773         dependFrame.jimpleCodeForSootMethod(sm);
00774     } else
00775         if (ann instanceof ConstructorDeclarationAnnotation) {
00776             SootMethod sm = ((ConstructorDeclarationAnnotation) ann).getSootMethod();
00777             dependFrame.jimpleCodeForSootMethod(sm);
00778         } else {
00779             dependFrame.jimpleCodeForAnnotation(ann);
00780             //Object selectedNode = getSelectedTreeNode();
00781             //dependFrame.addSelectedNodeToDependFrame(selectedNode);
00782         }
00783     return;
00784 }
00785 /**
00786  * Comment
00787  */
00788 public void methodTree_TreeSelectionEvents() {
00789     DefaultMutableTreeNode node = (DefaultMutableTreeNode) getMethodTree().getLastSelectedPathComponent();
00790     Annotation ann = (Annotation) node.getUserObject();
00791     if (ann != null)
00792         methodTree_TreeSelectionAction(ann);
00793     return;
00794 }
00795 /**
00796  * Method to handle events for the MouseListener interface.
00797  * @param e java.awt.event.MouseEvent
00798  */
00799 /* WARNING: THIS METHOD WILL BE REGENERATED. */
00800 public void mouseClicked(java.awt.event.MouseEvent e) {
00801     // user code begin {1}
00802     // user code end
00803     if (e.getSource() == getMethodTree()) 
00804         connEtoC3(e);
00805     // user code begin {2}
00806     // user code end
00807 }
00808 /**
00809  * Method to handle events for the MouseListener interface.
00810  * @param e java.awt.event.MouseEvent
00811  */
00812 /* WARNING: THIS METHOD WILL BE REGENERATED. */
00813 public void mouseEntered(java.awt.event.MouseEvent e) {
00814     // user code begin {1}
00815     // user code end
00816     // user code begin {2}
00817     // user code end
00818 }
00819 /**
00820  * Method to handle events for the MouseListener interface.
00821  * @param e java.awt.event.MouseEvent
00822  */
00823 /* WARNING: THIS METHOD WILL BE REGENERATED. */
00824 public void mouseExited(java.awt.event.MouseEvent e) {
00825     // user code begin {1}
00826     // user code end
00827     // user code begin {2}
00828     // user code end
00829 }
00830 /**
00831  * Method to handle events for the MouseListener interface.
00832  * @param e java.awt.event.MouseEvent
00833  */
00834 /* WARNING: THIS METHOD WILL BE REGENERATED. */
00835 public void mousePressed(java.awt.event.MouseEvent e) {
00836     // user code begin {1}
00837     // user code end
00838     // user code begin {2}
00839     // user code end
00840 }
00841 /**
00842  * Method to handle events for the MouseListener interface.
00843  * @param e java.awt.event.MouseEvent
00844  */
00845 /* WARNING: THIS METHOD WILL BE REGENERATED. */
00846 public void mouseReleased(java.awt.event.MouseEvent e) {
00847     // user code begin {1}
00848     // user code end
00849     // user code begin {2}
00850     // user code end
00851 }
00852 /**
00853  * Insert the method's description here.
00854  * Creation date: (00-12-7 17:21:16)
00855  */
00856 void repaintTrees() {
00857     //update Hiertree and Methodtree
00858     getHierTreeScrollPane().validate();
00859     getHierTreeScrollPane().repaint();
00860     getHierTreeScrollPane().setVisible(true);
00861     getMethodTreeScrollPane().validate();
00862     getMethodTreeScrollPane().repaint();
00863     getMethodTreeScrollPane().setVisible(true);
00864 }
00865 /**
00866  * Insert the method's description here.
00867  * Creation date: (00-11-10 15:52:15)
00868  * @param currentNode java.lang.Object
00869  */
00870 void setCurrentNodeSelected(Object currentNode) {
00871     if (currentNode instanceof StmtTreeNode) {
00872         StmtTreeNode currentTreeNode = (StmtTreeNode) currentNode;
00873         setSelected(getHierTree(), currentTreeNode.currentMethodDeclarationAnnotation);
00874         boolean showJimple = false;
00875         hierTree_TreeSelectionAction(currentTreeNode.currentMethodDeclarationAnnotation, showJimple);
00876         setSelected(getMethodTree(), currentTreeNode.currentStmtAnnotation);
00877         methodTree_TreeSelectionActionByProgram(currentTreeNode.currentStmtAnnotation);
00878     } else
00879         if (currentNode instanceof LocationNodeInCriterionViewer) {
00880             LocationNodeInCriterionViewer currentTreeNode = (LocationNodeInCriterionViewer) currentNode;
00881             Annotation currentMethodDeclarationAnnotation = CompilationManager.getAnnotationManager().getAnnotation(currentTreeNode.sootMethod.getDeclaringClass(), currentTreeNode.sootMethod);
00882             setSelected(getHierTree(), currentMethodDeclarationAnnotation);
00883             boolean showJimple = false;
00884             hierTree_TreeSelectionAction(currentMethodDeclarationAnnotation, showJimple);
00885             setSelected(getMethodTree(), currentTreeNode.stmtAnnotation);
00886             methodTree_TreeSelectionActionByProgram(currentTreeNode.stmtAnnotation);
00887         } else
00888             if (currentNode instanceof SliceField) {
00889                 SliceField sf = (SliceField) currentNode;
00890                 Annotation fieldAnnotation = CompilationManager.getAnnotationManager().getAnnotation(sf.getSootClass(), sf.getSootField());
00891                 setSelected(getHierTree(), fieldAnnotation);
00892                 boolean showJimple = false;
00893                 hierTree_TreeSelectionAction(fieldAnnotation, showJimple);
00894             } else
00895                 if (currentNode instanceof SliceLocal) {
00896                     SliceLocal sliceLocal = (SliceLocal) currentNode;
00897                     Annotation annotationForMd = CompilationManager.getAnnotationManager().getAnnotation(sliceLocal.getSootClass(), sliceLocal.getSootMethod());
00898                     Vector allAnnotationsInMd = annotationForMd.getAllAnnotations(true);
00899                     for (Enumeration annEnum = allAnnotationsInMd.elements(); annEnum.hasMoreElements();) {
00900                         Object nextElement = annEnum.nextElement();
00901                         if (nextElement instanceof LocalDeclarationStmtAnnotation) {
00902                             Hashtable declaredLocals = ((LocalDeclarationStmtAnnotation) nextElement).getDeclaredLocals();
00903                             if (declaredLocals.containsValue(sliceLocal.getLocal())) {
00904                                 setSelected(getHierTree(), annotationForMd);
00905                                 boolean showJimple = false;
00906                                 hierTree_TreeSelectionAction(annotationForMd, showJimple);
00907                                 setSelected(getMethodTree(), nextElement);
00908                                 methodTree_TreeSelectionActionByProgram((Annotation)nextElement);
00909                                 break;
00910                             }
00911                         }
00912                     }
00913                 } else
00914                     System.out.println("We can not deal with other type of node currently");
00915 }
00916 /**
00917  * Insert the method's description here.
00918  * Creation date: (00-11-7 13:45:45)
00919  * @param dpnd edu.ksu.cis.bandera.pdgslicer.dependency.Dependencies
00920  */
00921 void setDependFrame(Dependencies dpnd) {
00922     dependFrame = dpnd;
00923 }
00924 /**
00925  * Insert the method's description here.
00926  * Creation date: (00-12-7 17:20:43)
00927  */
00928 void setPostProcessValues() {
00929     postProcessOnAnnotation = dependFrame.slicer.getPostProcessOnAnnotation();
00930     removablePackages = postProcessOnAnnotation.getRemovablePackages();
00931     modifiedPackages = postProcessOnAnnotation.getModifiedPackages();
00932     removableSootClasses = postProcessOnAnnotation.getRemovableSootClasses();
00933     modifiedSootClasses = postProcessOnAnnotation.getModifiedSootClasses();
00934     removableSootFields = postProcessOnAnnotation.getRemovableSootFields();
00935     removableSootMethods = postProcessOnAnnotation.getRemovableSootMethods();
00936     modifiedSootMethods = postProcessOnAnnotation.getModifiedSootMethods();
00937     parameterModifiedMethods = postProcessOnAnnotation.getParameterModifiedMethods();
00938 }
00939 /**
00940  * 
00941  * @param tree javax.swing.JTree
00942  * @param object java.lang.Object
00943  */
00944 private void setSelected(JTree tree, Object object) {
00945     setSelectedByProgram = true;
00946     for (int i = 0; i < tree.getRowCount(); i++) {
00947         tree.setSelectionRow(i);
00948         DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();
00949         Object o = node.getUserObject();
00950         if (o == object) {
00951             TreePath path = tree.getSelectionPath();
00952             tree.scrollPathToVisible(path);
00953             setSelectedByProgram = false;
00954             return;
00955         } else {
00956             tree.expandRow(i);
00957         }
00958     }
00959     setSelectedByProgram = false;
00960 }
00961 void updateHierTree(Object hierTreeSelectedUserObject) {
00962     Session sess = BUI.sessions.getActiveSession();
00963     String rootName = sess.getName();
00964     getHierTree().setRootVisible(true);
00965     DefaultMutableTreeNode root = new DefaultMutableTreeNode(rootName);
00966     Hashtable compiledClasses = CompilationManager.getAnnotationManager().getAnnotationTable();
00967     TreeSet packageNames = new TreeSet();
00968     for (Enumeration e = compiledClasses.keys(); e.hasMoreElements();) {
00969         packageNames.add(new Name(((SootClass) e.nextElement()).getName()).getSuperName());
00970     }
00971     for (Iterator i = packageNames.iterator(); i.hasNext();) {
00972         try {
00973             Package p = Package.getPackage((Name) i.next());
00974             DefaultMutableTreeNode pNode = buildPackageNode(p);
00975             root.add(pNode);
00976         } catch (Exception e) {
00977             System.out.println("There is an exception");
00978             System.out.println("Exception e: " + e);
00979             e.printStackTrace();
00980         }
00981     }
00982     getHierTree().setModel(new DefaultTreeModel(root));
00983     getHierTreeScrollPane().validate();
00984     getHierTreeScrollPane().repaint();
00985     getCodeSplitPane().resetToPreferredSizes();
00986     if (hierTreeSelectedUserObject != null)
00987         setSelected(getHierTree(), hierTreeSelectedUserObject);
00988     else
00989         getMethodTree().setModel(new DefaultTreeModel(new DefaultMutableTreeNode("")));
00990 }
00991 /**
00992  * Insert the method's description here.
00993  * Creation date: (00-4-17 17:06:15)
00994  * @param mdAnnotaton edu.ksu.cis.bandera.annotation.MethodDeclarationAnnotation
00995  * @param lastSelected java.lang.Object
00996  */
00997 void updateMethodTree(MethodDeclarationAnnotation mdAnnotation, Object lastSelectedUserObject) {
00998     DefaultMutableTreeNode root = new DefaultMutableTreeNode("root");
00999     for (java.util.Iterator i = PredicateSet.getDefinedPredicates(mdAnnotation).iterator(); i.hasNext();) {
01000         root.add(new DefaultMutableTreeNode(i.next()));
01001     }
01002     for (java.util.Iterator i = AssertionSet.getDefinedAssertions(mdAnnotation).iterator(); i.hasNext();) {
01003         root.add(new DefaultMutableTreeNode(i.next()));
01004     }
01005     root.add((DefaultMutableTreeNode) BUISessionPane.buildTree(mdAnnotation).elementAt(0));
01006     JTree methodTree = getMethodTree();
01007     methodTree.setRootVisible(false);
01008     methodTree.setModel(new DefaultTreeModel(root));
01009     for (int i = 0; i < methodTree.getRowCount(); i++) {
01010         methodTree.expandPath(methodTree.getPathForRow(i));
01011     }
01012     getMethodTreeScrollPane().validate();
01013     getMethodTreeScrollPane().repaint();
01014     //getCodeSplitPane().resetToPreferredSizes();
01015     if (lastSelectedUserObject != null)
01016         setSelected(methodTree, lastSelectedUserObject);
01017 }
01018 /**
01019  * Method to handle events for the TreeSelectionListener interface.
01020  * @param e javax.swing.event.TreeSelectionEvent
01021  */
01022 /* WARNING: THIS METHOD WILL BE REGENERATED. */
01023 public void valueChanged(javax.swing.event.TreeSelectionEvent e) {
01024     // user code begin {1}
01025     // user code end
01026     if (e.getSource() == getHierTree()) 
01027         connEtoC1();
01028     if (e.getSource() == getMethodTree()) 
01029         connEtoC4();
01030     // user code begin {2}
01031     // user code end
01032 }
01033 }

Generated at Thu Feb 7 06:42:35 2002 for Bandera by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001