private ModelingProject loadModel(ILaunchConfiguration configuration) throws CoreException {
String modelFilePath = configuration.getAttribute(VAR_ROOT_MODEL_PATH, "");
IFile modelFile = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(modelFilePath));
if (modelFile.exists()) {
LoadingService service = new LoadingService();
InputStream inStream = null;
try {
inStream = modelFile.getContents();
service.setInStream(inStream);
service.setLocationSolver(new WorkspaceLocationSolver());
service.initialize();
service.invoke();
if (service.getLoadedResource() instanceof ModelingProject) return (ModelingProject) service.getLoadedResource();
else throw new CoreException(new Status(Status.ERROR, "q_impress", "Unable to load model, invalid file."));
} catch (CoreException e) {
throw new CoreException(new Status(Status.ERROR, "q_impress", "Unable to load model.", e));
} catch (ServiceException e) {
throw new CoreException(new Status(Status.ERROR, "q_impress", "Unable to load model.", e));