00001 package edu.ksu.cis.bandera.abstraction.gui; 00002 00003 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00004 * Bandera, a Java(TM) analysis and transformation toolkit * 00005 * Copyright (C) 1998, 1999, 2000 Shawn Laubach (laubach@acm.org) * 00006 * All rights reserved. * 00007 * * 00008 * Modifications by Robby (robby@cis.ksu.edu) are * 00009 * Copyright (C) 2000 Robby. All rights reserved. * 00010 * * 00011 * This work was done as a project in the SAnToS Laboratory, * 00012 * Department of Computing and Information Sciences, Kansas State * 00013 * University, USA (http://www.cis.ksu.edu/santos). * 00014 * It is understood that any modification not identified as such is * 00015 * not covered by the preceding statement. * 00016 * * 00017 * This work is free software; you can redistribute it and/or * 00018 * modify it under the terms of the GNU Library General Public * 00019 * License as published by the Free Software Foundation; either * 00020 * version 2 of the License, or (at your option) any later version. * 00021 * * 00022 * This work is distributed in the hope that it will be useful, * 00023 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00024 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00025 * Library General Public License for more details. * 00026 * * 00027 * You should have received a copy of the GNU Library General Public * 00028 * License along with this toolkit; if not, write to the * 00029 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * 00030 * Boston, MA 02111-1307, USA. * 00031 * * 00032 * Java is a trademark of Sun Microsystems, Inc. * 00033 * * 00034 * To submit a bug report, send a comment, or get the latest news on * 00035 * this project and other SAnToS projects, please visit the web-site * 00036 * http://www.cis.ksu.edu/santos * 00037 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 00038 import javax.swing.*; 00039 import java.util.Vector; 00040 import javax.swing.table.*; 00041 import javax.swing.JComboBox; 00042 import ca.mcgill.sable.soot.*; 00043 import javax.swing.tree.TreeNode; 00044 import ca.mcgill.sable.soot.jimple.*; 00045 import edu.ksu.cis.bandera.abstraction.*; 00046 public class LocalTreeNode extends TypeTreeNode implements VarTreeNode { 00047 static Vector locals; 00048 protected Local lcl; 00049 protected Abstraction abstraction; 00050 protected javax.swing.JComboBox comboBox; 00051 /** 00052 * LocalTreeNode constructor comment. 00053 */ 00054 public LocalTreeNode(Local local) { 00055 super(local.getName()); 00056 lcl = local; 00057 locals.add(this); 00058 if (JTreeTable.absTable.get(local.getType()) != null) { 00059 comboBox = new JComboBox((Vector) JTreeTable.absTable.get(local.getType())); 00060 comboBox.setSelectedItem(edu.ksu.cis.bandera.abstraction.ConcreteIntegralAbstraction.v()); 00061 } else 00062 if (local.getType() instanceof RefType) { 00063 comboBox = new JComboBox(); 00064 comboBox.addItem("No Selection"); 00065 comboBox.addItem(ClassAbstraction.v(((RefType) local.getType()).className)); 00066 } else { 00067 comboBox = new JComboBox(); 00068 comboBox.addItem("No Selection"); 00069 } 00070 /* else 00071 if (local.getType().getClass() == AbstractRefType.class) { 00072 comboBox = new JComboBox(); 00073 comboBox.addItem(ObjectAbstraction.v((AbstractRefType) local.getType()).getType()); 00074 } else 00075 if (local.getType().getClass() == IntType.class) { 00076 comboBox = new JComboBox(); 00077 comboBox.addItem("4"); 00078 comboBox.addItem(new Integer(3)); 00079 comboBox.addItem(""); 00080 comboBox.addItem("None"); 00081 }*/ 00082 } 00083 public Abstraction getAbstraction() { 00084 return abstraction; 00085 } 00086 /** 00087 * Insert the method's description here. 00088 * Creation date: (5/12/00 12:56:45 PM) 00089 * @return boolean 00090 */ 00091 public boolean getAllowsChildren() { 00092 return false; 00093 } 00094 /** 00095 * Insert the method's description here. 00096 * Creation date: (3/24/00 12:20:36 AM) 00097 * @return javax.swing.table.TableCellRenderer 00098 * @param row int 00099 * @param column int 00100 */ 00101 public TableCellEditor getCellEditor(int column) { 00102 if (column == 2) 00103 return new DefaultCellEditor(comboBox); 00104 else 00105 return null; 00106 } 00107 /** 00108 * Insert the method's description here. 00109 * Creation date: (3/24/00 12:20:36 AM) 00110 * @return javax.swing.table.TableCellRenderer 00111 * @param row int 00112 * @param column int 00113 */ 00114 public TableCellRenderer getCellRenderer(int column) { 00115 return null; 00116 } 00117 /** 00118 * 00119 * @return javax.swing.JComboBox 00120 */ 00121 public javax.swing.JComboBox getComboBox() { 00122 return comboBox; 00123 } 00124 /** 00125 * Insert the method's description here. 00126 * Creation date: (3/23/00 11:50:00 PM) 00127 * @return ca.mcgill.sable.soot.Type 00128 */ 00129 public Type getType() { 00130 SootMethod method = ((MethodTreeNode) parent).getMethod(); 00131 return ((JimpleBody) method.getBody(Jimple.v())).getLocal(name).getType(); 00132 } 00133 /** 00134 * Insert the method's description here. 00135 * Creation date: (5/19/00 2:31:39 PM) 00136 * @return java.lang.Object 00137 */ 00138 public Object getVar() { 00139 return lcl; 00140 } 00141 public void setAbstraction(Abstraction type) { 00142 abstraction = type; 00143 } 00144 /** 00145 * Insert the method's description here. 00146 * Creation date: (3/23/00 11:30:08 PM) 00147 * @return java.lang.String 00148 */ 00149 public String toString() { 00150 return getName().toString(); 00151 } 00152 }