KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ca > mcgill > sable > soot > launching > SootConfigProjectLauncher


1 /* Soot - a J*va Optimization Framework
2  * Copyright (C) 2003 Jennifer Lhotak
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * 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 JavaDoc;
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(getWindow().getShell());
41         manager.setEclipseDefList(setEclipseDefs());
42         manager.setLauncher(this);
43         manager.open();
44         
45         
46     }
47     
48     public void launch(String JavaDoc name, String JavaDoc mainClass) {
49         
50         IDialogSettings settings = SootPlugin.getDefault().getDialogSettings();
51         
52         setSootCommandList(new SootCommandList());
53         SootSavedConfiguration ssc = new SootSavedConfiguration(name, settings.getArray(name));
54         ssc.setEclipseDefs(setEclipseDefs());
55         
56         getSootCommandList().addSingleOpt(ssc.toRunArray());
57         
58         if ((mainClass == null) || (mainClass.length() == 0)){
59             runSootDirectly();
60         }
61         else {
62             runSootDirectly(mainClass);
63         }
64         runFinish();
65     }
66     
67     private HashMap JavaDoc setEclipseDefs() {
68         
69         HashMap JavaDoc defs = new HashMap JavaDoc();
70         defs.put(LaunchCommands.OUTPUT_DIR, getOutputLocation());
71         
72         defs.put(LaunchCommands.SOOT_CLASSPATH, getProcess_path()+getSootClasspath().getSeparator()+getClasspathAppend());
73         
74         defs.put(LaunchCommands.PROCESS_PATH, getProcess_path());
75         defs.put(LaunchCommands.KEEP_LINE_NUMBER, new Boolean JavaDoc(true));
76         defs.put(LaunchCommands.XML_ATTRIBUTES, new Boolean JavaDoc(true));
77         
78         return defs;
79     }
80     
81     
82 }
83
Popular Tags