mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 14:12:10 +02:00
Bug 484900: Cleanup of CSourceLookupDirector post CDI removal
CSourceLookupDirector is internal and had a number of methods only referenced from CDI. Change-Id: Ia3052ee5f7009f68984e7b02e7785d76c2c15b0d Signed-off-by: Jonah Graham <jonah@kichwacoders.com>
This commit is contained in:
parent
6283890715
commit
a29e37cffc
1 changed files with 0 additions and 135 deletions
|
@ -13,34 +13,20 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.debug.internal.core.sourcelookup;
|
package org.eclipse.cdt.debug.internal.core.sourcelookup;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
|
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
|
||||||
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
|
|
||||||
import org.eclipse.cdt.debug.core.sourcelookup.AbsolutePathSourceContainer;
|
|
||||||
import org.eclipse.cdt.debug.core.sourcelookup.CProjectSourceContainer;
|
|
||||||
import org.eclipse.cdt.debug.core.sourcelookup.IMappingSourceContainer;
|
|
||||||
import org.eclipse.cdt.debug.core.sourcelookup.ProgramRelativePathSourceContainer;
|
|
||||||
import org.eclipse.core.resources.IContainer;
|
|
||||||
import org.eclipse.core.resources.IFile;
|
|
||||||
import org.eclipse.core.resources.IProject;
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
|
||||||
import org.eclipse.core.runtime.IConfigurationElement;
|
import org.eclipse.core.runtime.IConfigurationElement;
|
||||||
import org.eclipse.core.runtime.IExtension;
|
import org.eclipse.core.runtime.IExtension;
|
||||||
import org.eclipse.core.runtime.IExtensionPoint;
|
import org.eclipse.core.runtime.IExtensionPoint;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.Path;
|
|
||||||
import org.eclipse.core.runtime.Platform;
|
import org.eclipse.core.runtime.Platform;
|
||||||
import org.eclipse.debug.core.ILaunchManager;
|
import org.eclipse.debug.core.ILaunchManager;
|
||||||
import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector;
|
import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector;
|
||||||
import org.eclipse.debug.core.sourcelookup.ISourceContainer;
|
import org.eclipse.debug.core.sourcelookup.ISourceContainer;
|
||||||
import org.eclipse.debug.core.sourcelookup.ISourceContainerType;
|
import org.eclipse.debug.core.sourcelookup.ISourceContainerType;
|
||||||
import org.eclipse.debug.core.sourcelookup.ISourceLookupParticipant;
|
import org.eclipse.debug.core.sourcelookup.ISourceLookupParticipant;
|
||||||
import org.eclipse.debug.core.sourcelookup.containers.DirectorySourceContainer;
|
|
||||||
import org.eclipse.debug.core.sourcelookup.containers.FolderSourceContainer;
|
|
||||||
import org.eclipse.debug.core.sourcelookup.containers.ProjectSourceContainer;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* C/C++ source lookup director.
|
* C/C++ source lookup director.
|
||||||
|
@ -71,127 +57,6 @@ public class CSourceLookupDirector extends AbstractSourceLookupDirector {
|
||||||
return fSupportedTypes.contains(type.getId());
|
return fSupportedTypes.contains(type.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Only used by CDI, scheduled for removal as part of Bug 484900
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public boolean contains(String source) {
|
|
||||||
for (ISourceContainer cont : getSourceContainers()) {
|
|
||||||
if (contains(cont, source))
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Only used by CDI, scheduled for removal as part of Bug 484900
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public boolean contains(ICBreakpoint breakpoint) {
|
|
||||||
try {
|
|
||||||
String handle = breakpoint.getSourceHandle();
|
|
||||||
for (ISourceContainer cont : getSourceContainers()) {
|
|
||||||
if (contains(cont, handle))
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} catch (CoreException e) {
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Only used by CDI, scheduled for removal as part of Bug 484900
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public boolean contains(IProject project) {
|
|
||||||
for (ISourceContainer cont : getSourceContainers()) {
|
|
||||||
if (contains(cont, project))
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Only used by CDI, scheduled for removal as part of Bug 484900
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
private boolean contains(ISourceContainer container, IProject project) {
|
|
||||||
if (container instanceof CProjectSourceContainer && project.equals(((CProjectSourceContainer) container).getProject())) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (container instanceof ProjectSourceContainer && project.equals(((ProjectSourceContainer) container).getProject())) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
for (ISourceContainer cont : container.getSourceContainers()) {
|
|
||||||
if (contains(cont, project))
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} catch (CoreException e) {
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Only used by CDI, scheduled for removal as part of Bug 484900
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
private boolean contains(ISourceContainer container, String sourceName) {
|
|
||||||
IPath path = new Path(sourceName);
|
|
||||||
if (!path.isValidPath(sourceName))
|
|
||||||
return false;
|
|
||||||
if (container instanceof IMappingSourceContainer) {
|
|
||||||
return ((IMappingSourceContainer) container).getCompilationPath(sourceName) != null;
|
|
||||||
}
|
|
||||||
if (container instanceof CProjectSourceContainer) {
|
|
||||||
IProject project = ((CProjectSourceContainer) container).getProject();
|
|
||||||
if (project != null) {
|
|
||||||
IPath projPath = project.getLocation();
|
|
||||||
if (projPath != null && projPath.isPrefixOf(path)) {
|
|
||||||
IFile file = ((CProjectSourceContainer) container).getProject().getFile(path.removeFirstSegments(projPath.segmentCount()));
|
|
||||||
return file != null && file.exists();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (container instanceof ProjectSourceContainer) {
|
|
||||||
IProject project = ((ProjectSourceContainer) container).getProject();
|
|
||||||
IPath projPath = project.getLocation();
|
|
||||||
if (projPath != null && projPath.isPrefixOf(path)) {
|
|
||||||
IFile file = ((ProjectSourceContainer) container).getProject().getFile(path.removeFirstSegments(projPath.segmentCount()));
|
|
||||||
return file != null && file.exists();
|
|
||||||
}
|
|
||||||
} else if (container instanceof FolderSourceContainer) {
|
|
||||||
IContainer folder = ((FolderSourceContainer) container).getContainer();
|
|
||||||
IPath folderPath = folder.getLocation();
|
|
||||||
if (folderPath != null && folderPath.isPrefixOf(path)) {
|
|
||||||
IFile file = ((FolderSourceContainer) container).getContainer().getFile(path.removeFirstSegments(folderPath.segmentCount()));
|
|
||||||
return file != null && file.exists();
|
|
||||||
}
|
|
||||||
} else if (container instanceof DirectorySourceContainer) {
|
|
||||||
File dir = ((DirectorySourceContainer) container).getDirectory();
|
|
||||||
boolean searchSubfolders = ((DirectorySourceContainer) container).isComposite();
|
|
||||||
IPath dirPath = new Path(dir.getAbsolutePath());
|
|
||||||
if (searchSubfolders || dirPath.segmentCount() + 1 == path.segmentCount())
|
|
||||||
return dirPath.isPrefixOf(path);
|
|
||||||
} else if (container instanceof AbsolutePathSourceContainer) {
|
|
||||||
return ((AbsolutePathSourceContainer) container).isValidAbsoluteFilePath(sourceName);
|
|
||||||
} else if (container instanceof ProgramRelativePathSourceContainer) {
|
|
||||||
try {
|
|
||||||
Object[] elements = ((ProgramRelativePathSourceContainer) container).findSourceElements(sourceName);
|
|
||||||
return elements.length > 0;
|
|
||||||
} catch (CoreException e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
for (ISourceContainer cont : container.getSourceContainers()) {
|
|
||||||
if (contains(cont, sourceName))
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} catch (CoreException e) {
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Translate a local file name to a name understood by the backend.
|
* Translate a local file name to a name understood by the backend.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue