if (selectedFile == null) {
return;
}
SwingInterface swingInterface = new SwingInterface(selectedFile.getName(),Thread.currentThread());
ExampleInterperterFactory interperterFactory =
new ExampleInterperterFactory(selectedFile.getAbsolutePath(), UserInterfaceInterceptionUtils.createLogInterceptor(swingInterface));
swingInterface.start();
try {
Interperter interperter = interperterFactory.createInterperter();
swingInterface.addCompletion(new CommandCompletion(interperter));
swingInterface.addCompletion(new FileCompletion(interperter));
interperter.interpret();
} catch (ValidationException e) {
ErrorDialog errorDialog = new ErrorDialog(swingInterface.getFrame(), e);
errorDialog.setVisible(true);
swingInterface.stop();
}
}