final Map<String, ResponseProcessorScript> pathMap = new LinkedHashMap<String, ResponseProcessorScript>();
final List<IResponseProcessingModule> newModules = new ArrayList<IResponseProcessingModule>();
for(IResponseProcessingModule m: currentModules) {
if(m instanceof ResponseProcessorScript) {
ResponseProcessorScript rps = (ResponseProcessorScript) m;
pathMap.put(rps.getModule().getScriptFile().getPath(), rps);
}
}
for(ScriptedModule sm: scriptLoader.getAllModulesByType(ModuleScriptType.RESPONSE_PROCESSOR)) {
String path = sm.getScriptFile().getPath();
if(pathMap.containsKey(path)) {
ResponseProcessorScript old = pathMap.get(path);
newModules.add(new ResponseProcessorScript(sm, old.isEnabled(), old.getRunningTimeProfile()));
} else {
newModules.add(new ResponseProcessorScript(sm));
}
}
return newModules;
}