Source:
private static File getOutputFolder( EObject eobj ) { if (commonOutputPath != null) { return commonOutputPath.toFile(); } Path outputPath = StandaloneUMLRTCodeGenerator.getOutputPath(); if (outputPath != null) { File project = outputPath.toFile(); if (project.exists()) { try { FileVisitor<Path> visitor = new RecursiveFileRemover(); Files.walkFileTree( outputPath, visitor ); } catch (IOException e) { } } if (!project.exists() && !project.mkdirs()) { CodeGenPlugin.error( "Failed to create project" ); return null; } String projectName = project.getName(); String projectPath = project.getParentFile().getPath(); if (!new CppProjectGenerator().generate( projectPath, projectName )) { CodeGenPlugin.error( "Failed to create project" ); return null; } File src = new File( project, "src" ); if (!src.exists() && !src.mkdir()) { CodeGenPlugin.error( "Failed to create source folder" ); return null; } commonOutputPath = src.toPath(); return src; } URI uri = eobj.eResource().getURI(); String projectName = ProjectUtils.getProjectName( eobj ); projectName = projectName + "_CDTProject"; Path elementPath = Paths.get( uri.path() ); Path projectPath = elementPath.getParent().resolveSibling( projectName ); if (!new CppProjectGenerator().generate( projectPath.getParent().toString(), projectName )) { CodeGenPlugin.error( "Failed to create project" ); return null; } File project = projectPath.toFile(); File src = new File( project, "src" ); if (!src.exists() && !src.mkdir()) { CodeGenPlugin.error( "Failed to create source folder" ); return null; } return src; }

Target:
private static File getOutputFolder( EObject eobj ) { if (commonOutputPath != null) { return commonOutputPath.toFile(); } Path outputPath = StandaloneUMLRTCodeGenerator.getOutputPath(); if (outputPath != null) { File project = outputPath.toFile(); if (project.exists()) { try { FileVisitor<Path> visitor = new RecursiveFileRemover(); Files.walkFileTree( outputPath, visitor ); } catch (IOException e) { CodeGenPlugin.error( "Failed to delete the previously generated project" ); } } if (!project.exists() && !project.mkdirs()) { CodeGenPlugin.error( "Failed to create project" ); return null; } String projectName = project.getName(); String projectPath = project.getParentFile().getPath(); if (!new CppProjectGenerator().generate( projectPath, projectName )) { CodeGenPlugin.error( "Failed to create project" ); return null; } File src = new File( project, "src" ); if (!src.exists() && !src.mkdir()) { CodeGenPlugin.error( "Failed to create source folder" ); return null; } commonOutputPath = src.toPath(); return src; } URI uri = eobj.eResource().getURI(); String projectName = ProjectUtils.getProjectName( eobj ); projectName = projectName + "_CDTProject"; Path elementPath = Paths.get( uri.path() ); Path projectPath = elementPath.getParent().resolveSibling( projectName ); if (!new CppProjectGenerator().generate( projectPath.getParent().toString(), projectName )) { CodeGenPlugin.error( "Failed to create project" ); return null; } File project = projectPath.toFile(); File src = new File( project, "src" ); if (!src.exists() && !src.mkdir()) { CodeGenPlugin.error( "Failed to create source folder" ); return null; } return src; }