Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'debug/org.eclipse.cdt.debug.core')
-rw-r--r--debug/org.eclipse.cdt.debug.core/plugin.properties3
-rw-r--r--debug/org.eclipse.cdt.debug.core/plugin.xml5
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/sourcelookup/AbsolutePathSourceContainer.java80
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/sourcelookup/SourceLookupMessages.properties2
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/AbsolutePathSourceContainerType.java29
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceLookupDirector.java7
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceLookupParticipant.java17
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourcePathComputerDelegate.java5
8 files changed, 131 insertions, 17 deletions
diff --git a/debug/org.eclipse.cdt.debug.core/plugin.properties b/debug/org.eclipse.cdt.debug.core/plugin.properties
index 363cd89f932..1fe0ca2488f 100644
--- a/debug/org.eclipse.cdt.debug.core/plugin.properties
+++ b/debug/org.eclipse.cdt.debug.core/plugin.properties
@@ -7,6 +7,7 @@
#
# Contributors:
# QNX Software Systems - Initial API and implementation
+# Nokia - Added support for AbsoluteSourceContainer( 159833 )
###############################################################################
pluginName=C/C++ Development Tools Debug Model
providerName=Eclipse.org
@@ -24,3 +25,5 @@ containerName.mapEntry=Path Map Entry
containerDescription.mapEntry=An entry in a path mapping.
containerName.directory=File System Directory
containerDescription.directory=A directory in the local file system.
+containerName.absolutePath=Absolute File Path
+containerDescription.absolutePath=An absolute path to a file in the local file system.
diff --git a/debug/org.eclipse.cdt.debug.core/plugin.xml b/debug/org.eclipse.cdt.debug.core/plugin.xml
index 90f7a063841..e0c2c26b605 100644
--- a/debug/org.eclipse.cdt.debug.core/plugin.xml
+++ b/debug/org.eclipse.cdt.debug.core/plugin.xml
@@ -158,6 +158,11 @@
description="%containerDescription.directory"
id="org.eclipse.cdt.debug.core.containerType.directory"
name="%containerName.directory"/>
+ <sourceContainerType
+ class="org.eclipse.cdt.debug.internal.core.sourcelookup.AbsolutePathSourceContainerType"
+ description="%containerDescription.absolutePath"
+ id="org.eclipse.cdt.debug.core.containerType.absolutePath"
+ name="%containerName.absolutePath"/>
</extension>
</plugin>
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/sourcelookup/AbsolutePathSourceContainer.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/sourcelookup/AbsolutePathSourceContainer.java
new file mode 100644
index 00000000000..9e74fce12f9
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/sourcelookup/AbsolutePathSourceContainer.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2006 Nokia and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Nokia - Initial implementation (159833)
+ *******************************************************************************/
+
+package org.eclipse.cdt.debug.core.sourcelookup;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.eclipse.cdt.debug.core.CDebugCorePlugin;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.debug.core.sourcelookup.ISourceContainerType;
+import org.eclipse.debug.core.sourcelookup.containers.AbstractSourceContainer;
+import org.eclipse.debug.core.sourcelookup.containers.LocalFileStorage;
+
+public class AbsolutePathSourceContainer extends AbstractSourceContainer {
+ /**
+ * Unique identifier for the absolute source container type
+ * (value <code>org.eclipse.cdt.debug.core.containerType.absolutePath</code>).
+ */
+ public static final String TYPE_ID = CDebugCorePlugin.getUniqueIdentifier() + ".containerType.absolutePath"; //$NON-NLS-1$
+
+ private Object[] findSourceElementByFile( File file ) {
+ IFile[] wfiles = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation( new Path( file.getAbsolutePath() ) );
+ if ( wfiles.length > 0 )
+ return wfiles;
+
+ try {
+ // Check the canonical path as well to support case insensitive file systems like Windows.
+ wfiles = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation( new Path( file.getCanonicalPath() ) );
+ if ( wfiles.length > 0 )
+ return wfiles;
+ } catch (IOException e) { // ignore if getCanonicalPath throws
+ }
+
+ return new LocalFileStorage[] { new LocalFileStorage( file ) };
+ }
+
+ public boolean isValidAbsoluteFilePath( String name )
+ {
+ return isValidAbsoluteFilePath( new File(name) );
+ }
+
+ public boolean isValidAbsoluteFilePath( File file )
+ {
+ return file.isAbsolute() && file.exists() && file.isFile();
+ }
+
+ public Object[] findSourceElements( String name ) throws CoreException {
+ if ( name != null ) {
+ File file = new File( name );
+ if ( isValidAbsoluteFilePath(file) ) {
+ return findSourceElementByFile( file );
+ }
+ }
+ return new Object[0];
+ }
+
+ public String getName() {
+ return SourceLookupMessages.getString( "AbsolutePathSourceContainer.0" );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.core.sourcelookup.ISourceContainer#getType()
+ */
+ public ISourceContainerType getType() {
+ return getSourceContainerType( TYPE_ID );
+ }
+
+}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/sourcelookup/SourceLookupMessages.properties b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/sourcelookup/SourceLookupMessages.properties
index c2c80311beb..2970d38a840 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/sourcelookup/SourceLookupMessages.properties
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/sourcelookup/SourceLookupMessages.properties
@@ -7,5 +7,7 @@
#
# Contributors:
# QNX Software Systems - initial API and implementation
+# Nokia - added support for AbsolutePathSourceContainer
###############################################################################
MappingSourceContainer.0=Source lookup error
+AbsolutePathSourceContainer.0=Absolute File Path
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/AbsolutePathSourceContainerType.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/AbsolutePathSourceContainerType.java
new file mode 100644
index 00000000000..74c2115c8ec
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/AbsolutePathSourceContainerType.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2006 Nokia and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Nokia - Initial implementation (159833)
+ *******************************************************************************/
+
+package org.eclipse.cdt.debug.internal.core.sourcelookup;
+
+import org.eclipse.cdt.debug.core.sourcelookup.AbsolutePathSourceContainer;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.sourcelookup.ISourceContainer;
+import org.eclipse.debug.core.sourcelookup.containers.AbstractSourceContainerTypeDelegate;
+
+public class AbsolutePathSourceContainerType extends AbstractSourceContainerTypeDelegate {
+
+ public ISourceContainer createSourceContainer(String memento) throws CoreException {
+ return new AbsolutePathSourceContainer();
+ }
+
+ public String getMemento(ISourceContainer container) throws CoreException {
+ return "";
+ }
+
+}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceLookupDirector.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceLookupDirector.java
index c98f0309649..87b58649e9d 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceLookupDirector.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceLookupDirector.java
@@ -7,13 +7,15 @@
*
* Contributors:
* QNX Software Systems - Initial API and implementation
- *******************************************************************************/
+ * Nokia - Added support for AbsoluteSourceContainer( 159833 )
+*******************************************************************************/
package org.eclipse.cdt.debug.internal.core.sourcelookup;
import java.io.File;
import java.util.HashSet;
import java.util.Set;
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
+import org.eclipse.cdt.debug.core.sourcelookup.AbsolutePathSourceContainer;
import org.eclipse.cdt.debug.core.sourcelookup.MappingSourceContainer;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
@@ -151,6 +153,9 @@ public class CSourceLookupDirector extends AbstractSourceLookupDirector {
if ( container instanceof MappingSourceContainer ) {
return ( ((MappingSourceContainer)container).getCompilationPath( sourceName ) != null );
}
+ if ( container instanceof AbsolutePathSourceContainer ) {
+ return ( ((AbsolutePathSourceContainer)container).isValidAbsoluteFilePath( sourceName ) );
+ }
try {
ISourceContainer[] containers;
containers = container.getSourceContainers();
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceLookupParticipant.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceLookupParticipant.java
index 99093e2d688..acde0284b1e 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceLookupParticipant.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceLookupParticipant.java
@@ -7,7 +7,8 @@
*
* Contributors:
* QNX Software Systems - Initial API and implementation
- *******************************************************************************/
+ * Nokia - Added support for AbsoluteSourceContainer( 159833 )
+*******************************************************************************/
package org.eclipse.cdt.debug.internal.core.sourcelookup;
import java.io.File;
@@ -77,23 +78,9 @@ public class CSourceLookupParticipant extends AbstractSourceLookupParticipant {
else if ( object instanceof String ) {
name = (String)object;
}
- // Workaround. See bug #91808.
- if ( name != null ) {
- File file = new File( name );
- if ( file.isAbsolute() && file.exists() ) {
- return findSourceElementByFile( file );
- }
- }
return super.findSourceElements( object );
}
- private Object[] findSourceElementByFile( File file ) {
- IFile[] wfiles = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation( new Path( file.getPath() ) );
- if ( wfiles.length > 0 )
- return wfiles;
- return new LocalFileStorage[] { new LocalFileStorage( file ) };
- }
-
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.AbstractSourceLookupParticipant#dispose()
*/
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourcePathComputerDelegate.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourcePathComputerDelegate.java
index 61f5c0914b4..4754d9d91dc 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourcePathComputerDelegate.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourcePathComputerDelegate.java
@@ -7,12 +7,14 @@
*
* Contributors:
* QNX Software Systems - Initial API and implementation
- *******************************************************************************/
+ * Nokia - Added support for AbsoluteSourceContainer( 159833 )
+*******************************************************************************/
package org.eclipse.cdt.debug.internal.core.sourcelookup;
import java.util.ArrayList;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
+import org.eclipse.cdt.debug.core.sourcelookup.AbsolutePathSourceContainer;
import org.eclipse.cdt.debug.core.sourcelookup.MappingSourceContainer;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
@@ -54,6 +56,7 @@ public class CSourcePathComputerDelegate implements ISourcePathComputerDelegate
containers.add( 0, new ProjectSourceContainer( project, true ) );
}
}
+ containers.add( new AbsolutePathSourceContainer() );
return (ISourceContainer[])containers.toArray( new ISourceContainer[containers.size()] );
}
}

Back to the top