package de.unibremen.informatik.hets.graphviz;
import java.io.IOException;
import javax.swing.JOptionPane;
//import org.apache.log4j.Logger;
/**
* User: matthewhorridge
* The Univeristy Of Manchester
* Medical Informatics Group
* Date: Jan 16, 2004
*
DotProcess
, and starts
* the native dot process. Using the default process
* path for the particular platfrom being used.
*/
public DotProcess() {
}
/**
* Lays out a graph using the dot application
*
* @param fileName A file that acts as a 'scratch pad'
* The graph is read from this file, and then export
* to the same file in attributed dot format.
* @return true
if the process completed without
* any errors, or false
if the process did not
* complete.
*/
public boolean startProcess(String fileName) {
if(process != null) {
killProcess();
}
Runtime r = Runtime.getRuntime();
//DotLayoutEngineProperties properties = DotLayoutEngineProperties.getInstance();
try {
//process = r.exec(properties.getDotProcessPath() + " " + fileName + " -q -o " + fileName);
process = r.exec("/usr/bin/dot" + " " + fileName + " -q -o " + fileName);
try {
process.waitFor();
return true;
}
catch(InterruptedException irEx) {
irEx.printStackTrace();
return false;
}
}
catch(IOException ioEx) {
String errMsg = "An error related to DOT has occurred. " + "This error was probably because OWLViz could not" + " find the DOT application. Please ensure that the" + " path to the DOT application is set properly";
String dlgErrMsg = "A DOT error has occurred.