1 19 20 package ca.mcgill.sable.soot.launching; 21 22 import java.util.HashMap ; 23 import java.util.Iterator ; 24 25 import org.eclipse.jface.action.IAction; 26 import ca.mcgill.sable.soot.*; 27 import ca.mcgill.sable.soot.ui.SootConfigManagerDialog; 28 29 import org.eclipse.jface.dialogs.*; 30 31 35 public class SootConfigJavaProjectLauncher extends SootProjectLauncher { 36 37 public void run(IAction action) { 38 39 super.run(action); 40 41 SootConfigManagerDialog manager = new SootConfigManagerDialog(getWindow().getShell()); 42 manager.setEclipseDefList(setEclipseDefs()); 43 manager.setLauncher(this); 44 manager.open(); 45 46 47 } 48 49 public void launch(String name, String mainClass) { 50 51 IDialogSettings settings = SootPlugin.getDefault().getDialogSettings(); 52 53 setSootCommandList(new SootCommandList()); 54 55 SootSavedConfiguration ssc = new SootSavedConfiguration(name, settings.getArray(name)); 56 ssc.setEclipseDefs(setRunEclipseDefs()); 57 58 getSootCommandList().addSingleOpt(ssc.toRunArray()); 59 60 if ((mainClass == null) || (mainClass.length() == 0)){ 61 runSootDirectly(); 62 } 63 else { 64 runSootDirectly(mainClass); 65 } 66 runFinish(); 67 } 68 69 private HashMap setEclipseDefs() { 70 71 HashMap defs = new HashMap (); 72 defs.put(LaunchCommands.OUTPUT_DIR, getOutputLocation()); 73 Iterator it = getJavaProcessPath().iterator(); 74 String cp = (String )it.next(); 75 while (it.hasNext()){ 76 cp = cp + getSootClasspath().getSeparator() + (String )it.next(); 77 } 78 cp = cp + getSootClasspath().getSeparator() + getClasspathAppend(); 79 defs.put(LaunchCommands.SOOT_CLASSPATH, cp); 80 defs.put(LaunchCommands.PROCESS_PATH, getJavaProcessPath()); 81 defs.put(LaunchCommands.KEEP_LINE_NUMBER, new Boolean (true)); 82 defs.put(LaunchCommands.XML_ATTRIBUTES, new Boolean (true)); 83 84 defs.put(LaunchCommands.SRC_PREC, "java"); 85 86 return defs; 87 } 88 89 private HashMap setRunEclipseDefs() { 90 91 HashMap defs = new HashMap (); 92 defs.put(LaunchCommands.OUTPUT_DIR, getOutputLocation()); 93 Iterator it = getJavaProcessPath().iterator(); 94 String cp = (String )it.next(); 95 while (it.hasNext()){ 96 cp = cp + getSootClasspath().getSeparator() + (String )it.next(); 97 } 98 cp = cp + getSootClasspath().getSeparator() + getClasspathAppend(); 99 defs.put(LaunchCommands.SOOT_CLASSPATH, cp); 100 Iterator it2 = getJavaProcessPath().iterator(); 101 String pPath = ""; 102 while (it2.hasNext()){ 103 String next = (String )it2.next(); 104 if (pPath.equals("")){ 105 pPath = next; 106 } 107 else { 108 pPath = pPath + "\r\n" + next; 109 } 110 111 } 112 defs.put(LaunchCommands.PROCESS_PATH, pPath); 113 defs.put(LaunchCommands.KEEP_LINE_NUMBER, new Boolean (true)); 114 defs.put(LaunchCommands.XML_ATTRIBUTES, new Boolean (true)); 115 116 defs.put(LaunchCommands.SRC_PREC, "java"); 117 return defs; 118 } 119 120 121 } 122 | Popular Tags |