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.WorkbenchAdapterFactory" 
3221
            adaptableType="org.eclipse.jdt.core.IJavaElement">
3222
            <adapter type="org.eclipse.ui.model.IWorkbenchAdapter"/>
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/JavaDebugWorkbenchAdapter.java (+75 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.jdt.core.IJavaElement;
15
import org.eclipse.jdt.core.IParent;
16
import org.eclipse.jdt.core.JavaModelException;
17
import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin;
18
import org.eclipse.jdt.internal.ui.viewsupport.JavaElementImageProvider;
19
import org.eclipse.jdt.ui.JavaElementLabels;
20
import org.eclipse.jface.resource.ImageDescriptor;
21
import org.eclipse.ui.model.IWorkbenchAdapter;
22
23
/**
24
 * Class provides the JavaElement labels for WorkbenchAdapater Objects while debugging
25
 */
26
public class JavaDebugWorkbenchAdapter implements IWorkbenchAdapter {
27
	private JavaElementImageProvider fImageProvider;
28
29
	public JavaDebugWorkbenchAdapter() {
30
		fImageProvider = new JavaElementImageProvider();
31
	}
32
33
	/*
34
	 *  Append Root path to identify full path for duplicate Java elements in source lookup dialog
35
	 */
36
37
	public String getLabel(Object element) {
38
		return JavaElementLabels.getTextLabel(getJavaElement(element), JavaElementLabels.ALL_DEFAULT | JavaElementLabels.APPEND_ROOT_PATH);
39
	}
40
41
	private IJavaElement getJavaElement(Object element) {
42
		if (element instanceof IJavaElement) {
43
			return (IJavaElement) element;
44
		}
45
		return null;
46
	}
47
48
	public Object[] getChildren(Object element) {
49
		IJavaElement je = getJavaElement(element);
50
		if (je instanceof IParent) {
51
			try {
52
				return ((IParent) je).getChildren();
53
			}
54
			catch (JavaModelException e) {
55
				JDIDebugUIPlugin.log(e);
56
			}
57
		}
58
		return new Object[0];
59
	}
60
61
	public ImageDescriptor getImageDescriptor(Object element) {
62
		IJavaElement je = getJavaElement(element);
63
		if (je != null) {
64
			return fImageProvider.getJavaImageDescriptor(je, JavaElementImageProvider.OVERLAY_ICONS | JavaElementImageProvider.SMALL_ICONS);
65
		}
66
67
		return null;
68
69
	}
70
71
	public Object getParent(Object element) {
72
		IJavaElement je = getJavaElement(element);
73
		return je != null ? je.getParent() : null;
74
	}
75
}
(-)ui/org/eclipse/jdt/internal/debug/ui/sourcelookup/WorkbenchAdapterFactory.java (-1 / +5 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2005 IBM Corporation and others.
2
 * Copyright (c) 2000, 2015 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 11-16 Link Here
11
package org.eclipse.jdt.internal.debug.ui.sourcelookup;
11
package org.eclipse.jdt.internal.debug.ui.sourcelookup;
12
12
13
import org.eclipse.core.runtime.IAdapterFactory;
13
import org.eclipse.core.runtime.IAdapterFactory;
14
import org.eclipse.jdt.core.IJavaElement;
14
import org.eclipse.ui.model.IWorkbenchAdapter;
15
import org.eclipse.ui.model.IWorkbenchAdapter;
15
16
16
/**
17
/**
Lines 22-27 Link Here
22
	 * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
23
	 * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
23
	 */
24
	 */
24
	public Object getAdapter(Object adaptableObject, Class adapterType) {
25
	public Object getAdapter(Object adaptableObject, Class adapterType) {
26
		if (adaptableObject instanceof IJavaElement && adapterType.equals(IWorkbenchAdapter.class)) {
27
			return new JavaDebugWorkbenchAdapter();
28
		}
25
		if (adapterType.equals(IWorkbenchAdapter.class)) {
29
		if (adapterType.equals(IWorkbenchAdapter.class)) {
26
			return new WorkbenchAdapter();
30
			return new WorkbenchAdapter();
27
		}
31
		}

Return to bug 56062