1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 09:25:31 +02:00

Bug 247948 - Wrong source shown on hit breakpoint - remove FIXME code, and don't force find duplicates.

This commit is contained in:
James Blackburn 2010-01-11 23:02:52 +00:00
parent c341b5b329
commit 802f7279ba

View file

@ -26,16 +26,10 @@ import org.eclipse.cdt.debug.internal.core.ListenerList;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.core.model.IDebugElement;
import org.eclipse.debug.core.model.IStackFrame;
import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupParticipant;
import org.eclipse.debug.core.sourcelookup.ISourceContainer;
import org.eclipse.debug.core.sourcelookup.ISourceContainerType;
import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector;
import org.eclipse.debug.core.sourcelookup.ISourceLookupParticipant;
import org.eclipse.debug.core.sourcelookup.ISourcePathComputer;
/**
* A source lookup participant that searches for C/C++ source code.
@ -80,10 +74,6 @@ public class CSourceLookupParticipant extends AbstractSourceLookupParticipant {
@Override
public Object[] findSourceElements( Object object ) throws CoreException {
// Workaround for BUG247977
// FIXME: Remove having switched to 3.5 platform
initContainersSourceDirector();
// Workaround for cases when the stack frame doesn't contain the source file name
String name = null;
IBreakpoint breakpoint = null;
@ -140,23 +130,9 @@ public class CSourceLookupParticipant extends AbstractSourceLookupParticipant {
}
}
// FIXME: remove when BUG247977 is fixed
endContainersSourceDirector();
return foundElements;
}
/**
* Override default. We want all the source elements we can get from the source containers
* so we can select the 'correct' element on the user's behalf.
* {@link https://bugs.eclipse.org/bugs/show_bug.cgi?id=247948}
* @see CSourceLookupParticipant#findSourceElements(Object)
*/
@Override
public boolean isFindDuplicates() {
return true;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.AbstractSourceLookupParticipant#dispose()
*/
@ -185,116 +161,4 @@ public class CSourceLookupParticipant extends AbstractSourceLookupParticipant {
super.sourceContainersChanged( director );
}
/**
* FIXME: Workaround for BUG247977
* Remove before 3.5
* Remove when ISourceLocator.isFindDuplicates() queries the source lookup participant
* instead of the ISourceLookupDirector
*/
private ISourceContainer[] containers;
private void initContainersSourceDirector() {
ISourceLookupDirector dummySourceDirector = new ISourceLookupDirector() {
public void addParticipants(ISourceLookupParticipant[] participants) {
getDirector().addParticipants(participants);
}
public void clearSourceElements(Object element) {
getDirector().clearSourceElements(element);
}
public Object[] findSourceElements(Object object) throws CoreException {
return getDirector().findSourceElements(object);
}
public String getId() {
return getDirector().getId();
}
public ILaunchConfiguration getLaunchConfiguration() {
return getDirector().getLaunchConfiguration();
}
public ISourceLookupParticipant[] getParticipants() {
return getDirector().getParticipants();
}
public ISourceContainer[] getSourceContainers() {
return getDirector().getSourceContainers();
}
public Object getSourceElement(Object element) {
return getDirector().getSourceElement(element);
}
public ISourcePathComputer getSourcePathComputer() {
return getDirector().getSourcePathComputer();
}
public void initializeParticipants() {
getDirector().initializeParticipants();
}
public boolean isFindDuplicates() {
return CSourceLookupParticipant.this.isFindDuplicates();
}
public void removeParticipants(ISourceLookupParticipant[] participants) {
getDirector().removeParticipants(participants);
}
public void setFindDuplicates(boolean findDuplicates) {
getDirector().setFindDuplicates(findDuplicates);
}
public void setSourceContainers(ISourceContainer[] containers) {
getDirector().setSourceContainers(containers);
}
public void setSourcePathComputer(ISourcePathComputer computer) {
getDirector().setSourcePathComputer(computer);
}
public boolean supportsSourceContainerType(ISourceContainerType type) {
return getDirector().supportsSourceContainerType(type);
}
public void dispose() {
getDirector().dispose();
}
public void initializeFromMemento(String memento, ILaunchConfiguration configuration) throws CoreException {
getDirector().initializeFromMemento(memento, configuration);
}
public String getMemento() throws CoreException {
return getDirector().getMemento();
}
public void initializeDefaults(ILaunchConfiguration configuration) throws CoreException {
getDirector().initializeDefaults(configuration);
}
public void initializeFromMemento(String memento) throws CoreException {
getDirector().initializeFromMemento(memento);
}
public Object getSourceElement(IStackFrame stackFrame) {
return getDirector().getSourceElement(stackFrame);
}
};
containers = getSourceContainers();
for (ISourceContainer cont : containers)
cont.init(dummySourceDirector);
}
private void endContainersSourceDirector() {
if (containers != null)
{
for (ISourceContainer cont : containers)
cont.init(getDirector());
}
containers = null;
}
}