Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 56062 | Differences between
and this patch

Collapse All | Expand All

(-)plugin.xml (-2 / +8 lines)
Lines 1-7 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
1
<?xml version="1.0" encoding="UTF-8"?>
2
<?eclipse version="3.0"?>
2
<?eclipse version="3.0"?>
3
<!--
3
<!--
4
     Copyright (c) 2005, 2014 IBM Corporation and others.
4
     Copyright (c) 2005, 2015 IBM Corporation and others.
5
     All rights reserved. This program and the accompanying materials
5
     All rights reserved. This program and the accompanying materials
6
     are made available under the terms of the Eclipse Public License v1.0
6
     are made available under the terms of the Eclipse Public License v1.0
7
     which accompanies this distribution, and is available at
7
     which accompanies this distribution, and is available at
Lines 2499-2505 Link Here
2499
            code="111"
2499
            code="111"
2500
            class="org.eclipse.jdt.internal.debug.ui.EvaluationStackFrameContextStatusHandler"
2500
            class="org.eclipse.jdt.internal.debug.ui.EvaluationStackFrameContextStatusHandler"
2501
            id="org.eclipse.jdt.debug.ui.statusHandler.evaluationStackFrameContextStatusHandler"
2501
            id="org.eclipse.jdt.debug.ui.statusHandler.evaluationStackFrameContextStatusHandler"
2502
            plugin="org.eclipse.jdt.debug"/>        
2502
            plugin="org.eclipse.jdt.debug"/>  
2503
     <statusHandler
2504
		    code="206"
2505
		    plugin="org.eclipse.debug.ui"
2506
		    class="org.eclipse.jdt.internal.debug.ui.sourcelookup.JavaResolveDuplicatesHandler"
2507
		    id="org.eclipse.jdt.debug.ui.statusHandler.selectSourceDialog">
2508
  	</statusHandler>      
2503
   </extension>
2509
   </extension>
2504
   <extension
2510
   <extension
2505
         point="org.eclipse.debug.core.sourceLocators">
2511
         point="org.eclipse.debug.core.sourceLocators">
(-)ui/org/eclipse/jdt/internal/debug/ui/sourcelookup/JavaResolveDuplicateLabelProvider.java (+28 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2015 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.jdt.internal.debug.ui.sourcelookup;
12
13
import org.eclipse.debug.internal.ui.sourcelookup.SourceElementLabelProvider;
14
import org.eclipse.jdt.core.IJavaElement;
15
import org.eclipse.jdt.ui.JavaElementLabels;
16
17
@SuppressWarnings("restriction")
18
public class JavaResolveDuplicateLabelProvider extends SourceElementLabelProvider {
19
20
	@Override
21
	public String getText(Object element) {
22
		if (element instanceof IJavaElement) {
23
			return JavaElementLabels.getTextLabel(element, JavaElementLabels.ALL_DEFAULT | JavaElementLabels.APPEND_ROOT_PATH);
24
		}
25
		return super.getText(element);
26
	}
27
28
}
(-)ui/org/eclipse/jdt/internal/debug/ui/sourcelookup/JavaResolveDuplicatesHandler.java (+26 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2015 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.jdt.internal.debug.ui.sourcelookup;
12
13
import org.eclipse.debug.internal.ui.sourcelookup.ResolveDuplicatesHandler;
14
import org.eclipse.jface.viewers.ILabelProvider;
15
16
/**
17
 * Java Status handler to prompt for duplicate source element resolution.
18
 * 
19
 */
20
@SuppressWarnings("restriction")
21
public class JavaResolveDuplicatesHandler extends ResolveDuplicatesHandler {
22
	@Override
23
	public ILabelProvider getLabelProvider() {
24
		return new JavaResolveDuplicateLabelProvider();
25
	}
26
}
(-)launching/org/eclipse/jdt/internal/launching/JavaSourceLookupDirector.java (+45 lines)
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
}

Return to bug 56062