return launchConfigurationDelegate;
}
private ILaunchConfiguration updatePHPExeAttributes(
ILaunchConfiguration configuration) throws CoreException {
PHPexeItem item = null;
String path = configuration.getAttribute(PHPRuntime.PHP_CONTAINER,
(String) null);
if (path == null) {
IProject project = null;
IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace()
.getRoot();
String projectName = configuration.getAttribute(
IPHPDebugConstants.PHP_Project, (String) null);
if (projectName != null) {
project = workspaceRoot.getProject(projectName);
} else {
String phpScriptString = configuration.getAttribute(
IPHPDebugConstants.ATTR_FILE, (String) null);
IPath filePath = new Path(phpScriptString);
IResource scriptRes = workspaceRoot.findMember(filePath);
if (scriptRes != null) {
project = scriptRes.getProject();
}
}
item = PHPDebugPlugin.getPHPexeItem(project);
} else {
IPath exePath = Path.fromPortableString(path);
PHPVersion version = PHPRuntime.getPHPVersion(exePath);
if (version == null) {
String exeName = exePath.lastSegment();
item = PHPexes.getInstance().getItem(exeName);
} else {
item = PHPDebugPlugin.getPHPexeItem(version);
}
}
if (item != null) {
ILaunchConfigurationWorkingCopy wc = configuration.getWorkingCopy();
wc.setAttribute(IPHPDebugConstants.ATTR_EXECUTABLE_LOCATION, item
.getExecutable().toString());
String debuggerId = item.getDebuggerID();
wc.setAttribute(PHPDebugCorePreferenceNames.PHP_DEBUGGER_ID,
debuggerId);
AbstractDebuggerConfiguration debuggerConfiguration = PHPDebuggersRegistry
.getDebuggerConfiguration(debuggerId);
wc.setAttribute(
PHPDebugCorePreferenceNames.CONFIGURATION_DELEGATE_CLASS,
debuggerConfiguration.getScriptLaunchDelegateClass());
if (item.getINILocation() != null) {
wc.setAttribute(IPHPDebugConstants.ATTR_INI_LOCATION, item
.getINILocation().toString());
} else {
wc.setAttribute(IPHPDebugConstants.ATTR_INI_LOCATION,
(String) null);
}