Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsgibly2007-04-16 12:36:18 +0000
committersgibly2007-04-16 12:36:18 +0000
commit8c2fb5e26ae309e963ed6c61a57435c92dd4057a (patch)
tree0ddd9374032faa6a7696eb3a9d19cdef98c5d5aa
parentf541e493247cb8693ca810dd0004bbe8228bac84 (diff)
downloadorg.eclipse.pdt-8c2fb5e26ae309e963ed6c61a57435c92dd4057a.tar.gz
org.eclipse.pdt-8c2fb5e26ae309e963ed6c61a57435c92dd4057a.tar.xz
org.eclipse.pdt-8c2fb5e26ae309e963ed6c61a57435c92dd4057a.zip
Support debugging for files that are not in the workspace.
-rw-r--r--plugins/org.eclipse.php.debug.ui/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.php.debug.ui/plugin.xml4
-rw-r--r--plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/PHPDebugUIPlugin.java95
-rw-r--r--plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/PropertyTesters/PHPLaunchPropertyTester.java17
-rw-r--r--plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/breakpoint/provider/PHPBreakpointProvider.java13
-rw-r--r--plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/launching/ApplicationFileSelectionDialog.java17
-rw-r--r--plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/launching/LaunchUtilities.java14
-rw-r--r--plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/launching/PHPExeLaunchShortcut.java35
-rw-r--r--plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/launching/PHPExecutableLaunchTab.java19
-rw-r--r--plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/presentation/PHPModelPresentation.java13
10 files changed, 197 insertions, 33 deletions
diff --git a/plugins/org.eclipse.php.debug.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.php.debug.ui/META-INF/MANIFEST.MF
index 383e966c3..18819c3d2 100644
--- a/plugins/org.eclipse.php.debug.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.php.debug.ui/META-INF/MANIFEST.MF
@@ -25,7 +25,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.wst.xml.ui,
org.eclipse.php.debug.core,
org.eclipse.php.core,
- org.eclipse.ui.forms
+ org.eclipse.ui.forms,
+ org.eclipse.core.filesystem
Eclipse-LazyStart: true
Export-Package: org.eclipse.php.internal.debug.ui,
org.eclipse.php.internal.debug.ui.PropertyTesters,
diff --git a/plugins/org.eclipse.php.debug.ui/plugin.xml b/plugins/org.eclipse.php.debug.ui/plugin.xml
index 526fee71f..e89d7bba7 100644
--- a/plugins/org.eclipse.php.debug.ui/plugin.xml
+++ b/plugins/org.eclipse.php.debug.ui/plugin.xml
@@ -324,7 +324,9 @@
<contextLabel mode="run" label="%phpexeApplicationShortcut.label"/>
<enablement>
<count value="1"/>
+ <!-- Pass a 'script' argument for the enablement test -->
<test
+ args="script"
property="org.eclipse.php.debug.ui.launchablePHP"
value="true"/>
</enablement>
@@ -333,7 +335,9 @@
<contextLabel mode="debug" label="%phpexeApplicationShortcut.label"/>
<enablement>
<count value="1"/>
+ <!-- Pass a 'script' argument for the enablement test -->
<test
+ args="script"
property="org.eclipse.php.debug.ui.launchablePHP"
value="true"/>
</enablement>
diff --git a/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/PHPDebugUIPlugin.java b/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/PHPDebugUIPlugin.java
index 1740db0ad..a27c02e65 100644
--- a/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/PHPDebugUIPlugin.java
+++ b/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/PHPDebugUIPlugin.java
@@ -13,13 +13,8 @@ package org.eclipse.php.internal.debug.ui;
import java.util.List;
import org.eclipse.core.internal.runtime.AdapterManager;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.debug.core.*;
import org.eclipse.debug.core.model.IThread;
@@ -31,6 +26,10 @@ import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.TreePath;
import org.eclipse.jface.viewers.TreeSelection;
+import org.eclipse.php.internal.core.PHPCoreConstants;
+import org.eclipse.php.internal.core.phpModel.ExternalPHPFilesListener;
+import org.eclipse.php.internal.core.phpModel.ExternalPhpFilesRegistry;
+import org.eclipse.php.internal.debug.core.IPHPConstants;
import org.eclipse.php.internal.debug.core.PHPDebugPlugin;
import org.eclipse.php.internal.debug.core.launching.PHPLaunchUtilities;
import org.eclipse.php.internal.debug.core.model.PHPDebugTarget;
@@ -97,6 +96,9 @@ public class PHPDebugUIPlugin extends AbstractUIPlugin {
list.remove(propertiesFactory);
list.add(0, propertiesFactory);
}
+
+ // Listen to external php files launches.
+ ExternalPhpFilesRegistry.getInstance().addListener(new ExternalFilesLaunchesListener());
}
/**
@@ -371,4 +373,83 @@ public class PHPDebugUIPlugin extends AbstractUIPlugin {
public void launchesRemoved(ILaunch[] launches) {
}
}
+
+ /*
+ * The external files launches listener is responsible of removing launches and markers (bookmarks, breakpoints etc.)
+ * that are related to the removed file / launch.
+ */
+ private static class ExternalFilesLaunchesListener implements ExternalPHPFilesListener {
+
+ private ILaunchConfigurationType configType;
+
+ /*
+ * Contructs a new ExternalFilesLaunchesListener.
+ */
+ public ExternalFilesLaunchesListener() {
+ configType = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(IPHPConstants.PHPEXELaunchType);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.php.internal.core.phpModel.ExternalPHPFilesListener#externalFileAdded(java.lang.String, java.lang.String)
+ */
+ public void externalFileAdded(String iFilePath, String localPath) {
+ // Empty
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.php.internal.core.phpModel.ExternalPHPFilesListener#externalFileRemoved(java.lang.String, java.lang.String)
+ */
+ public void externalFileRemoved(String iFilePath, String localPath) {
+ // Check if there is a launch for this file.
+ try {
+ ILaunchConfiguration[] configs = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurations(configType);
+ int numConfigs = configs == null ? 0 : configs.length;
+ for (int i = 0; i < numConfigs; i++) {
+ String fileName = configs[i].getAttribute(PHPCoreConstants.ATTR_FILE, (String) null);
+ if (localPath.equals(fileName)) {
+ deleteLaunchConfiguration(configs[i]);
+ break;
+ }
+ }
+ } catch (CoreException e) {
+ Logger.logException(e);
+ }
+
+ // Check for any marker that we have of the file and remove it when this file is closed.
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ try {
+ IMarker[] allMarkers = workspace.getRoot().findMarkers(null, true, IResource.DEPTH_INFINITE);
+ for (int i = 0; i < allMarkers.length; i++) {
+ Object nonWorkspaceBreakpoint = allMarkers[i].getAttribute(IPHPConstants.Non_Workspace_Breakpoint);
+ if (nonWorkspaceBreakpoint != null && nonWorkspaceBreakpoint == Boolean.TRUE) {
+ allMarkers[i].delete();
+ }
+ }
+ } catch (CoreException e) {
+ Logger.logException(e);
+ }
+ }
+
+ // Deletes a launch configuration
+ private void deleteLaunchConfiguration(final ILaunchConfiguration launchConfig) throws CoreException {
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ ILaunchConfiguration config = launchConfig;
+ try {
+ if (config instanceof ILaunchConfigurationWorkingCopy) {
+ config = ((ILaunchConfigurationWorkingCopy) config).getOriginal();
+ }
+ if (config != null) {
+ config.delete();
+ }
+ } catch (CoreException ce) {
+ Logger.logException(ce);
+ }
+ }
+ });
+
+ }
+ }
}
diff --git a/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/PropertyTesters/PHPLaunchPropertyTester.java b/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/PropertyTesters/PHPLaunchPropertyTester.java
index 6866174d1..544ff959f 100644
--- a/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/PropertyTesters/PHPLaunchPropertyTester.java
+++ b/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/PropertyTesters/PHPLaunchPropertyTester.java
@@ -13,7 +13,12 @@ package org.eclipse.php.internal.debug.ui.PropertyTesters;
import java.util.List;
import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.core.internal.resources.ResourceException;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.php.internal.core.phpModel.PHPModelUtil;
+import org.eclipse.ui.internal.editors.text.JavaFileEditorInput;
import org.eclipse.ui.part.FileEditorInput;
/**
@@ -24,6 +29,7 @@ import org.eclipse.ui.part.FileEditorInput;
public class PHPLaunchPropertyTester extends PropertyTester {
private static final Object PHP_SOURCE_ID = "org.eclipse.php.core.phpsource";
+ private static final String SCRIPT_ID = "script";
/**
* Executes the property test determined by the parameter <code>property</code>.
@@ -44,16 +50,25 @@ public class PHPLaunchPropertyTester extends PropertyTester {
if (receiver instanceof List) {
List list = (List) receiver;
if (list.size() > 0) {
+ String launchType = args.length > 0 ? args[0].toString() : "";
// Test only the first element
IFile file = null;
- if (list.get(0) instanceof FileEditorInput) {
+ Object obj = list.get(0);
+ if (obj instanceof FileEditorInput) {
FileEditorInput editorInput = (FileEditorInput) list.get(0);
file = editorInput.getFile();
+ } else if (SCRIPT_ID.equalsIgnoreCase(launchType) && obj instanceof JavaFileEditorInput) {
+ // In this case, the editor input is probably an external file.
+ // Allow only script run/debug on this kind of file (internal executable launch).
+ JavaFileEditorInput editorInput = (JavaFileEditorInput) obj;
+ file = ((IWorkspaceRoot) ResourcesPlugin.getWorkspace().getRoot()).getFile(editorInput.getPath());
} else if (list.get(0) instanceof IFile) {
file = (IFile) list.get(0);
}
try {
return file.getContentDescription().getContentType().getId().equals(PHP_SOURCE_ID);
+ } catch (ResourceException re) {
+ return PHPModelUtil.isPhpFile(file);
} catch (Exception e) {
}
}
diff --git a/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/breakpoint/provider/PHPBreakpointProvider.java b/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/breakpoint/provider/PHPBreakpointProvider.java
index d3b8dbd0e..f78a54c2d 100644
--- a/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/breakpoint/provider/PHPBreakpointProvider.java
+++ b/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/breakpoint/provider/PHPBreakpointProvider.java
@@ -15,6 +15,10 @@ import java.util.HashMap;
import java.util.Map;
import java.util.regex.Pattern;
+import org.eclipse.core.internal.resources.File;
+import org.eclipse.core.internal.resources.ResourceException;
+import org.eclipse.core.internal.resources.ResourceInfo;
+import org.eclipse.core.internal.resources.Workspace;
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.*;
import org.eclipse.debug.core.model.IBreakpoint;
@@ -35,6 +39,7 @@ import org.eclipse.php.internal.ui.util.StatusLineMessageTimerManager;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.IStorageEditorInput;
+import org.eclipse.ui.internal.editors.text.JavaFileEditorInput;
import org.eclipse.wst.sse.ui.internal.StructuredResourceMarkerAnnotationModel;
import org.eclipse.wst.sse.ui.internal.provisional.extensions.ISourceEditingTextTools;
import org.eclipse.wst.sse.ui.internal.provisional.extensions.breakpoint.IBreakpointProvider;
@@ -89,6 +94,11 @@ public class PHPBreakpointProvider implements IBreakpointProvider, IExecutableEx
fileName = id.substring(incDir.length() + 1);
}
project = ((LocalFileStorage) storage).getProject();
+ } else if (input instanceof JavaFileEditorInput) {
+ // we have a JavaFileEditorStorage
+ attributes.put(IPHPConstants.Include_Storage_type, IPHPConstants.Include_Storage_LFile);
+ attributes.put(IPHPConstants.Non_Workspace_Breakpoint, Boolean.TRUE);
+ fileName = id;
} else {
attributes.put(IPHPConstants.Include_Storage_type, IPHPConstants.Include_Storage_RFile);
fileName = storage.getName();
@@ -121,6 +131,9 @@ public class PHPBreakpointProvider implements IBreakpointProvider, IExecutableEx
} else {
resource = (IResource) input.getAdapter(IResource.class);
}*/
+// if (resource == null && input instanceof JavaFileEditorInput) {
+// resource = ((IWorkspaceRoot) ResourcesPlugin.getWorkspace().getRoot()).getFile(((JavaFileEditorInput)input).getPath());
+// }
if (resource == null) {
resource = ResourcesPlugin.getWorkspace().getRoot();
}
diff --git a/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/launching/ApplicationFileSelectionDialog.java b/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/launching/ApplicationFileSelectionDialog.java
index 8acccd12c..d5bf056f0 100644
--- a/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/launching/ApplicationFileSelectionDialog.java
+++ b/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/launching/ApplicationFileSelectionDialog.java
@@ -12,6 +12,8 @@ package org.eclipse.php.internal.debug.ui.launching;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
import org.eclipse.ui.model.BaseWorkbenchContentProvider;
@@ -30,8 +32,9 @@ public class ApplicationFileSelectionDialog extends ElementTreeSelectionDialog {
* @param message String
* @parent extensions String[]
* @param allowMultiple boolean
+ * @param allowExternalFiles Allows selection from an external files that are currently opened in the editor
*/
- public ApplicationFileSelectionDialog(Shell parent, ILabelProvider labelProvider, String title, String message, String[] extensions, String[] requiredNatures, boolean allowMultiple) {
+ public ApplicationFileSelectionDialog(Shell parent, ILabelProvider labelProvider, String title, String message, String[] extensions, String[] requiredNatures, boolean allowMultiple, boolean allowExternalFiles) {
super(parent, labelProvider, new BaseWorkbenchContentProvider());
@@ -56,4 +59,16 @@ public class ApplicationFileSelectionDialog extends ElementTreeSelectionDialog {
public void setExtensions(String[] extensions) {
fExtensions = extensions;
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.dialogs.SelectionStatusDialog#createButtonBar(org.eclipse.swt.widgets.Composite)
+ */
+ protected Control createButtonBar(Composite parent) {
+ Control control = super.createButtonBar(parent);
+// Composite
+ // TODO
+ return control;
+ }
+
+
}
diff --git a/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/launching/LaunchUtilities.java b/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/launching/LaunchUtilities.java
index f7437ff71..e171b6505 100644
--- a/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/launching/LaunchUtilities.java
+++ b/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/launching/LaunchUtilities.java
@@ -117,10 +117,20 @@ public class LaunchUtilities {
return text;
}
- public static IResource getFileFromDialog(IProject project, Shell shell, String[] fileExtensions, String[] requiredNatures) {
+ /**
+ * Returns a selected {@link IResource} from a user dialog.
+ *
+ * @param project The project to display
+ * @param shell A Shell
+ * @param fileExtensions The required file extension
+ * @param requiredNatures The required nature
+ * @param allowExternalFiles Allow selection from an external files that are currently opened in the editor
+ * @return A selected IResource
+ */
+ public static IResource getFileFromDialog(IProject project, Shell shell, String[] fileExtensions, String[] requiredNatures, boolean allowExternalFiles) {
LaunchUtilities inst = new LaunchUtilities();
- ApplicationFileSelectionDialog d = new ApplicationFileSelectionDialog(shell, inst.new WebLaunchLabelProvider(), PHPDebugUIMessages.LaunchUtilities_selectFile, PHPDebugUIMessages.LaunchUtilities_selectProjectFile, fileExtensions, requiredNatures, false);
+ ApplicationFileSelectionDialog d = new ApplicationFileSelectionDialog(shell, inst.new WebLaunchLabelProvider(), PHPDebugUIMessages.LaunchUtilities_selectFile, PHPDebugUIMessages.LaunchUtilities_selectProjectFile, fileExtensions, requiredNatures, false, allowExternalFiles);
if (project != null) {
d.setInput(project);
diff --git a/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/launching/PHPExeLaunchShortcut.java b/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/launching/PHPExeLaunchShortcut.java
index 5afd677fd..4caacb754 100644
--- a/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/launching/PHPExeLaunchShortcut.java
+++ b/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/launching/PHPExeLaunchShortcut.java
@@ -11,9 +11,7 @@
package org.eclipse.php.internal.debug.ui.launching;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ProjectScope;
+import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.core.runtime.preferences.DefaultScope;
@@ -31,9 +29,9 @@ import org.eclipse.php.internal.core.PHPCoreConstants;
import org.eclipse.php.internal.core.documentModel.provisional.contenttype.ContentTypeIdForPHP;
import org.eclipse.php.internal.core.phpModel.PHPModelUtil;
import org.eclipse.php.internal.core.phpModel.phpElementData.PHPCodeData;
-import org.eclipse.php.internal.core.util.FileUtils;
import org.eclipse.php.internal.debug.core.IPHPConstants;
import org.eclipse.php.internal.debug.core.PHPDebugPlugin;
+import org.eclipse.php.internal.debug.core.launching.PHPExecutableLaunchDelegate;
import org.eclipse.php.internal.debug.core.preferences.PHPDebugCorePreferenceNames;
import org.eclipse.php.internal.debug.core.preferences.PHPProjectPreferences;
import org.eclipse.php.internal.debug.core.preferences.PHPexeItem;
@@ -44,6 +42,7 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.dialogs.PreferencesUtil;
+import org.eclipse.ui.internal.editors.text.JavaFileEditorInput;
public class PHPExeLaunchShortcut implements ILaunchShortcut {
@@ -59,7 +58,7 @@ public class PHPExeLaunchShortcut implements ILaunchShortcut {
*/
public void launch(ISelection selection, String mode) {
if (selection instanceof IStructuredSelection) {
- searchAndLaunch(((IStructuredSelection) selection).toArray(), mode, getPHPExeLaunchConfigType());
+ searchAndLaunch(((IStructuredSelection) selection).toArray(), mode, getPHPExeLaunchConfigType(), null);
}
}
@@ -70,10 +69,16 @@ public class PHPExeLaunchShortcut implements ILaunchShortcut {
public void launch(IEditorPart editor, String mode) {
IEditorInput input = editor.getEditorInput();
IFile file = (IFile) input.getAdapter(IFile.class);
+ String device = null;
+ if (file == null && input instanceof JavaFileEditorInput) {
+ // It's probably a launch for a file that is not in the workspace.
+ IPath path = ((JavaFileEditorInput) input).getPath();
+ file = ((IWorkspaceRoot) ResourcesPlugin.getWorkspace().getRoot()).getFile(path);
+ device = path.getDevice();
+ }
if (file != null) {
- searchAndLaunch(new Object[] { file }, mode, getPHPExeLaunchConfigType());
+ searchAndLaunch(new Object[] { file }, mode, getPHPExeLaunchConfigType(), device);
}
-
}
protected ILaunchConfigurationType getPHPExeLaunchConfigType() {
@@ -81,7 +86,7 @@ public class PHPExeLaunchShortcut implements ILaunchShortcut {
return lm.getLaunchConfigurationType(IPHPConstants.PHPEXELaunchType);
}
- static public void searchAndLaunch(Object[] search, String mode, ILaunchConfigurationType configType) {
+ public static void searchAndLaunch(Object[] search, String mode, ILaunchConfigurationType configType, String device) {
int entries = search == null ? 0 : search.length;
for (int i = 0; i < entries; i++) {
try {
@@ -99,6 +104,9 @@ public class PHPExeLaunchShortcut implements ILaunchShortcut {
IContentType contentType = Platform.getContentTypeManager().getContentType(ContentTypeIdForPHP.ContentTypeID_PHP);
if (contentType.isAssociatedWith(file.getName())) {
phpPathString = file.getFullPath().toString();
+ if (device != null && !file.exists()) {
+ phpPathString = device + phpPathString;
+ }
}
}
@@ -174,7 +182,7 @@ public class PHPExeLaunchShortcut implements ILaunchShortcut {
*
* @return a re-useable config or <code>null</code> if none
*/
- static protected ILaunchConfiguration findLaunchConfiguration(String phpProject, String phpPathString, String phpExeName, String mode, ILaunchConfigurationType configType) {
+ protected static ILaunchConfiguration findLaunchConfiguration(String phpProject, String phpPathString, String phpExeName, String mode, ILaunchConfigurationType configType) {
ILaunchConfiguration config = null;
try {
@@ -203,13 +211,14 @@ public class PHPExeLaunchShortcut implements ILaunchShortcut {
/**
* Create & return a new configuration
*/
- static protected ILaunchConfiguration createConfiguration(String phpProject, String phpPathString, String phpExeName, ILaunchConfigurationType configType) throws CoreException {
+ protected static ILaunchConfiguration createConfiguration(String phpProject, String phpPathString, String phpExeName, ILaunchConfigurationType configType) throws CoreException {
ILaunchConfiguration config = null;
- if (!FileUtils.fileExists(phpPathString)) {
- return null;
- }
+ // if (!FileUtils.fileExists(phpPathString)) {
+ // return null;
+ // }
ILaunchConfigurationWorkingCopy wc = configType.newInstance(null, DebugPlugin.getDefault().getLaunchManager().generateUniqueLaunchConfigurationNameFrom("New_configuration"));
+ wc.setAttribute(PHPDebugCorePreferenceNames.CONFIGURATION_DELEGATE_CLASS, PHPExecutableLaunchDelegate.class.getName());
wc.setAttribute(PHPCoreConstants.ATTR_FILE, phpPathString);
wc.setAttribute(PHPCoreConstants.ATTR_LOCATION, phpExeName);
wc.setAttribute(IPHPConstants.RUN_WITH_DEBUG_INFO, PHPDebugPlugin.getDebugInfoOption());
diff --git a/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/launching/PHPExecutableLaunchTab.java b/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/launching/PHPExecutableLaunchTab.java
index 93788acdd..799c7b820 100644
--- a/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/launching/PHPExecutableLaunchTab.java
+++ b/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/launching/PHPExecutableLaunchTab.java
@@ -324,11 +324,13 @@ public class PHPExecutableLaunchTab extends AbstractLaunchConfigurationTab {
*/
private void handleVariablesButtonSelected(final Text textField) {
IFile file = null;
- final IResource resource = LaunchUtilities.getFileFromDialog(null, getShell(), LaunchUtil.getFileExtensions(), LaunchUtil.getRequiredNatures());
+ final IResource resource = LaunchUtilities.getFileFromDialog(null, getShell(), LaunchUtil.getFileExtensions(), LaunchUtil.getRequiredNatures(), true);
if (resource instanceof IFile)
file = (IFile) resource;
- if (file != null)
+ if (file != null) {
textField.setText(file.getFullPath().toString());
+ textField.setData(file.getLocation().toString());
+ }
}
/* (non-Javadoc)
@@ -401,10 +403,13 @@ public class PHPExecutableLaunchTab extends AbstractLaunchConfigurationTab {
configuration.setAttribute(PHPCoreConstants.ATTR_LOCATION, location);
String arguments = null;
- if (!enableFileSelection || (arguments = argumentField.getText().trim()).length() == 0)
+ if (!enableFileSelection || (arguments = argumentField.getText().trim()).length() == 0) {
configuration.setAttribute(PHPCoreConstants.ATTR_FILE, (String) null);
- else
+ configuration.setAttribute(PHPCoreConstants.ATTR_FILE_FULL_PATH, (String) null);
+ } else {
configuration.setAttribute(PHPCoreConstants.ATTR_FILE, arguments);
+ configuration.setAttribute(PHPCoreConstants.ATTR_FILE_FULL_PATH, argumentField.getData().toString());
+ }
final boolean debugInfo = enableDebugInfoOption ? runWithDebugInfo.getSelection() : true;
configuration.setAttribute(IPHPConstants.RUN_WITH_DEBUG_INFO, debugInfo);
@@ -481,13 +486,17 @@ public class PHPExecutableLaunchTab extends AbstractLaunchConfigurationTab {
*/
protected void updateArgument(final ILaunchConfiguration configuration) {
String arguments = ""; //$NON-NLS-1$
+ String fullPath = ""; //$NON-NLS-1$
try {
arguments = configuration.getAttribute(PHPCoreConstants.ATTR_FILE, ""); //$NON-NLS-1$
+ fullPath = configuration.getAttribute(PHPCoreConstants.ATTR_FILE_FULL_PATH, ""); //$NON-NLS-1$
} catch (final CoreException ce) {
Logger.log(Logger.ERROR, "Error reading configuration", ce); //$NON-NLS-1$
}
- if (argumentField != null)
+ if (argumentField != null) {
argumentField.setText(arguments);
+ argumentField.setData(fullPath);
+ }
}
/**
diff --git a/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/presentation/PHPModelPresentation.java b/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/presentation/PHPModelPresentation.java
index 901f704e0..777c0cee4 100644
--- a/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/presentation/PHPModelPresentation.java
+++ b/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/presentation/PHPModelPresentation.java
@@ -16,6 +16,7 @@ import java.text.MessageFormat;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
+import org.eclipse.core.internal.filesystem.local.LocalFile;
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.DebugException;
@@ -42,6 +43,7 @@ import org.eclipse.php.internal.ui.containers.ZipEntryStorageEditorInput;
import org.eclipse.php.internal.ui.util.ImageDescriptorRegistry;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.internal.editors.text.JavaFileEditorInput;
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.wst.sse.ui.internal.StructuredResourceMarkerAnnotationModel;
@@ -49,6 +51,8 @@ import org.eclipse.wst.sse.ui.internal.StructuredResourceMarkerAnnotationModel;
* Renders PHP debug elements
*/
public class PHPModelPresentation extends LabelProvider implements IDebugModelPresentation {
+
+ protected static final String JAVA_FILE_STORAGE_CLASS_NAME = ".JavaFileStorage";
private ImageDescriptorRegistry fDebugImageRegistry;
/*
@@ -175,9 +179,9 @@ public class PHPModelPresentation extends LabelProvider implements IDebugModelPr
PHPThread thread = (PHPThread) frame.getThread();
PHPStackFrame topFrame = (PHPStackFrame) thread.getTopStackFrame();
if (topFrame.equals(frame)) {
- frame = topFrame;
+ frame = topFrame;
} // end fix
-
+
StringBuffer buffer = new StringBuffer();
String frameName = frame.getName();
if (frameName != null && frameName.length() > 0) {
@@ -265,6 +269,9 @@ public class PHPModelPresentation extends LabelProvider implements IDebugModelPr
if (element instanceof PHPSourceNotFoundInput) {
return new PHPSourceNotFoundEditorInput((PHPSourceNotFoundInput) element);
}
+ if (element.getClass().getName().endsWith(JAVA_FILE_STORAGE_CLASS_NAME)) {
+ return new JavaFileEditorInput(new LocalFile(((IStorage) element).getFullPath().toFile()));
+ }
return null;
}
@@ -278,7 +285,7 @@ public class PHPModelPresentation extends LabelProvider implements IDebugModelPr
if (input instanceof PHPSourceNotFoundEditorInput) {
return "org.eclipse.php.debug.SourceNotFoundEditor";
}
- if (element instanceof IFile || element instanceof ILineBreakpoint || element instanceof ZipEntryStorage || element instanceof LocalFileStorage) {
+ if (element instanceof IFile || element instanceof ILineBreakpoint || element instanceof ZipEntryStorage || element instanceof LocalFileStorage || element.getClass().getName().endsWith(JAVA_FILE_STORAGE_CLASS_NAME)) {
return "org.eclipse.php.editor"; //$NON-NLS-1$
}
return null;

Back to the top