//Hopefully we dont need to go and get the path etc now
FBXApplication fbxapp =(FBXApplication)obj;
String circuitFile = fbxapp.getCircuitFile().getFullPath().toString();
//showMessage("opening:" + circuitFile);
OpenFileAction openFileAction = new OpenFileAction();
openFileAction.setFilename(circuitFile);
openFileAction.run();
if(!openFileAction.isSuccess()){
showMessage("File Not found: " + circuitFile);
}
}
else if(obj instanceof FBXCircuit){
//Maybe we should get a run action from the object?
//Failing that ,we should ask the object what to do
FBXCircuit circ = (FBXCircuit)obj;
if(circ.getSwitchFile() != null){
OpenFileAction openFileAction = new OpenFileAction();
String switchPath = circ.getSwitchFile().getFullPath().toString();
openFileAction.setFilename(switchPath);
openFileAction.run();
if(!openFileAction.isSuccess()){
showMessage("File Not found: " + switchPath);
}
}
else{
Utils.println("No switch file exists.. create?");
showMessage("Switch File not found");
}
}
else if(obj instanceof FBXFuseAction){
FBXFuseAction fuseaction = (FBXFuseAction)obj;
FBXCircuit circ = fuseaction.getCircuit();
String switchFile = fuseaction.getSwichFile().getFullPath().toString();
OpenFileAction openFileAction = new OpenFileAction();
openFileAction.setFilename(switchFile);
openFileAction.open(fuseaction.getTagStart(), fuseaction.getTagEnd());
if(!openFileAction.isSuccess()){
showMessage("File Not found: " + switchFile);
}
}
else if(obj instanceof FBXFuse){
FBXFuse fuse= (FBXFuse)obj;
FBXFuseAction fuseaction = (FBXFuseAction)fuse.getParent();
FBXCircuit circ = fuseaction.getCircuit();
OpenFileAction openFileAction = new OpenFileAction();
String fusePath = projcombo.getText() + "/" + fuse.getPath();
//showMessage(fusePath);
//We open the file then go to the line.(which we should have stored in the FBXFuseAction or we get it
// again with a "getFuseActionLocation(circuit, fuseaction) from the FBXparser
//Find if it already has
openFileAction.setFilename(fusePath);
openFileAction.run();
if(!openFileAction.isSuccess()){
showMessage("File Not found: " + fusePath);
}
}
else if (obj instanceof FBXDo){