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:
sjfink 2007-06-15 14:05:18 +00:00
parent a0ff56c0ed
commit ac3df37a0b
7 changed files with 103 additions and 310 deletions

View File

@ -21,16 +21,10 @@ public abstract class BasicBlockDecorator implements NodeDecorator {
super();
}
/**
* @return Returns the currentNode.
*/
public CGNode getCurrentNode() {
return currentNode;
}
/**
* @param currentNode The currentNode to set.
*/
public void setCurrentNode(CGNode currentNode) {
this.currentNode = currentNode;
}

View File

@ -13,29 +13,11 @@ package com.ibm.wala.viz;
import org.eclipse.jface.window.ApplicationWindow;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>EJface Application Runner</b></em>'.
* <!-- end-user-doc -->
* <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
* abstract base class for launching a JFace application
*
* TODO: unify with other launchers?
*/
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.
@ -45,33 +27,10 @@ public abstract class EJfaceApplicationRunner {
* @generated
* @ordered
*/
protected ApplicationWindow applicationWindow = APPLICATION_WINDOW_EDEFAULT;
protected ApplicationWindow applicationWindow = null;
/**
* 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;
protected boolean blockInput = 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() {
super();
}

View File

@ -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;
}
}

View File

@ -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

View File

@ -26,7 +26,7 @@ public class GVUtil {
*/
public static Process launchGV(String psFile, String gvExe) throws WalaException {
// set up a viewer for the ps file.
final GSViewLauncherImpl gv = new GSViewLauncherImpl();
final GSViewLauncher gv = new GSViewLauncher();
gv.setGvExe(gvExe);
gv.setPsfile(psFile);
gv.run();

View File

@ -32,7 +32,7 @@ import com.ibm.wala.util.warnings.WalaException;
*
* @author Stephen Fink
*/
public class IFDSExplorerImpl {
public class IFDSExplorer {
/**
* absolute path name to invoke dot
@ -45,9 +45,6 @@ public class IFDSExplorerImpl {
*/
protected static String gvExe = null;
/**
*/
public static void setDotExe(String newDotExe) {
dotExe = newDotExe;
}
@ -56,7 +53,6 @@ public class IFDSExplorerImpl {
gvExe = newGvExe;
}
public static void viewIFDS(CallGraph cg, TabulationResult r) throws WalaException {
if (r == null) {
@ -112,4 +108,4 @@ public class IFDSExplorerImpl {
return gvExe;
}
} //IFDSExplorerImpl
}

View File

@ -22,22 +22,11 @@ public class ViewAnnotatedIRAction extends ViewIRAction {
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) {
super(viewer, cg, psFile, dotFile, dotExe, gvExe);
this.dec = dec;
}
/*
* @see org.eclipse.jface.action.IAction#run()
*/
@Override
public void run() {
IR ir = getIRForSelection();