mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-26 18:35:32 +02:00
Generic parameters and exception logging.
This commit is contained in:
parent
e19da24804
commit
caadfdc7d1
3 changed files with 88 additions and 96 deletions
|
@ -31,7 +31,6 @@ import org.eclipse.debug.core.sourcelookup.containers.AbstractSourceContainer;
|
||||||
* The source container for path mappings.
|
* The source container for path mappings.
|
||||||
*/
|
*/
|
||||||
public class MappingSourceContainer extends AbstractSourceContainer {
|
public class MappingSourceContainer extends AbstractSourceContainer {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unique identifier for the mapping source container type
|
* Unique identifier for the mapping source container type
|
||||||
* (value <code>org.eclipse.cdt.debug.core.containerType.mapping</code>).
|
* (value <code>org.eclipse.cdt.debug.core.containerType.mapping</code>).
|
||||||
|
@ -94,24 +93,20 @@ public class MappingSourceContainer extends AbstractSourceContainer {
|
||||||
for (int j = 0; j < objects.length; j++) {
|
for (int j = 0; j < objects.length; j++) {
|
||||||
results.add(objects[j]);
|
results.add(objects[j]);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (objects.length == 1) {
|
if (objects.length == 1) {
|
||||||
return objects;
|
return objects;
|
||||||
}
|
}
|
||||||
return new Object[]{ objects[0] };
|
return new Object[]{ objects[0] };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} catch (CoreException e) {
|
||||||
catch( CoreException e ) {
|
|
||||||
if (single == null) {
|
if (single == null) {
|
||||||
single = e;
|
single = e;
|
||||||
}
|
} else if (multiStatus == null) {
|
||||||
else if ( multiStatus == null ) {
|
|
||||||
multiStatus = new MultiStatus(DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, new IStatus[]{ single.getStatus() }, SourceLookupMessages.getString("MappingSourceContainer.0"), null); //$NON-NLS-1$
|
multiStatus = new MultiStatus(DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, new IStatus[]{ single.getStatus() }, SourceLookupMessages.getString("MappingSourceContainer.0"), null); //$NON-NLS-1$
|
||||||
multiStatus.add(e.getStatus());
|
multiStatus.add(e.getStatus());
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
multiStatus.add(e.getStatus());
|
multiStatus.add(e.getStatus());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -119,8 +114,7 @@ public class MappingSourceContainer extends AbstractSourceContainer {
|
||||||
if (results == null) {
|
if (results == null) {
|
||||||
if (multiStatus != null) {
|
if (multiStatus != null) {
|
||||||
throw new CoreException(multiStatus);
|
throw new CoreException(multiStatus);
|
||||||
}
|
} else if (single != null) {
|
||||||
else if ( single != null ) {
|
|
||||||
throw single;
|
throw single;
|
||||||
}
|
}
|
||||||
return EMPTY;
|
return EMPTY;
|
||||||
|
@ -197,8 +191,8 @@ public class MappingSourceContainer extends AbstractSourceContainer {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} catch (CoreException e) {
|
||||||
catch( CoreException e ) {
|
CDebugCorePlugin.log(e);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class CSourcePathComputerDelegate implements ISourcePathComputerDelegate
|
||||||
// First, get all the the containers in the global preferences (but add them last)
|
// First, get all the the containers in the global preferences (but add them last)
|
||||||
ISourceContainer[] common = CDebugCorePlugin.getDefault().getCommonSourceLookupDirector().getSourceContainers();
|
ISourceContainer[] common = CDebugCorePlugin.getDefault().getCommonSourceLookupDirector().getSourceContainers();
|
||||||
|
|
||||||
List<ISourceContainer> containers = new ArrayList<ISourceContainer>(common.length + 2);
|
List<ISourceContainer> containers = new ArrayList<ISourceContainer>(common.length + 3);
|
||||||
|
|
||||||
// Add a container that fetches files that are specified with an absolute path
|
// Add a container that fetches files that are specified with an absolute path
|
||||||
containers.add(new AbsolutePathSourceContainer());
|
containers.add(new AbsolutePathSourceContainer());
|
||||||
|
|
|
@ -36,7 +36,6 @@ import com.ibm.icu.text.MessageFormat;
|
||||||
* The source container that maps a backend path to the local filesystem path.
|
* The source container that maps a backend path to the local filesystem path.
|
||||||
*/
|
*/
|
||||||
public class MapEntrySourceContainer extends AbstractSourceContainer {
|
public class MapEntrySourceContainer extends AbstractSourceContainer {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unique identifier for the map entry source container type
|
* Unique identifier for the map entry source container type
|
||||||
* (value <code>org.eclipse.cdt.debug.core.containerType.mapEntry</code>).
|
* (value <code>org.eclipse.cdt.debug.core.containerType.mapEntry</code>).
|
||||||
|
@ -73,7 +72,8 @@ public class MapEntrySourceContainer extends AbstractSourceContainer {
|
||||||
* @return converted string
|
* @return converted string
|
||||||
*/
|
*/
|
||||||
public static IPath createPath(String path) {
|
public static IPath createPath(String path) {
|
||||||
if (path == null) return null;
|
if (path == null)
|
||||||
|
return null;
|
||||||
if (path.contains("\\")) { //$NON-NLS-1$
|
if (path.contains("\\")) { //$NON-NLS-1$
|
||||||
// handle Windows slashes and canonicalize
|
// handle Windows slashes and canonicalize
|
||||||
path = path.replaceAll("\\\\", "/"); //$NON-NLS-1$ //$NON-NLS-2$
|
path = path.replaceAll("\\\\", "/"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
@ -88,8 +88,7 @@ public class MapEntrySourceContainer extends AbstractSourceContainer {
|
||||||
String device = path.substring(0, idx + 1);
|
String device = path.substring(0, idx + 1);
|
||||||
path = path.substring(idx + 1);
|
path = path.substring(idx + 1);
|
||||||
return new Path(path).setDevice(device);
|
return new Path(path).setDevice(device);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// Cygwin or UNC path
|
// Cygwin or UNC path
|
||||||
if (path.startsWith("//")) { //$NON-NLS-1$
|
if (path.startsWith("//")) { //$NON-NLS-1$
|
||||||
String network;
|
String network;
|
||||||
|
@ -119,7 +118,7 @@ public class MapEntrySourceContainer extends AbstractSourceContainer {
|
||||||
path = getLocalPath().append(path);
|
path = getLocalPath().append(path);
|
||||||
|
|
||||||
IFile[] wsFiles = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(path);
|
IFile[] wsFiles = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(path);
|
||||||
ArrayList list = new ArrayList();
|
ArrayList<IFile> list = new ArrayList<IFile>();
|
||||||
for (int j = 0; j < wsFiles.length; ++j) {
|
for (int j = 0; j < wsFiles.length; ++j) {
|
||||||
if (wsFiles[j].exists()) {
|
if (wsFiles[j].exists()) {
|
||||||
list.add(wsFiles[j]);
|
list.add(wsFiles[j]);
|
||||||
|
@ -134,22 +133,21 @@ public class MapEntrySourceContainer extends AbstractSourceContainer {
|
||||||
|
|
||||||
// The file is not already in the workspace so try to create an external translation unit for it.
|
// The file is not already in the workspace so try to create an external translation unit for it.
|
||||||
ISourceLookupDirector director = getDirector();
|
ISourceLookupDirector director = getDirector();
|
||||||
if (director != null && file.exists() && file.isFile() )
|
if (director != null && file.exists() && file.isFile()) {
|
||||||
{
|
|
||||||
ILaunchConfiguration launchConfiguration = director.getLaunchConfiguration();
|
ILaunchConfiguration launchConfiguration = director.getLaunchConfiguration();
|
||||||
if (launchConfiguration != null)
|
if (launchConfiguration != null) {
|
||||||
{
|
|
||||||
String projectName = launchConfiguration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, ""); //$NON-NLS-1$
|
String projectName = launchConfiguration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, ""); //$NON-NLS-1$
|
||||||
if (projectName.length() > 0) {
|
if (projectName.length() > 0) {
|
||||||
ICProject project = CoreModel.getDefault().getCModel().getCProject(projectName);
|
ICProject project = CoreModel.getDefault().getCModel().getCProject(projectName);
|
||||||
if (project != null)
|
if (project != null) {
|
||||||
{
|
|
||||||
String id;
|
String id;
|
||||||
try {
|
try {
|
||||||
final IPath location= Path.fromOSString(file.getCanonicalPath());
|
final IPath location= Path.fromOSString(file.getCanonicalPath());
|
||||||
id = CoreModel.getRegistedContentTypeId(project.getProject(), location.lastSegment());
|
id = CoreModel.getRegistedContentTypeId(project.getProject(), location.lastSegment());
|
||||||
return new ExternalTranslationUnit[] { new ExternalTranslationUnit(project, location, id) };
|
return new ExternalTranslationUnit[] { new ExternalTranslationUnit(project, location, id) };
|
||||||
} catch (IOException e) { e.printStackTrace(); }
|
} catch (IOException e) {
|
||||||
|
CDebugCorePlugin.log(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue