/**
* Opens a current workflow from the local file.
*/
public void openWorkflow() {
Workflow workflow = null;
int returnVal = this.graphFileChooser.showOpenDialog(this.engine.getGUI().getFrame());
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = this.graphFileChooser.getSelectedFile();
logger.info(file.getPath());
try {
String path = file.getPath();
if (path.endsWith(XBayaConstants.GRAPH_FILE_SUFFIX)) {
WSGraph graph = WSGraphFactory.createGraph(file);
workflow = Workflow.graphToWorkflow(graph);
} else {
XmlElement workflowElement = XMLUtil.loadXML(file);
workflow = new Workflow(workflowElement);
engine.getConfiguration().registerExecutionModeChangeListener(workflow);
workflow.executionModeChanged(engine.getConfiguration());
}
GraphCanvas newGraphCanvas = engine.getGUI().newGraphCanvas(true);
newGraphCanvas.setWorkflow(workflow);
//this.engine.setWorkflow(workflow);
engine.getGUI().getGraphCanvas().setWorkflowFile(file);