http://phpeclipse.de/tiki-view_forum_thread.php?forumId=3&comments_parentId=1432
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketTimeoutException;
+import java.util.Map;
import net.sourceforge.phpdt.internal.debug.core.breakpoints.PHPLineBreakpoint;
import net.sourceforge.phpdt.internal.debug.core.logview.LogView;
private boolean remote;
+ private boolean pathtranslation;
+
+ private Map pathmap;
+
private IPath remoteSourcePath;
public PHPDBGProxy() {
thisProxy = this;
}
- public PHPDBGProxy(boolean remote, String remoteSourcePath) {
+ public PHPDBGProxy(boolean remote, String remoteSourcePath,boolean pathTranslate,Map paths) {
thisProxy = this;
this.remote = remote;
this.remoteSourcePath = new Path(remoteSourcePath);
+ this.pathmap=paths;
+ this.pathtranslation=pathTranslate;
}
public void start() {
}
}
+ private String MapPath(PHPLineBreakpoint phpLBP)
+ {
+ IPath filename;
+ if (remote)
+ {
+ filename = phpLBP.getMarker().getResource().getProjectRelativePath();
+ filename = remoteSourcePath.append(filename);
+ }
+ else
+ filename = phpLBP.getMarker().getResource().getLocation();
+ String path=filename.toOSString();
+ if(pathmap!=null)
+ {
+ java.util.Iterator i=pathmap.keySet().iterator();
+ while(i.hasNext())
+ {
+ String k=(String)i.next();
+ if(path.substring(0,k.length()).equals(k))
+ {
+ path=pathmap.get(k)+path.substring(k.length());
+ break;
+ }
+ }
+ }
+ if(pathtranslation)
+ {
+ if(path.substring(0,1).equals("/"))
+ path=path.replace('\\','/');
+ else
+ path=path.replace('/','\\');
+ }
+ return path;
+ }
+
public void addBreakpoint(IBreakpoint breakpoint) {
if (DBGInt == null)
return;
try {
PHPLineBreakpoint phpLBP;
if (breakpoint.getModelIdentifier() == PHPDebugCorePlugin.getUniqueIdentifier()) {
- IPath filename;
phpLBP = (PHPLineBreakpoint) breakpoint;
// bpNo= DBGInt.addBreakpoint(phpLBP.getMarker().getResource().getLocation().toOSString(), phpLBP.getLineNumber());
- if (remote)
- filename = remoteSourcePath.append(phpLBP.getMarker().getResource().getProjectRelativePath());
- else
- filename = phpLBP.getMarker().getResource().getLocation();
- bpNo = DBGInt.addBreakpoint(filename.toOSString(), phpLBP.getLineNumber());
+
+ bpNo = DBGInt.addBreakpoint(MapPath(phpLBP), phpLBP.getLineNumber());
phpLBP.setDBGBpNo(bpNo);
}
} catch (IOException e) {
PHPLineBreakpoint phpLBP;
if (breakpoint.getModelIdentifier() == PHPDebugCorePlugin.getUniqueIdentifier()) {
phpLBP = (PHPLineBreakpoint) breakpoint;
- IPath filename;
- if (remote)
- filename = remoteSourcePath.append(phpLBP.getMarker().getResource().getProjectRelativePath());
- else
- filename = phpLBP.getMarker().getResource().getLocation();
+
// bpNo= DBGInt.addBreakpoint(filename.toOSString(), phpLBP.getLineNumber());
- DBGInt.removeBreakpoint(filename.toOSString(), phpLBP.getLineNumber(), phpLBP.getDBGBpNo());
+ DBGInt.removeBreakpoint(MapPath(phpLBP), phpLBP.getLineNumber(), phpLBP.getDBGBpNo());
}
} catch (IOException e) {
PHPDebugCorePlugin.log(e);
LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.label=Remote &Debug
LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.RemoteCheckBox.label=Remote &Debug
+LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.RemoteTranslate.label=Cross Plattform debugging
LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.RemoteSourcePath.label=Remote &Sourcepath:
LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.OpenDBGSessionInBrowserCheckBox.label=Open with DBGSession URL in internal Browser
LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMap.label=Mapped Path:
// protected Button loadPathDefaultButton;
protected Button fRemoteDebugCheckBox;
+ protected Button fRemoteDebugTranslate;
protected Button fOpenDBGSessionInBrowserCheckBox;
handlePathMapRemoveButtonSelected();
} else if (source == fRemoteDebugCheckBox) {
setRemoteTabEnableState();
+ } else if (source == fRemoteDebugTranslate) {
+ setRemoteTabEnableState();
} else {
updateLaunchConfigurationDialog();
;
private static final boolean DEFAULT_REMOTE_DEBUG = false;
+ private static final boolean DEFAULT_REMOTE_DEBUG_TRANSLATE = false;
+
private static final boolean DEFAULT_OPEN_DBGSESSION_IN_BROWSER = true;
static String[] columnTitles = {
fRemoteDebugCheckBox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
fRemoteDebugCheckBox.addSelectionListener(fListener);
+ fRemoteDebugTranslate = new Button(comp, SWT.CHECK);
+ fRemoteDebugTranslate.setText(PHPDebugUiMessages
+ .getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.RemoteTranslate.label"));
+ fRemoteDebugTranslate.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
+ fRemoteDebugTranslate.addSelectionListener(fListener);
+
fOpenDBGSessionInBrowserCheckBox = new Button(comp, SWT.CHECK);
fOpenDBGSessionInBrowserCheckBox.setText(PHPDebugUiMessages
.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.OpenDBGSessionInBrowserCheckBox.label"));
private void setRemoteTabEnableState() {
boolean state = fRemoteDebugCheckBox.getSelection();
fRemoteSourcePath.setEnabled(state);
-
+ fRemoteDebugTranslate.setEnabled(state);
+
fRemoteDebugPathMapTable.setEnabled(state);
if (!state) {
fPathMapEditButton.setEnabled(false);
//
if (fRemoteDebugCheckBox.getSelection()) {
fOpenDBGSessionInBrowserCheckBox.setEnabled(true);
+ fRemoteDebugTranslate.setEnabled(true);
int selectCount = this.fRemoteDebugPathMapTable.getSelectionIndices().length;
if (selectCount < 1) {
fPathMapEditButton.setEnabled(false);
fRemoteDebugCheckBox.setSelection(DEFAULT_REMOTE_DEBUG);
}
try {
+ fRemoteDebugTranslate.setSelection(configuration.getAttribute(
+ PHPLaunchConfigurationAttribute.REMOTE_DEBUG_TRANSLATE, DEFAULT_REMOTE_DEBUG_TRANSLATE));
+ } catch (CoreException ce) {
+ fRemoteDebugTranslate.setSelection(DEFAULT_REMOTE_DEBUG_TRANSLATE);
+ }
+ try {
fOpenDBGSessionInBrowserCheckBox.setSelection(configuration.getAttribute(
PHPLaunchConfigurationAttribute.OPEN_DBGSESSION_IN_BROWSER, DEFAULT_OPEN_DBGSESSION_IN_BROWSER));
} catch (CoreException ce) {
// }
configuration.setAttribute(PHPLaunchConfigurationAttribute.REMOTE_DEBUG, fRemoteDebugCheckBox.getSelection());
+ configuration.setAttribute(PHPLaunchConfigurationAttribute.REMOTE_DEBUG_TRANSLATE, fRemoteDebugTranslate.getSelection());
configuration.setAttribute(PHPLaunchConfigurationAttribute.FILE_MAP, getMapFromPathMapTable());
configuration.setAttribute(PHPLaunchConfigurationAttribute.REMOTE_PATH, fRemoteSourcePath.getText());
configuration.setAttribute(PHPLaunchConfigurationAttribute.OPEN_DBGSESSION_IN_BROWSER, fOpenDBGSessionInBrowserCheckBox
public IProcess run(InterpreterRunnerConfiguration configuration, ILaunch launch) {
String[] env;
String name, value;
- PHPDBGProxy newPHPDBGProxy = new PHPDBGProxy(configuration.useRemoteDebugger(), configuration.getRemoteSourcePath());
+ PHPDBGProxy newPHPDBGProxy = new PHPDBGProxy(configuration.useRemoteDebugger(), configuration.getRemoteSourcePath(),
+ configuration.usePathTranslation(),configuration.getPathMap());
int pos;
IProcess process = null;
return false;
}
+ public boolean usePathTranslation() {
+ try {
+ return configuration.getAttribute(PHPLaunchConfigurationAttribute.REMOTE_DEBUG_TRANSLATE, false);
+ } catch(CoreException e) {
+ PHPLaunchingPlugin.log(e);
+ }
+ return false;
+ }
+
+ public Map getPathMap() {
+ try {
+ return configuration.getAttribute(PHPLaunchConfigurationAttribute.FILE_MAP, (Map) null);
+ } catch(CoreException e) {
+ PHPLaunchingPlugin.log(e);
+ }
+ return (Map) null;
+ }
+
public boolean useDBGSessionInBrowser() {
try {
return configuration.getAttribute(PHPLaunchConfigurationAttribute.OPEN_DBGSESSION_IN_BROWSER, true);
public String getRemoteSourcePath() {
IProject project = getProject().getProject();
- if (useRemoteDebugger())
+ if (!useRemoteDebugger())
return project.getLocation().toOSString();
else
{
// static final String USE_DEFAULT_LOAD_PATH = PHPLaunchingPlugin.PLUGIN_ID + ".USE_DEFAULT_LOAD_PATH";
static final String USE_DEFAULT_WORKING_DIRECTORY = PHPLaunchingPlugin.PLUGIN_ID + ".USE_DEFAULT_WORKING_DIRECTORY";
static final String REMOTE_DEBUG = PHPLaunchingPlugin.PLUGIN_ID + ".REMOTE_DEBUG";
+ static final String REMOTE_DEBUG_TRANSLATE = PHPLaunchingPlugin.PLUGIN_ID + ".REMOTE_DEBUG_TRANSLATE";
static final String REMOTE_PATH = PHPLaunchingPlugin.PLUGIN_ID + ".REMOTE_PATH";
static final String OPEN_DBGSESSION_IN_BROWSER = PHPLaunchingPlugin.PLUGIN_ID + ".OPEN_DBGSESSION_IN_BROWSER";
static final String FILE_MAP = PHPLaunchingPlugin.PLUGIN_ID + ".FILE_MAP";