Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSarika Sinha2015-04-14 09:09:55 +0000
committerSarika Sinha2015-04-14 09:09:55 +0000
commit8f3b5f58c650f767e3cd133df991cf0f2e6c47f7 (patch)
tree913cc216e30fcc25345b62d001d39f6af45cc582
parent051fce25278ddaccf5c402484bf105ce2a390160 (diff)
downloadeclipse.jdt.debug-8f3b5f58c650f767e3cd133df991cf0f2e6c47f7.tar.gz
eclipse.jdt.debug-8f3b5f58c650f767e3cd133df991cf0f2e6c47f7.tar.xz
eclipse.jdt.debug-8f3b5f58c650f767e3cd133df991cf0f2e6c47f7.zip
Bug 56062 - [source lookup] Duplicate source lookup should indicate fullI20150414-1400I20150414-0800
location of duplicate Change-Id: I5c8a54ddfe99396fb7f86509b2c4c538b6efe804
-rw-r--r--org.eclipse.jdt.debug.ui/plugin.xml7
-rw-r--r--org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/sourcelookup/SourceElementLabelProviderAdapter.java46
-rw-r--r--org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/sourcelookup/SourceElementLabelProviderAdapterFactory.java42
3 files changed, 94 insertions, 1 deletions
diff --git a/org.eclipse.jdt.debug.ui/plugin.xml b/org.eclipse.jdt.debug.ui/plugin.xml
index 8e0b12ac2..f75540245 100644
--- a/org.eclipse.jdt.debug.ui/plugin.xml
+++ b/org.eclipse.jdt.debug.ui/plugin.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<!--
- Copyright (c) 2005, 2014 IBM Corporation and others.
+ Copyright (c) 2005, 2015 IBM Corporation and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
@@ -3216,6 +3216,11 @@ M4 = Platform-specific fourth key
adaptableType="org.eclipse.jdt.launching.sourcelookup.containers.ClasspathContainerSourceContainer">
<adapter type="org.eclipse.ui.model.IWorkbenchAdapter"/>
</factory>
+ <factory
+ class="org.eclipse.jdt.internal.debug.ui.sourcelookup.SourceElementLabelProviderAdapterFactory"
+ adaptableType="org.eclipse.jdt.core.IJavaElement">
+ <adapter type="org.eclipse.debug.internal.ui.sourcelookup.SourceElementLabelProvider"/>
+ </factory>
<!-- Adapters for runtime classpath entries -->
<factory
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/sourcelookup/SourceElementLabelProviderAdapter.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/sourcelookup/SourceElementLabelProviderAdapter.java
new file mode 100644
index 000000000..1f444853a
--- /dev/null
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/sourcelookup/SourceElementLabelProviderAdapter.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2015 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jdt.internal.debug.ui.sourcelookup;
+
+import org.eclipse.debug.internal.ui.sourcelookup.SourceElementLabelProvider;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.ui.JavaElementLabelProvider;
+import org.eclipse.jdt.ui.JavaElementLabels;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * Class provides the Duplicate JavaElement labels and Images for SourceElementLabelProvider Objects while debugging
+ *
+ * @since 3.7
+ */
+@SuppressWarnings("restriction")
+public class SourceElementLabelProviderAdapter extends SourceElementLabelProvider {
+
+ // Append Root path to identify full path for duplicate Java elements in source lookup dialog
+ @Override
+ public String getText(Object element) {
+ return JavaElementLabels.getTextLabel(getJavaElement(element), JavaElementLabels.ALL_DEFAULT | JavaElementLabels.APPEND_ROOT_PATH);
+ }
+
+ private IJavaElement getJavaElement(Object element) {
+ if (element instanceof IJavaElement) {
+ return (IJavaElement) element;
+ }
+ return null;
+ }
+
+ @Override
+ public Image getImage(Object element) {
+ return new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT).getImage(element);
+ }
+
+}
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/sourcelookup/SourceElementLabelProviderAdapterFactory.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/sourcelookup/SourceElementLabelProviderAdapterFactory.java
new file mode 100644
index 000000000..03a14c128
--- /dev/null
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/sourcelookup/SourceElementLabelProviderAdapterFactory.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2015 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.internal.debug.ui.sourcelookup;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.jdt.core.IJavaElement;
+
+/**
+ * Adapter factory for duplicate source lookup elements.
+ *
+ * @since 3.7
+ */
+public class SourceElementLabelProviderAdapterFactory implements IAdapterFactory {
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
+ */
+ @Override
+ @SuppressWarnings({ "unchecked", "restriction" })
+ public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
+ if (adapterType.equals(org.eclipse.debug.internal.ui.sourcelookup.SourceElementLabelProvider.class)
+ && adaptableObject instanceof IJavaElement) {
+ return (T) new SourceElementLabelProviderAdapter();
+ }
+ return null;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
+ */
+ @SuppressWarnings("restriction")
+ @Override
+ public Class<?>[] getAdapterList() {
+ return new Class[] { org.eclipse.debug.internal.ui.sourcelookup.SourceElementLabelProvider.class };
+ }
+}

Back to the top