* Customize launch configuration for setting grinder.properties attributes.
*/
@Override
public ILaunchConfiguration createDefaultLaunchConfiguration(FileOrResource[] resource) {
ILaunchConfiguration conf = super.createDefaultLaunchConfiguration(resource);
if (!propertiesShouldBeSetManually) {
FileOrResource fileOrResource = resource[0];
if (fileOrResource.resource == null) {
reportError("The grinder.properties cannot be set for a run. "
+ "Project cannot be located.", null);
}
String projName = fileOrResource.resource.getProject().getName();
IStringVariableManager varManager = VariablesPlugin.getDefault()
.getStringVariableManager();
String location = varManager.generateVariableExpression(GrinderConstants.WORKSPACE_LOC,
projName + File.separator
+ GrinderConstants.GRINDER_PROPERTIES_FILE_NAME);
try {
ILaunchConfigurationWorkingCopy workingCopy = conf.copy(conf.getName());
workingCopy.setAttribute(GrinderConstants.ATTR_GRINDER_PROPERTIES_LOCATION,
location);
conf.delete();
conf = workingCopy.doSave();
} catch (CoreException e) {
reportError("The grinder.properties cannot be set for a run.", e);
}
}