KickJava   Java API By Example, From Geeks To Geeks.

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


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.ArrayList JavaDoc;
23 import java.util.Iterator JavaDoc;
24
25 import org.eclipse.jface.action.*;
26
27 /**
28  * Launches Soot with -f dava on all classes in output dir of project
29  */

30 public class DavaDecompileJavaProjectLauncher extends SootProjectLauncher {
31
32     
33     public void run(IAction action) {
34         
35         super.run(action);
36
37         setCmd();
38         runSootDirectly();
39         runFinish();
40     }
41     
42     private void setCmd() {
43         
44         ArrayList JavaDoc commands = new ArrayList JavaDoc();
45         commands.add("--"+LaunchCommands.SOOT_CLASSPATH);
46         
47         Iterator JavaDoc it = getJavaProcessPath().iterator();
48         String JavaDoc cp = (String JavaDoc)it.next();
49         while (it.hasNext()){
50             cp = cp + getSootClasspath().getSeparator() + (String JavaDoc)it.next();
51         }
52         cp = cp + getSootClasspath().getSeparator()+ getClasspathAppend();
53         commands.add(cp);
54             
55         commands.add("--"+LaunchCommands.OUTPUT_DIR);
56         commands.add(getOutputLocation());
57         
58         getSootCommandList().addSingleOpt("--"+LaunchCommands.KEEP_LINE_NUMBER);
59         getSootCommandList().addSingleOpt("--"+LaunchCommands.XML_ATTRIBUTES);
60         getSootCommandList().addDoubleOpt("--"+LaunchCommands.SRC_PREC, "java");
61         
62         Iterator JavaDoc it2 = getJavaProcessPath().iterator();
63         while (it2.hasNext()){
64             commands.add("--"+LaunchCommands.PROCESS_PATH);
65             commands.add((String JavaDoc)it2.next());
66         }
67         getSootCommandList().addSingleOpt("--"+LaunchCommands.DAVA);
68         
69         getSootCommandList().addSingleOpt(commands);
70     }
71
72 }
73
Popular Tags