Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormspector2007-06-10 12:28:53 -0400
committermspector2007-06-10 12:28:53 -0400
commit595d6990a852b88d35c0baaa2e2f35d498360060 (patch)
treefdeda80645b07c968213c39ccbabf0d847d09a80
parent2eeaacbe33ddb4e8ff5c741c7706e221712061c3 (diff)
downloadorg.eclipse.pdt-V20070611.tar.gz
org.eclipse.pdt-V20070611.tar.xz
org.eclipse.pdt-V20070611.zip
- Revert to usage of FileStoreEditorInputV20070611
- Proper usage of external files in debugger
-rw-r--r--plugins/org.eclipse.php.debug.ui/plugin.xml5
-rw-r--r--plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/PHPDebugUIPlugin.java4
-rw-r--r--plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/PropertyTesters/PHPLaunchPropertyTester.java25
-rw-r--r--plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/breakpoint/provider/PHPBreakpointProvider.java64
-rw-r--r--plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/console/PHPConsoleColorProvider.java9
-rw-r--r--plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/console/PHPFileLink.java25
-rw-r--r--plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/launching/PHPExeLaunchShortcut.java27
-rw-r--r--plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/presentation/PHPModelPresentation.java58
8 files changed, 120 insertions, 97 deletions
diff --git a/plugins/org.eclipse.php.debug.ui/plugin.xml b/plugins/org.eclipse.php.debug.ui/plugin.xml
index 0c72d9c7a..dcd6c6c79 100644
--- a/plugins/org.eclipse.php.debug.ui/plugin.xml
+++ b/plugins/org.eclipse.php.debug.ui/plugin.xml
@@ -127,6 +127,11 @@
adaptableType="org.eclipse.ui.IStorageEditorInput">
<adapter type="org.eclipse.debug.ui.actions.ILaunchable"/>
</factory>
+ <factory
+ class=""
+ adaptableType="org.eclipse.ui.IURIEditorInput">
+ <adapter type="org.eclipse.debug.ui.actions.ILaunchable"/>
+ </factory>
</extension>
<extension
point="org.eclipse.debug.ui.variableValueEditors">
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 001df45c9..fe1600803 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
@@ -447,8 +447,8 @@ public class PHPDebugUIPlugin extends AbstractUIPlugin {
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) {
+ String storageType = allMarkers[i].getAttribute(IPHPConstants.STORAGE_TYPE, "");
+ if (storageType.equals(IPHPConstants.STORAGE_TYPE_EXTERNAL) || storageType.equals(IPHPConstants.STORAGE_TYPE_REMOTE)) {
allMarkers[i].delete();
}
}
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 7679d4b57..bdbd91b8b 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,6 +13,7 @@ package org.eclipse.php.internal.debug.ui.PropertyTesters;
import java.util.List;
import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.core.filesystem.URIUtil;
import org.eclipse.core.internal.resources.ResourceException;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IWorkspaceRoot;
@@ -23,6 +24,7 @@ import org.eclipse.php.internal.core.phpModel.PHPModelUtil;
import org.eclipse.php.internal.core.project.PHPNature;
import org.eclipse.php.internal.core.resources.ExternalFilesRegistry;
import org.eclipse.php.internal.ui.containers.LocalFileStorageEditorInput;
+import org.eclipse.ui.IURIEditorInput;
import org.eclipse.ui.part.FileEditorInput;
/**
@@ -61,15 +63,20 @@ public class PHPLaunchPropertyTester extends PropertyTester {
if (obj instanceof FileEditorInput) {
FileEditorInput editorInput = (FileEditorInput) list.get(0);
file = editorInput.getFile();
- } else if (SCRIPT_ID.equalsIgnoreCase(launchType) && obj instanceof LocalFileStorageEditorInput) {
- // In this case, the editor input is probably an external file.
- // Allow only script run/debug on this kind of file (internal executable launch).
- LocalFileStorageEditorInput editorInput = (LocalFileStorageEditorInput) obj;
- // Try to get it first from the external files registry.
- IPath fullPath = editorInput.getStorage().getFullPath();
- file = ExternalFilesRegistry.getInstance().getFileEntry(fullPath.toString());
- if (file == null) {
- file = ((IWorkspaceRoot) ResourcesPlugin.getWorkspace().getRoot()).getFile(fullPath);
+ } else if (SCRIPT_ID.equalsIgnoreCase(launchType)) {
+ if (obj instanceof LocalFileStorageEditorInput) {
+ // In this case, the editor input is probably an external file.
+ // Allow only script run/debug on this kind of file (internal executable launch).
+ LocalFileStorageEditorInput editorInput = (LocalFileStorageEditorInput) obj;
+ // Try to get it first from the external files registry.
+ IPath fullPath = editorInput.getStorage().getFullPath();
+ file = ExternalFilesRegistry.getInstance().getFileEntry(fullPath.toString());
+ if (file == null) {
+ file = ((IWorkspaceRoot) ResourcesPlugin.getWorkspace().getRoot()).getFile(fullPath);
+ }
+ } else if (obj instanceof IURIEditorInput) {
+ IPath fullPath = URIUtil.toPath(((IURIEditorInput)obj).getURI());
+ file = ExternalFilesRegistry.getInstance().getFileEntry(fullPath.toString());
}
} else if (list.get(0) instanceof IFile) {
file = (IFile) list.get(0);
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 4cce5d5d6..72e4a5ba8 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,7 @@ import java.util.HashMap;
import java.util.Map;
import java.util.regex.Pattern;
+import org.eclipse.core.filesystem.URIUtil;
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.*;
import org.eclipse.debug.core.model.IBreakpoint;
@@ -23,7 +24,6 @@ import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITypedRegion;
import org.eclipse.php.internal.core.containers.LocalFileStorage;
-import org.eclipse.php.internal.core.containers.ZipEntryStorage;
import org.eclipse.php.internal.core.documentModel.partitioner.PHPPartitionTypes;
import org.eclipse.php.internal.core.documentModel.partitioner.PHPStructuredTextPartitioner;
import org.eclipse.php.internal.debug.core.IPHPConstants;
@@ -35,6 +35,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.IURIEditorInput;
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;
@@ -61,52 +62,43 @@ public class PHPBreakpointProvider implements IBreakpointProvider, IExecutableEx
point = PHPDebugTarget.createBreakpoint(res, editorLineNumber);
} catch (BadLocationException e) {
}
- } else if (input instanceof IStorageEditorInput) {
-
- // For non-resources, use the workspace root and a coordinated
- // attribute that is used to
- // prevent unwanted (breakpoint) markers from being loaded
- // into the editors.
- res = ResourcesPlugin.getWorkspace().getRoot();
+ }
+ else if (input instanceof IURIEditorInput) {
+ Map attributes = new HashMap();
+ attributes.put(IPHPConstants.STORAGE_TYPE, IPHPConstants.STORAGE_TYPE_EXTERNAL);
- String id = input.getName();
+ String fileName = RemoteDebugger.convertToSystemIndependentFileName(URIUtil.toPath(((IURIEditorInput)input).getURI()).toString());
+ attributes.put(IPHPConstants.STORAGE_FILE, fileName);
+ attributes.put(StructuredResourceMarkerAnnotationModel.SECONDARY_ID_KEY, fileName);
+ point = PHPDebugTarget.createBreakpoint(res, editorLineNumber, attributes);
+ }
+ else if (input instanceof IStorageEditorInput) {
IStorage storage = ((IStorageEditorInput) input).getStorage();
- if (input instanceof IStorageEditorInput && ((IStorageEditorInput) input).getStorage() != null) {
- id = storage.getFullPath().toString();
- }
Map attributes = new HashMap();
- attributes.put(StructuredResourceMarkerAnnotationModel.SECONDARY_ID_KEY, id);
String fileName = "";
- IProject project = null;
- if (storage instanceof ZipEntryStorage) {
- fileName = RemoteDebugger.convertToSystemIndependentFileName(((ZipEntryStorage) storage).getZipEntry().getName());
- attributes.put(IPHPConstants.Include_Storage_type, IPHPConstants.Include_Storage_zip);
- project = ((ZipEntryStorage) storage).getProject();
- } else if (storage instanceof LocalFileStorage) {
- attributes.put(IPHPConstants.Include_Storage_type, IPHPConstants.Include_Storage_LFile);
+ String secondaryId = storage.getFullPath().toString();
+ attributes.put(StructuredResourceMarkerAnnotationModel.SECONDARY_ID_KEY, secondaryId);
+
+ if (storage instanceof LocalFileStorage) {
+ attributes.put(IPHPConstants.STORAGE_TYPE, IPHPConstants.STORAGE_TYPE_INCLUDE);
+
fileName = RemoteDebugger.convertToSystemIndependentFileName(((LocalFileStorage) storage).getName());
-// String incDir = ((LocalFileStorage) storage).getIncBaseDirName();
-// incDir = RemoteDebugger.convertToSystemIndependentFileName(incDir);
-// if (incDir != null) {
-// fileName = id.substring(incDir.length() + 1);
-// }
- project = ((LocalFileStorage) storage).getProject();
- if (project == null) {
- attributes.put(IPHPConstants.Non_Workspace_Breakpoint, Boolean.TRUE);
- fileName = id;
+ String incDir = ((LocalFileStorage) storage).getIncBaseDirName();
+ incDir = RemoteDebugger.convertToSystemIndependentFileName(incDir);
+ if (incDir != null) {
+ fileName = secondaryId.substring(incDir.length() + 1);
}
+ IProject project = ((LocalFileStorage) storage).getProject();
+ attributes.put(IPHPConstants.STORAGE_PROJECT, project != null ? project.getName() : "");
+ attributes.put(IPHPConstants.STORAGE_INC_BASEDIR, incDir != null ? incDir : "");
} else {
- attributes.put(IPHPConstants.Include_Storage_type, IPHPConstants.Include_Storage_RFile);
+ attributes.put(IPHPConstants.STORAGE_TYPE, IPHPConstants.STORAGE_TYPE_REMOTE);
fileName = storage.getName();
}
- attributes.put(IPHPConstants.Include_Storage, fileName);
- String projectName = "";
- if (project != null)
- projectName = project.getName();
- attributes.put(IPHPConstants.Include_Storage_Project, projectName);
+ attributes.put(IPHPConstants.STORAGE_FILE, fileName);
point = PHPDebugTarget.createBreakpoint(res, editorLineNumber, attributes);
}
}
@@ -126,7 +118,7 @@ public class PHPBreakpointProvider implements IBreakpointProvider, IExecutableEx
private IResource getResourceFromInput(IEditorInput input) {
IResource resource = (IResource) input.getAdapter(IFile.class);
if (resource == null || !resource.exists()) {
- // for no workspace resources - use workspace root for storing breakpoints
+ // for non-workspace resources - use workspace root for storing breakpoints
resource = ResourcesPlugin.getWorkspace().getRoot();
}
return resource;
diff --git a/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/console/PHPConsoleColorProvider.java b/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/console/PHPConsoleColorProvider.java
index cd2e96823..285722475 100644
--- a/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/console/PHPConsoleColorProvider.java
+++ b/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/console/PHPConsoleColorProvider.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.php.internal.debug.ui.console;
+import java.io.File;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
@@ -184,8 +186,13 @@ public class PHPConsoleColorProvider extends ConsoleColorProvider {
fileData = PHPWorkspaceModelManager.getInstance().getModelForFile(fileName);
} catch (Exception e) {
}
- if (file != null) {
+ if (fileData != null) {
fileObject = fileData;
+ } else {
+ File externalFile = new File(fileName);
+ if (externalFile.exists()) {
+ fileObject = externalFile;
+ }
}
}
if (fileObject != null) {
diff --git a/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/console/PHPFileLink.java b/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/console/PHPFileLink.java
index 9fab036de..78e641e52 100644
--- a/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/console/PHPFileLink.java
+++ b/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/console/PHPFileLink.java
@@ -1,21 +1,21 @@
package org.eclipse.php.internal.debug.ui.console;
+import java.io.File;
+
+import org.eclipse.core.internal.filesystem.local.LocalFile;
import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
import org.eclipse.debug.ui.console.FileLink;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.eclipse.php.internal.core.documentModel.DOMModelForPHP;
-import org.eclipse.php.internal.core.phpModel.phpElementData.PHPCodeData;
import org.eclipse.php.internal.core.resources.ExternalFileDecorator;
-import org.eclipse.php.internal.core.resources.ExternalFilesRegistry;
import org.eclipse.php.internal.debug.ui.Logger;
import org.eclipse.php.internal.ui.PHPUiConstants;
import org.eclipse.php.internal.ui.util.EditorUtility;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.console.IHyperlink;
+import org.eclipse.ui.ide.FileStoreEditorInput;
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.wst.sse.ui.StructuredTextEditor;
@@ -58,15 +58,14 @@ public class PHPFileLink implements IHyperlink {
IEditorPart editorPart = null;
DOMModelForPHP domModel = null;
try {
- if (fFile instanceof PHPCodeData) {
- IPath path = Path.fromOSString(((PHPCodeData) fFile).getName());
- if (ExternalFilesRegistry.getInstance().isEntryExist(path.toString())) {
- fFile = ExternalFilesRegistry.getInstance().getFileEntry(path.toString());
- } else {
- fFile = ExternalFileDecorator.createFile(path.toString());
- }
- }
- if (fFile instanceof IFile) {
+ if (fFile instanceof File) {
+ FileStoreEditorInput editorInput = new FileStoreEditorInput(new LocalFile((File)fFile));
+ editorPart = EditorUtility.openInEditor(editorInput, PHPUiConstants.PHP_EDITOR_ID, false);
+ } else if (fFile instanceof ExternalFileDecorator) {
+ ExternalFileDecorator externalFile = (ExternalFileDecorator)fFile;
+ FileStoreEditorInput editorInput = new FileStoreEditorInput(new LocalFile(new File(externalFile.getFullPath().toString())));
+ editorPart = EditorUtility.openInEditor(editorInput, PHPUiConstants.PHP_EDITOR_ID, false);
+ } else if (fFile instanceof IFile) {
editorPart = EditorUtility.openInEditor(new FileEditorInput((IFile) fFile), PHPUiConstants.PHP_EDITOR_ID, false);
} else {
editorPart = EditorUtility.openInEditor(fFile, false);
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 57fe38fa4..5e8adb36c 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,6 +11,7 @@
package org.eclipse.php.internal.debug.ui.launching;
+import org.eclipse.core.filesystem.URIUtil;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ProjectScope;
@@ -44,10 +45,11 @@ import org.eclipse.php.internal.debug.core.preferences.PHPexes;
import org.eclipse.php.internal.debug.ui.Logger;
import org.eclipse.php.internal.debug.ui.PHPDebugUIMessages;
import org.eclipse.php.internal.debug.ui.PHPDebugUIPlugin;
-import org.eclipse.php.internal.ui.containers.LocalFileStorageEditorInput;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IStorageEditorInput;
+import org.eclipse.ui.IURIEditorInput;
import org.eclipse.ui.dialogs.PreferencesUtil;
public class PHPExeLaunchShortcut implements ILaunchShortcut {
@@ -75,12 +77,23 @@ public class PHPExeLaunchShortcut implements ILaunchShortcut {
public void launch(IEditorPart editor, String mode) {
IEditorInput input = editor.getEditorInput();
IFile file = (IFile) input.getAdapter(IFile.class);
- if (file == null && input instanceof LocalFileStorageEditorInput) {
- LocalFileStorageEditorInput editorInput = (LocalFileStorageEditorInput)input;
- LocalFileStorage fileStorage = (LocalFileStorage)editorInput.getStorage();
- if (fileStorage.getProject() == null) {
- // It's probably a launch for a file that is not in the workspace.
- IPath path = fileStorage.getFullPath();
+ if (file == null) {
+ IPath path = null;
+
+ if (input instanceof IStorageEditorInput) {
+ IStorageEditorInput editorInput = (IStorageEditorInput)input;
+ try {
+ LocalFileStorage fileStorage = (LocalFileStorage)editorInput.getStorage();
+ path = fileStorage.getFullPath();
+ } catch (CoreException e) {
+ Logger.logException(e);
+ }
+ } else if (input instanceof IURIEditorInput) {
+ IURIEditorInput editorInput = (IURIEditorInput)input;
+ path = URIUtil.toPath(editorInput.getURI());
+ }
+
+ if (path != null) {
if (ExternalFilesRegistry.getInstance().isEntryExist(path.toString())) {
file = ExternalFilesRegistry.getInstance().getFileEntry(path.toString());
} else {
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 3986060a0..2520faadd 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
@@ -11,11 +11,10 @@
package org.eclipse.php.internal.debug.ui.presentation;
import java.io.File;
-import java.io.IOException;
import java.text.MessageFormat;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
+import org.eclipse.core.filesystem.IFileStore;
+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 +41,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.ide.FileStoreEditorInput;
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.wst.sse.ui.internal.StructuredResourceMarkerAnnotationModel;
@@ -121,7 +121,7 @@ public class PHPModelPresentation extends LabelProvider implements IDebugModelPr
return null;
} else if (resource instanceof IWorkspaceRoot) {
try {
- String filename = (String) marker.getAttribute(IPHPConstants.Include_Storage);
+ String filename = (String) marker.getAttribute(IPHPConstants.STORAGE_FILE);
Integer lineNumber = (Integer) marker.getAttribute(IMarker.LINE_NUMBER);
return filename + " [line: " + lineNumber.toString() + "]";
} catch (CoreException e) {
@@ -224,40 +224,37 @@ public class PHPModelPresentation extends LabelProvider implements IDebugModelPr
PHPLineBreakpoint breakpoint = (PHPLineBreakpoint) element;
IMarker marker = breakpoint.getMarker();
IResource resource = marker.getResource();
+
if (resource instanceof IFile) {
return new FileEditorInput((IFile) resource);
- } else if (resource instanceof IWorkspaceRoot) {
+ }
+ // Breakpoints for external files are stored in workspace root:
+ else if (resource instanceof IWorkspaceRoot) {
try {
- String filename = (String) marker.getAttribute(IPHPConstants.Include_Storage);
- String type = (String) marker.getAttribute(IPHPConstants.Include_Storage_type);
- String id = (String) marker.getAttribute(StructuredResourceMarkerAnnotationModel.SECONDARY_ID_KEY);
- String projectName = (String) marker.getAttribute(IPHPConstants.Include_Storage_Project, "");
- IProject project = PHPDebugUIPlugin.getProject(projectName);
- if (IPHPConstants.Include_Storage_LFile.equals(type)) {
- File file = new File(id);
+ String filename = (String) marker.getAttribute(IPHPConstants.STORAGE_FILE);
+ String type = (String) marker.getAttribute(IPHPConstants.STORAGE_TYPE);
+
+ if (IPHPConstants.STORAGE_TYPE_INCLUDE.equals(type)) {
+ String projectName = (String) marker.getAttribute(IPHPConstants.STORAGE_PROJECT, "");
+ IProject project = PHPDebugUIPlugin.getProject(projectName);
+ String includeBaseDir = (String) marker.getAttribute(IPHPConstants.STORAGE_INC_BASEDIR, "");
+ filename = marker.getAttribute(StructuredResourceMarkerAnnotationModel.SECONDARY_ID_KEY, filename);
+
+ File file = new File(filename);
LocalFileStorage lfs = new LocalFileStorage(file);
- if (marker.getAttribute(IPHPConstants.Non_Workspace_Breakpoint) != Boolean.TRUE) {
- lfs.setProject(project);
- }
+ lfs.setProject(project);
+ lfs.setIncBaseDirName(includeBaseDir);
return new LocalFileStorageEditorInput(lfs);
- } else if (IPHPConstants.Include_Storage_zip.equals(type)) {
- int index = id.lastIndexOf(filename);
- String archive = id.substring(0, index - 1);
- ZipFile zip = new ZipFile(archive);
- ZipEntry entry = new ZipEntry(filename);
- ZipEntryStorage zipStore = new ZipEntryStorage(zip, entry);
- zipStore.setProject(project);
- return new ZipEntryStorageEditorInput(zipStore);
-
+ }
+ else if (IPHPConstants.STORAGE_TYPE_EXTERNAL.equals(type)) {
+ File file = new File(filename);
+ LocalFile store = new LocalFile(file);
+ return new FileStoreEditorInput(store);
}
} catch (CoreException e) {
Logger.logException("Unexpected error in PHPModelPresentation", e);
- } catch (IOException e) {
- Logger.logException("Unexpected error in PHPModelPresentation", e);
}
}
-
- // return new FileEditorInput((IFile) ((ILineBreakpoint) element).getMarker().getResource());
}
if (element instanceof ZipEntryStorage) {
return new ZipEntryStorageEditorInput((ZipEntryStorage) element);
@@ -268,6 +265,9 @@ public class PHPModelPresentation extends LabelProvider implements IDebugModelPr
if (element instanceof PHPSourceNotFoundInput) {
return new PHPSourceNotFoundEditorInput((PHPSourceNotFoundInput) element);
}
+ if (element instanceof IFileStore) {
+ return new FileStoreEditorInput((IFileStore)element);
+ }
Logger.log(Logger.WARNING_DEBUG, "Unknown editor input type: " + element.getClass().getName());
return null;
}
@@ -282,7 +282,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 instanceof LocalFile) {
return "org.eclipse.php.editor"; //$NON-NLS-1$
}
return null;

Back to the top