package net.sourceforge.phpdt.internal.debug.ui;
+import java.util.Map;
+
import net.sourceforge.phpdt.internal.debug.core.model.PHPStackFrame;
import net.sourceforge.phpdt.internal.launching.PHPLaunchConfigurationAttribute;
import net.sourceforge.phpeclipse.PHPeclipsePlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
+import org.eclipse.core.boot.BootLoader;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.model.IPersistableSourceLocator;
import org.eclipse.debug.core.model.IStackFrame;
import org.eclipse.debug.ui.ISourcePresentation;
-import org.eclipse.ui.IEditorDescriptor;
+//import org.eclipse.ui.IEditorDescriptor;
import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorRegistry;
+//import org.eclipse.ui.IEditorRegistry;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
public class PHPSourceLocator implements IPersistableSourceLocator, ISourcePresentation {
private String absoluteWorkingDirectory;
+ private Map fileMap = null;
+ private boolean remoteDebug;
+ private IPath remotePath;
+ private String projectName;
public PHPSourceLocator() {
*/
public void initializeDefaults(ILaunchConfiguration configuration) throws CoreException {
this.absoluteWorkingDirectory = configuration.getAttribute(PHPLaunchConfigurationAttribute.WORKING_DIRECTORY, "");
+ this.remoteDebug=configuration.getAttribute(PHPLaunchConfigurationAttribute.REMOTE_DEBUG,false);
+ this.fileMap = configuration.getAttribute(PHPLaunchConfigurationAttribute.FILE_MAP, (Map)null);
+ this.projectName =configuration.getAttribute(PHPLaunchConfigurationAttribute.PROJECT_NAME, "");
+
+ if (BootLoader.getOS().equals(BootLoader.OS_WIN32))
+ this.remotePath= new Path((configuration.getAttribute(PHPLaunchConfigurationAttribute.REMOTE_PATH, "")).toLowerCase());
+ else
+ this.remotePath= new Path(configuration.getAttribute(PHPLaunchConfigurationAttribute.REMOTE_PATH, ""));
+
+// system.os.name
+
}
/**
* @see org.eclipse.debug.core.model.ISourceLocator#getSourceElement(IStackFrame)
*/
public Object getSourceElement(IStackFrame stackFrame) {
- return ((PHPStackFrame) stackFrame).getFileName();
+
+ String key=((PHPStackFrame) stackFrame).getFileName();
+
+
+ String file="";
+
+ if (remoteDebug)
+ {
+ IPath path = new Path(key);
+ if (remotePath.isPrefixOf(path))
+ {
+ IPath projectPath;
+ path=path.removeFirstSegments(remotePath.matchingFirstSegments(path));
+ file=path.toString();
+ projectPath=(PHPeclipsePlugin.getWorkspace().getRoot().getProject(projectName).getLocation());
+ file=(projectPath.append(path)).toString();
+ }
+// file=(String)(fileMap.get(key));
+ } else
+ {
+ file=key;
+ }
+
+ return file;
}
/**
IWorkbenchWindow window = workbench.getWorkbenchWindows()[0];
IWorkbenchPage page = window.getActivePage();
IPath path = new Path(filename);
+
+
// If the file exists in the workspace, open it
IFile eclipseFile = PHPeclipsePlugin.getWorkspace().getRoot().getFileForLocation(path);