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 32 35 public class SootConfigFromJavaFileLauncher extends SootFileLauncher { 36 37 public void run(IAction action) { 38 39 super.run(action); 40 super.setIsSrcPrec(true); 41 super.setSrcPrec(LaunchCommands.JAVA_IN); 42 super.handleMultipleFiles(); 43 44 if (isDoNotContinue()) return; 45 window = SootPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow(); 46 47 SootConfigManagerDialog manager = new SootConfigManagerDialog(window.getShell()); 48 manager.setEclipseDefList(setEclipseDefs()); 49 manager.setLauncher(this); 50 manager.open(); 51 52 53 } 54 55 public void launch(String name, String mainClass) { 56 57 IDialogSettings settings = SootPlugin.getDefault().getDialogSettings(); 58 59 setSootCommandList(new SootCommandList()); 60 61 62 SootSavedConfiguration ssc = new SootSavedConfiguration(name, settings.getArray(name)); 63 ssc.setEclipseDefs(setEclipseDefs()); 64 65 getSootCommandList().addSingleOpt(ssc.toRunArray()); 66 Iterator it = getToProcessList().iterator(); 67 while (it.hasNext()){ 68 getSootCommandList().addSingleOpt((String )it.next()); 69 } 70 71 if ((mainClass == null) || (mainClass.length() == 0)){ 72 runSootDirectly(); 73 } 74 else { 75 runSootDirectly(mainClass); 76 } 77 runFinish(); 78 } 79 80 private HashMap setEclipseDefs() { 81 82 HashMap defs = new HashMap (); 83 defs.put(LaunchCommands.OUTPUT_DIR, getOutputLocation()); 84 85 defs.put(LaunchCommands.SOOT_CLASSPATH, getClasspathAppend()); 86 87 if (isSrcPrec()) { 88 defs.put(LaunchCommands.SRC_PREC, getSrcPrec()); 89 } 90 defs.put(LaunchCommands.KEEP_LINE_NUMBER, new Boolean (true)); 91 92 defs.put(LaunchCommands.XML_ATTRIBUTES, new Boolean (true)); 93 94 return defs; 95 } 96 97 98 } 99 | Popular Tags |