// Returns the php debug target that is in contex.
// In case that
protected PHPDebugTarget getDebugTarget() {
IAdaptable adaptable = DebugUITools.getDebugContext();
if (adaptable instanceof PHPStackFrame) {
PHPStackFrame stackFrame = (PHPStackFrame) adaptable;
IEditorInput ei = getEditor().getEditorInput();
if (ei instanceof FileEditorInput) {
FileEditorInput fi = (FileEditorInput) ei;
// Check for the file path within the project
String fileInDebug = stackFrame.getSourceName();
String fileInProject = fi.getFile().getProjectRelativePath()
.toString();
if (fileInDebug != null
&& fileInDebug.endsWith('/' + fileInProject)
|| fileInDebug.equals(fileInProject)) {
PHPDebugTarget debugTarget = (PHPDebugTarget) stackFrame
.getDebugTarget();
return debugTarget;
}
} else {
// File on the include Path
PHPDebugTarget debugTarget = (PHPDebugTarget) stackFrame
.getDebugTarget();
return debugTarget;
}
}
return null;