some refactoring, renaming
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@1286 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
parent
a0ff56c0ed
commit
ac3df37a0b
|
@ -21,16 +21,10 @@ public abstract class BasicBlockDecorator implements NodeDecorator {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Returns the currentNode.
|
|
||||||
*/
|
|
||||||
public CGNode getCurrentNode() {
|
public CGNode getCurrentNode() {
|
||||||
return currentNode;
|
return currentNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param currentNode The currentNode to set.
|
|
||||||
*/
|
|
||||||
public void setCurrentNode(CGNode currentNode) {
|
public void setCurrentNode(CGNode currentNode) {
|
||||||
this.currentNode = currentNode;
|
this.currentNode = currentNode;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,29 +13,11 @@ package com.ibm.wala.viz;
|
||||||
import org.eclipse.jface.window.ApplicationWindow;
|
import org.eclipse.jface.window.ApplicationWindow;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <!-- begin-user-doc -->
|
* abstract base class for launching a JFace application
|
||||||
* An implementation of the model object '<em><b>EJface Application Runner</b></em>'.
|
*
|
||||||
* <!-- end-user-doc -->
|
* TODO: unify with other launchers?
|
||||||
* <p>
|
|
||||||
* The following features are implemented:
|
|
||||||
* <ul>
|
|
||||||
* <li>{@link com.ibm.wala.viz.EJfaceApplicationRunner#getApplicationWindow <em>Application Window</em>}</li>
|
|
||||||
* <li>{@link com.ibm.wala.viz.EJfaceApplicationRunner#isBlockInput <em>Block Input</em>}</li>
|
|
||||||
* </ul>
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @generated
|
|
||||||
*/
|
*/
|
||||||
public abstract class EJfaceApplicationRunner {
|
public abstract class EJfaceApplicationRunner {
|
||||||
/**
|
|
||||||
* The default value of the '{@link #getApplicationWindow() <em>Application Window</em>}' attribute.
|
|
||||||
* <!-- begin-user-doc -->
|
|
||||||
* <!-- end-user-doc -->
|
|
||||||
* @see #getApplicationWindow()
|
|
||||||
* @generated
|
|
||||||
* @ordered
|
|
||||||
*/
|
|
||||||
protected static final ApplicationWindow APPLICATION_WINDOW_EDEFAULT = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The cached value of the '{@link #getApplicationWindow() <em>Application Window</em>}' attribute.
|
* The cached value of the '{@link #getApplicationWindow() <em>Application Window</em>}' attribute.
|
||||||
|
@ -45,33 +27,10 @@ public abstract class EJfaceApplicationRunner {
|
||||||
* @generated
|
* @generated
|
||||||
* @ordered
|
* @ordered
|
||||||
*/
|
*/
|
||||||
protected ApplicationWindow applicationWindow = APPLICATION_WINDOW_EDEFAULT;
|
protected ApplicationWindow applicationWindow = null;
|
||||||
|
|
||||||
/**
|
protected boolean blockInput = false;
|
||||||
* The default value of the '{@link #isBlockInput() <em>Block Input</em>}' attribute.
|
|
||||||
* <!-- begin-user-doc -->
|
|
||||||
* <!-- end-user-doc -->
|
|
||||||
* @see #isBlockInput()
|
|
||||||
* @generated
|
|
||||||
* @ordered
|
|
||||||
*/
|
|
||||||
protected static final boolean BLOCK_INPUT_EDEFAULT = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The cached value of the '{@link #isBlockInput() <em>Block Input</em>}' attribute.
|
|
||||||
* <!-- begin-user-doc -->
|
|
||||||
* <!-- end-user-doc -->
|
|
||||||
* @see #isBlockInput()
|
|
||||||
* @generated
|
|
||||||
* @ordered
|
|
||||||
*/
|
|
||||||
protected boolean blockInput = BLOCK_INPUT_EDEFAULT;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <!-- begin-user-doc -->
|
|
||||||
* <!-- end-user-doc -->
|
|
||||||
* @generated
|
|
||||||
*/
|
|
||||||
protected EJfaceApplicationRunner() {
|
protected EJfaceApplicationRunner() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,95 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2002 - 2006 IBM Corporation.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* IBM Corporation - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package com.ibm.wala.viz;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import com.ibm.wala.util.warnings.WalaException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Launch gsview on a postscript file
|
||||||
|
*
|
||||||
|
* TODO: inherit from a launcher?
|
||||||
|
*/
|
||||||
|
class GSViewLauncher {
|
||||||
|
|
||||||
|
private Process process;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name of the postscript file to view
|
||||||
|
*/
|
||||||
|
protected String psfile = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Path to ghostview executable
|
||||||
|
*/
|
||||||
|
protected String gvExe = null;
|
||||||
|
|
||||||
|
GSViewLauncher() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
String getPsfile() {
|
||||||
|
return psfile;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setPsfile(String newPsfile) {
|
||||||
|
psfile = newPsfile;
|
||||||
|
}
|
||||||
|
|
||||||
|
String getGvExe() {
|
||||||
|
return gvExe;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setGvExe(String newGvExe) {
|
||||||
|
gvExe = newGvExe;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuffer result = new StringBuffer(super.toString());
|
||||||
|
result.append(", psfile: ");
|
||||||
|
result.append(psfile);
|
||||||
|
result.append(", gvExe: ");
|
||||||
|
result.append(gvExe);
|
||||||
|
result.append(')');
|
||||||
|
return result.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private WalaException exception = null;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @see java.lang.Runnable#run()
|
||||||
|
*/
|
||||||
|
public void run() {
|
||||||
|
String[] cmdarray = { getGvExe(), getPsfile() };
|
||||||
|
try {
|
||||||
|
Process p = Runtime.getRuntime().exec(cmdarray);
|
||||||
|
setProcess(p);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
exception = new WalaException("gv invocation failed for\n" + Arrays.toString(cmdarray));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public WalaException getException() {
|
||||||
|
return exception;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Process getProcess() {
|
||||||
|
return process;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProcess(Process process) {
|
||||||
|
this.process = process;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,240 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2002 - 2006 IBM Corporation.
|
|
||||||
* All rights reserved. This program and the accompanying materials
|
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
* which accompanies this distribution, and is available at
|
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* IBM Corporation - initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
package com.ibm.wala.viz;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
import com.ibm.wala.util.warnings.WalaException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <!-- begin-user-doc -->
|
|
||||||
* An implementation of the model object '<em><b>GS View Launcher</b></em>'.
|
|
||||||
* <!-- end-user-doc -->
|
|
||||||
* <p>
|
|
||||||
* The following features are implemented:
|
|
||||||
* <ul>
|
|
||||||
* <li>{@link com.ibm.wala.viz.GSViewLauncherImpl#getVendor <em>Vendor</em>}</li>
|
|
||||||
* <li>{@link com.ibm.wala.viz.GSViewLauncherImpl#getVersion <em>Version</em>}</li>
|
|
||||||
* <li>{@link com.ibm.wala.viz.GSViewLauncherImpl#getPsfile <em>Psfile</em>}</li>
|
|
||||||
* <li>{@link com.ibm.wala.viz.GSViewLauncherImpl#getGvExe <em>Gv Exe</em>}</li>
|
|
||||||
* </ul>
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @generated
|
|
||||||
*/
|
|
||||||
public class GSViewLauncherImpl {
|
|
||||||
|
|
||||||
private Process process;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The default value of the '{@link #getDescription() <em>Description</em>}' attribute.
|
|
||||||
* <!-- begin-user-doc -->
|
|
||||||
* <!-- end-user-doc -->
|
|
||||||
* @see #getDescription()
|
|
||||||
* @generated
|
|
||||||
* @ordered
|
|
||||||
*/
|
|
||||||
protected static final String DESCRIPTION_EDEFAULT = "Launch gsview on a postscript file";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The default value of the '{@link #getVendor() <em>Vendor</em>}' attribute.
|
|
||||||
* <!-- begin-user-doc -->
|
|
||||||
* <!-- end-user-doc -->
|
|
||||||
* @see #getVendor()
|
|
||||||
* @generated
|
|
||||||
* @ordered
|
|
||||||
*/
|
|
||||||
protected static final String VENDOR_EDEFAULT = "IBM";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The cached value of the '{@link #getVendor() <em>Vendor</em>}' attribute.
|
|
||||||
* <!-- begin-user-doc -->
|
|
||||||
* <!-- end-user-doc -->
|
|
||||||
* @see #getVendor()
|
|
||||||
* @generated
|
|
||||||
* @ordered
|
|
||||||
*/
|
|
||||||
final protected String vendor = VENDOR_EDEFAULT;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The default value of the '{@link #getVersion() <em>Version</em>}' attribute.
|
|
||||||
* <!-- begin-user-doc -->
|
|
||||||
* <!-- end-user-doc -->
|
|
||||||
* @see #getVersion()
|
|
||||||
* @generated
|
|
||||||
* @ordered
|
|
||||||
*/
|
|
||||||
protected static final String VERSION_EDEFAULT = "0.01";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The cached value of the '{@link #getVersion() <em>Version</em>}' attribute.
|
|
||||||
* <!-- begin-user-doc -->
|
|
||||||
* <!-- end-user-doc -->
|
|
||||||
* @see #getVersion()
|
|
||||||
* @generated
|
|
||||||
* @ordered
|
|
||||||
*/
|
|
||||||
final protected String version = VERSION_EDEFAULT;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The default value of the '{@link #getPsfile() <em>Psfile</em>}' attribute.
|
|
||||||
* <!-- begin-user-doc -->
|
|
||||||
* <!-- end-user-doc -->
|
|
||||||
* @see #getPsfile()
|
|
||||||
* @generated
|
|
||||||
* @ordered
|
|
||||||
*/
|
|
||||||
protected static final String PSFILE_EDEFAULT = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The cached value of the '{@link #getPsfile() <em>Psfile</em>}' attribute.
|
|
||||||
* <!-- begin-user-doc -->
|
|
||||||
* <!-- end-user-doc -->
|
|
||||||
* @see #getPsfile()
|
|
||||||
* @generated
|
|
||||||
* @ordered
|
|
||||||
*/
|
|
||||||
protected String psfile = PSFILE_EDEFAULT;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The default value of the '{@link #getGvExe() <em>Gv Exe</em>}' attribute.
|
|
||||||
* <!-- begin-user-doc -->
|
|
||||||
* <!-- end-user-doc -->
|
|
||||||
* @see #getGvExe()
|
|
||||||
* @generated
|
|
||||||
* @ordered
|
|
||||||
*/
|
|
||||||
protected static final String GV_EXE_EDEFAULT = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The cached value of the '{@link #getGvExe() <em>Gv Exe</em>}' attribute.
|
|
||||||
* <!-- begin-user-doc -->
|
|
||||||
* <!-- end-user-doc -->
|
|
||||||
* @see #getGvExe()
|
|
||||||
* @generated
|
|
||||||
* @ordered
|
|
||||||
*/
|
|
||||||
protected String gvExe = GV_EXE_EDEFAULT;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <!-- begin-user-doc -->
|
|
||||||
* <!-- end-user-doc -->
|
|
||||||
* @generated
|
|
||||||
*/
|
|
||||||
protected GSViewLauncherImpl() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <!-- begin-user-doc -->
|
|
||||||
* <!-- end-user-doc -->
|
|
||||||
* @generated
|
|
||||||
*/
|
|
||||||
public String getVendor() {
|
|
||||||
return vendor;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <!-- begin-user-doc -->
|
|
||||||
* <!-- end-user-doc -->
|
|
||||||
* @generated
|
|
||||||
*/
|
|
||||||
public String getVersion() {
|
|
||||||
return version;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <!-- begin-user-doc -->
|
|
||||||
* <!-- end-user-doc -->
|
|
||||||
* @generated
|
|
||||||
*/
|
|
||||||
public String getPsfile() {
|
|
||||||
return psfile;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <!-- begin-user-doc -->
|
|
||||||
* <!-- end-user-doc -->
|
|
||||||
* @generated
|
|
||||||
*/
|
|
||||||
public void setPsfile(String newPsfile) {
|
|
||||||
psfile = newPsfile;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <!-- begin-user-doc -->
|
|
||||||
* <!-- end-user-doc -->
|
|
||||||
* @generated
|
|
||||||
*/
|
|
||||||
public String getGvExe() {
|
|
||||||
return gvExe;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <!-- begin-user-doc -->
|
|
||||||
* <!-- end-user-doc -->
|
|
||||||
* @generated
|
|
||||||
*/
|
|
||||||
public void setGvExe(String newGvExe) {
|
|
||||||
gvExe = newGvExe;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <!-- begin-user-doc -->
|
|
||||||
* <!-- end-user-doc -->
|
|
||||||
* @generated
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
StringBuffer result = new StringBuffer(super.toString());
|
|
||||||
result.append(", vendor: ");
|
|
||||||
result.append(vendor);
|
|
||||||
result.append(", version: ");
|
|
||||||
result.append(version);
|
|
||||||
result.append(", psfile: ");
|
|
||||||
result.append(psfile);
|
|
||||||
result.append(", gvExe: ");
|
|
||||||
result.append(gvExe);
|
|
||||||
result.append(')');
|
|
||||||
return result.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private WalaException exception = null;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @see java.lang.Runnable#run()
|
|
||||||
*/
|
|
||||||
public void run() {
|
|
||||||
String[] cmdarray = { getGvExe(), getPsfile() };
|
|
||||||
try {
|
|
||||||
Process p = Runtime.getRuntime().exec(cmdarray);
|
|
||||||
setProcess(p);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
exception = new WalaException("gv invocation failed for\n" + Arrays.toString(cmdarray));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @return Returns the exception.
|
|
||||||
*/
|
|
||||||
public WalaException getException() {
|
|
||||||
return exception;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Process getProcess() {
|
|
||||||
return process;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProcess(Process process) {
|
|
||||||
this.process = process;
|
|
||||||
}
|
|
||||||
} //GSViewLauncherImpl
|
|
|
@ -26,7 +26,7 @@ public class GVUtil {
|
||||||
*/
|
*/
|
||||||
public static Process launchGV(String psFile, String gvExe) throws WalaException {
|
public static Process launchGV(String psFile, String gvExe) throws WalaException {
|
||||||
// set up a viewer for the ps file.
|
// set up a viewer for the ps file.
|
||||||
final GSViewLauncherImpl gv = new GSViewLauncherImpl();
|
final GSViewLauncher gv = new GSViewLauncher();
|
||||||
gv.setGvExe(gvExe);
|
gv.setGvExe(gvExe);
|
||||||
gv.setPsfile(psFile);
|
gv.setPsfile(psFile);
|
||||||
gv.run();
|
gv.run();
|
||||||
|
|
|
@ -32,7 +32,7 @@ import com.ibm.wala.util.warnings.WalaException;
|
||||||
*
|
*
|
||||||
* @author Stephen Fink
|
* @author Stephen Fink
|
||||||
*/
|
*/
|
||||||
public class IFDSExplorerImpl {
|
public class IFDSExplorer {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* absolute path name to invoke dot
|
* absolute path name to invoke dot
|
||||||
|
@ -45,9 +45,6 @@ public class IFDSExplorerImpl {
|
||||||
*/
|
*/
|
||||||
protected static String gvExe = null;
|
protected static String gvExe = null;
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
public static void setDotExe(String newDotExe) {
|
public static void setDotExe(String newDotExe) {
|
||||||
dotExe = newDotExe;
|
dotExe = newDotExe;
|
||||||
}
|
}
|
||||||
|
@ -56,7 +53,6 @@ public class IFDSExplorerImpl {
|
||||||
gvExe = newGvExe;
|
gvExe = newGvExe;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void viewIFDS(CallGraph cg, TabulationResult r) throws WalaException {
|
public static void viewIFDS(CallGraph cg, TabulationResult r) throws WalaException {
|
||||||
|
|
||||||
if (r == null) {
|
if (r == null) {
|
||||||
|
@ -112,4 +108,4 @@ public class IFDSExplorerImpl {
|
||||||
return gvExe;
|
return gvExe;
|
||||||
}
|
}
|
||||||
|
|
||||||
} //IFDSExplorerImpl
|
}
|
|
@ -22,22 +22,11 @@ public class ViewAnnotatedIRAction extends ViewIRAction {
|
||||||
|
|
||||||
private final BasicBlockDecorator dec;
|
private final BasicBlockDecorator dec;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param viewer
|
|
||||||
* @param cg
|
|
||||||
* @param psFile
|
|
||||||
* @param dotFile
|
|
||||||
* @param dotExe
|
|
||||||
* @param gvExe
|
|
||||||
*/
|
|
||||||
public ViewAnnotatedIRAction(SWTTreeViewer viewer, CallGraph cg, String psFile, String dotFile, String dotExe, String gvExe, BasicBlockDecorator dec) {
|
public ViewAnnotatedIRAction(SWTTreeViewer viewer, CallGraph cg, String psFile, String dotFile, String dotExe, String gvExe, BasicBlockDecorator dec) {
|
||||||
super(viewer, cg, psFile, dotFile, dotExe, gvExe);
|
super(viewer, cg, psFile, dotFile, dotExe, gvExe);
|
||||||
this.dec = dec;
|
this.dec = dec;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.jface.action.IAction#run()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
IR ir = getIRForSelection();
|
IR ir = getIRForSelection();
|
||||||
|
|
Loading…
Reference in New Issue