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 (-1 / +6 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 3216-3221 Link Here
3216
            adaptableType="org.eclipse.jdt.launching.sourcelookup.containers.ClasspathContainerSourceContainer">
3216
            adaptableType="org.eclipse.jdt.launching.sourcelookup.containers.ClasspathContainerSourceContainer">
3217
            <adapter type="org.eclipse.ui.model.IWorkbenchAdapter"/>
3217
            <adapter type="org.eclipse.ui.model.IWorkbenchAdapter"/>
3218
         </factory>   
3218
         </factory>   
3219
  		<factory 
3220
            class="org.eclipse.jdt.internal.debug.ui.sourcelookup.SourceElementLabelProviderAdapterFactory" 
3221
            adaptableType="org.eclipse.jdt.core.IJavaElement">
3222
            <adapter type="org.eclipse.debug.internal.ui.sourcelookup.SourceElementLabelProvider"/>
3223
  		</factory>
3219
    
3224
    
3220
    <!-- Adapters for runtime classpath entries -->
3225
    <!-- Adapters for runtime classpath entries -->
3221
         <factory 
3226
         <factory 
(-)ui/org/eclipse/jdt/internal/debug/ui/sourcelookup/JavaDebugSourceElementLabelProviderAdapter.java (+68 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
12
package org.eclipse.jdt.internal.debug.ui.sourcelookup;
13
14
import org.eclipse.debug.internal.ui.sourcelookup.SourceElementLabelProvider;
15
import org.eclipse.jdt.core.IJavaElement;
16
import org.eclipse.jdt.internal.ui.JavaPlugin;
17
import org.eclipse.jdt.internal.ui.viewsupport.JavaElementImageProvider;
18
import org.eclipse.jdt.ui.JavaElementLabels;
19
import org.eclipse.jface.resource.ImageDescriptor;
20
import org.eclipse.swt.graphics.Image;
21
22
/**
23
 * Class provides the Duplicate JavaElement labels and Images for SourceElementLabelProvider Objects while debugging
24
 */
25
@SuppressWarnings("restriction")
26
public class JavaDebugSourceElementLabelProviderAdapter extends SourceElementLabelProvider {
27
	private JavaElementImageProvider fImageProvider;
28
29
	public JavaDebugSourceElementLabelProviderAdapter() {
30
		fImageProvider = new JavaElementImageProvider();
31
	}
32
	/*
33
	 *  Append Root path to identify full path for duplicate Java elements in source lookup dialog
34
	 */
35
	@Override
36
	public String getText(Object element) {
37
		return JavaElementLabels.getTextLabel(getJavaElement(element), JavaElementLabels.ALL_DEFAULT | JavaElementLabels.APPEND_ROOT_PATH);
38
	}
39
40
	private IJavaElement getJavaElement(Object element) {
41
		if (element instanceof IJavaElement) {
42
			return (IJavaElement) element;
43
		}
44
		return null;
45
	}
46
47
	@Override
48
	public Image getImage(Object element) {
49
		ImageDescriptor descriptor = getImageDescriptor(element);
50
		if (descriptor == null) {
51
			return null;
52
		}
53
54
55
		return JavaPlugin.getImageDescriptorRegistry().get(descriptor);
56
	}
57
58
	public ImageDescriptor getImageDescriptor(Object element) {
59
		IJavaElement je = getJavaElement(element);
60
		if (je != null) {
61
			return fImageProvider.getJavaImageDescriptor(je, JavaElementImageProvider.OVERLAY_ICONS | JavaElementImageProvider.SMALL_ICONS);
62
		}
63
64
		return null;
65
66
	}
67
68
}
(-)ui/org/eclipse/jdt/internal/debug/ui/sourcelookup/SourceElementLabelProviderAdapterFactory.java (+41 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.core.runtime.IAdapterFactory;
14
import org.eclipse.jdt.core.IJavaElement;
15
16
/**
17
 * Adapter factory for duplicate source lookup elements.
18
 * 
19
 * @since 3.7
20
 */
21
public class SourceElementLabelProviderAdapterFactory implements IAdapterFactory {
22
	/* (non-Javadoc)
23
	 * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
24
	 */
25
	@Override
26
	@SuppressWarnings({ "unchecked", "restriction" })
27
	public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
28
		if (adapterType.equals(org.eclipse.debug.internal.ui.sourcelookup.SourceElementLabelProvider.class)
29
				&& adaptableObject instanceof IJavaElement) {
30
			return (T) new JavaDebugSourceElementLabelProviderAdapter();
31
		}
32
		return null;
33
	}
34
	/* (non-Javadoc)
35
	 * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
36
	 */
37
	@Override
38
	public Class<?>[] getAdapterList() {
39
		return new Class[] { org.eclipse.debug.internal.ui.sourcelookup.SourceElementLabelProvider.class };
40
	}
41
}

Return to bug 56062