01: /* Soot - a J*va Optimization Framework
02: * Copyright (C) 2003 Jennifer Lhotak
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 2.1 of the License, or (at your option) any later version.
08: *
09: * This library is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the
16: * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17: * Boston, MA 02111-1307, USA.
18: */
19:
20: package ca.mcgill.sable.soot.launching;
21:
22: import java.util.HashMap;
23:
24: import org.eclipse.jface.action.IAction;
25: import ca.mcgill.sable.soot.*;
26: import ca.mcgill.sable.soot.ui.SootConfigManagerDialog;
27:
28: import org.eclipse.jface.dialogs.*;
29:
30: /**
31: * Launches a saved Soot configuration on the all the
32: * class files in the output dir of the selected project
33: */
34: public class SootConfigProjectLauncher extends SootProjectLauncher {
35:
36: public void run(IAction action) {
37:
38: super .run(action);
39:
40: SootConfigManagerDialog manager = new SootConfigManagerDialog(
41: getWindow().getShell());
42: manager.setEclipseDefList(setEclipseDefs());
43: manager.setLauncher(this );
44: manager.open();
45:
46: }
47:
48: public void launch(String name, String mainClass) {
49:
50: IDialogSettings settings = SootPlugin.getDefault()
51: .getDialogSettings();
52:
53: setSootCommandList(new SootCommandList());
54: SootSavedConfiguration ssc = new SootSavedConfiguration(name,
55: settings.getArray(name));
56: ssc.setEclipseDefs(setEclipseDefs());
57:
58: getSootCommandList().addSingleOpt(ssc.toRunArray());
59:
60: if ((mainClass == null) || (mainClass.length() == 0)) {
61: runSootDirectly();
62: } else {
63: runSootDirectly(mainClass);
64: }
65: runFinish();
66: }
67:
68: private HashMap setEclipseDefs() {
69:
70: HashMap defs = new HashMap();
71: defs.put(LaunchCommands.OUTPUT_DIR, getOutputLocation());
72:
73: defs.put(LaunchCommands.SOOT_CLASSPATH, getProcess_path()
74: + getSootClasspath().getSeparator()
75: + getClasspathAppend());
76:
77: defs.put(LaunchCommands.PROCESS_PATH, getProcess_path());
78: defs.put(LaunchCommands.KEEP_LINE_NUMBER, new Boolean(true));
79: defs.put(LaunchCommands.XML_ATTRIBUTES, new Boolean(true));
80:
81: return defs;
82: }
83:
84: }
|