- configuration.setAttribute(
- IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY,
- findWorkingDirectory());
-
- OsgiLaunchHelper.updateLaunchConfiguration(configuration);
- } catch (CoreException e) {
- Shell shell = Display.getCurrent().getActiveShell();
- ErrorDialog.openError(shell, "Error",
- "Cannot execute initalize configuration", e.getStatus());
- }
- }
-
- protected String findWorkingDirectory() {
- try {
- IProject project = propertiesFile.getProject();
- IPath parent = propertiesFile.getProjectRelativePath()
- .removeLastSegments(1);
- IFolder execFolder = project.getFolder(parent.append("exec"));
- if (!execFolder.exists())
- execFolder.create(true, true, null);
- IFolder launchFolder = project.getFolder(execFolder
- .getProjectRelativePath().append(
- extractName(propertiesFile)));
- if (!launchFolder.exists())
- launchFolder.create(true, true, null);
- return "${workspace_loc:"
- + launchFolder.getFullPath().toString().substring(1) + "}";
- } catch (Exception e) {
- e.printStackTrace();
- throw new RuntimeException("Cannot create working directory", e);
- }
- }