|
Lines 11-18
Link Here
|
| 11 |
package org.eclipse.jdt.internal.launching; |
11 |
package org.eclipse.jdt.internal.launching; |
| 12 |
|
12 |
|
| 13 |
import java.util.HashSet; |
13 |
import java.util.HashSet; |
|
|
14 |
import java.util.List; |
| 14 |
import java.util.Set; |
15 |
import java.util.Set; |
| 15 |
|
16 |
|
|
|
17 |
import org.eclipse.core.runtime.CoreException; |
| 18 |
import org.eclipse.core.runtime.IStatus; |
| 19 |
import org.eclipse.core.runtime.Status; |
| 20 |
import org.eclipse.debug.core.DebugPlugin; |
| 21 |
import org.eclipse.debug.core.IStatusHandler; |
| 16 |
import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector; |
22 |
import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector; |
| 17 |
import org.eclipse.debug.core.sourcelookup.ISourceContainerType; |
23 |
import org.eclipse.debug.core.sourcelookup.ISourceContainerType; |
| 18 |
import org.eclipse.debug.core.sourcelookup.ISourceLookupParticipant; |
24 |
import org.eclipse.debug.core.sourcelookup.ISourceLookupParticipant; |
|
Lines 28-33
Link Here
|
| 28 |
public class JavaSourceLookupDirector extends AbstractSourceLookupDirector { |
34 |
public class JavaSourceLookupDirector extends AbstractSourceLookupDirector { |
| 29 |
|
35 |
|
| 30 |
private static Set<String> fFilteredTypes; |
36 |
private static Set<String> fFilteredTypes; |
|
|
37 |
protected static final IStatus fJavaResolveDuplicatesStatus = new Status(IStatus.INFO, "org.eclipse.debug.ui", 206, "", null); //$NON-NLS-1$//$NON-NLS-2$ |
| 31 |
|
38 |
|
| 32 |
static { |
39 |
static { |
| 33 |
fFilteredTypes = new HashSet<String>(); |
40 |
fFilteredTypes = new HashSet<String>(); |
|
Lines 51-54
Link Here
|
| 51 |
public boolean supportsSourceContainerType(ISourceContainerType type) { |
58 |
public boolean supportsSourceContainerType(ISourceContainerType type) { |
| 52 |
return !fFilteredTypes.contains(type.getId()); |
59 |
return !fFilteredTypes.contains(type.getId()); |
| 53 |
} |
60 |
} |
|
|
61 |
|
| 62 |
/** |
| 63 |
* Returns the source element to associate with the given element. This method is called when more than one source element has been found for an |
| 64 |
* element, and allows the source director to select a single source element to associate with the element. |
| 65 |
* <p> |
| 66 |
* Subclasses should override this method as appropriate. For example, to prompt the user to choose a source element. |
| 67 |
* </p> |
| 68 |
* |
| 69 |
* @param element |
| 70 |
* the debug artifact for which source is being searched for |
| 71 |
* @param sources |
| 72 |
* the source elements found for the given element |
| 73 |
* @return a single source element for the given element |
| 74 |
*/ |
| 75 |
@Override |
| 76 |
public Object resolveSourceElement(Object element, List<Object> sources) { |
| 77 |
// check the duplicates cache first |
| 78 |
for (Object dup : sources) { |
| 79 |
Object resolved = getCachedElement(dup); |
| 80 |
if (resolved != null) { |
| 81 |
return resolved; |
| 82 |
} |
| 83 |
} |
| 84 |
// consult a status handler |
| 85 |
IStatusHandler prompter = DebugPlugin.getDefault().getStatusHandler(fPromptStatus); |
| 86 |
if (prompter != null) { |
| 87 |
try { |
| 88 |
Object result = prompter.handleStatus(fJavaResolveDuplicatesStatus, new Object[] { element, sources }); |
| 89 |
if (result != null) { |
| 90 |
cacheResolvedElement(sources, result); |
| 91 |
return result; |
| 92 |
} |
| 93 |
} |
| 94 |
catch (CoreException e) { |
| 95 |
} |
| 96 |
} |
| 97 |
return sources.get(0); |
| 98 |
} |
| 54 |
} |
99 |
} |