Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.debug.core/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.debug.core/buildnotes_platform-debug.html5
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/AbstractSourceLookupDirector.java73
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/AbstractSourceLookupParticipant.java7
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/AbstractSourceContainer.java25
5 files changed, 80 insertions, 32 deletions
diff --git a/org.eclipse.debug.core/META-INF/MANIFEST.MF b/org.eclipse.debug.core/META-INF/MANIFEST.MF
index 16c975b9b..8a2294e98 100644
--- a/org.eclipse.debug.core/META-INF/MANIFEST.MF
+++ b/org.eclipse.debug.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.debug.core; singleton:=true
-Bundle-Version: 3.4.100.qualifier
+Bundle-Version: 3.5.0.qualifier
Bundle-ClassPath: .
Bundle-Activator: org.eclipse.debug.core.DebugPlugin
Bundle-Vendor: %providerName
diff --git a/org.eclipse.debug.core/buildnotes_platform-debug.html b/org.eclipse.debug.core/buildnotes_platform-debug.html
index 214553663..46c685c0c 100644
--- a/org.eclipse.debug.core/buildnotes_platform-debug.html
+++ b/org.eclipse.debug.core/buildnotes_platform-debug.html
@@ -21,6 +21,11 @@ an external file system may not map to a local location, <code>null</code> can n
code to handle a <code>null</code> result. The #getLocation() method has been deprecated since the return
value is no longer reliable.</p>
+<h3>Access to current source lookup participant</h3>
+<p><strong>What is affected:</strong> Method addition: AbstractSourceLookupDirector#getCurrentParticipant() </p>
+<p><strong>Description:</strong> Since 3.5, the AbstractSourceLookupDirector provides access to the ISourceLookupParticipant currently looking up source via the new method #getCurrentParticipant(). The implementation of AbstractSourceContainer has been enhanced to ask the current participant if duplicate source files should be found when looking up source. To maintain backwards compatibility, the participant delegates whether duplicates should be found to the source lookup director. A custom implementation of a source lookup participant could override the default behavior to control whether duplicate source files should be found. </p>
+<p><strong>Action required:</strong> This is a backwards compatible change. No action required. </p>
+<p>&nbsp; </p>
<h2>September 30, 2008</h2>
<h3>Problem Reports Fixed</h3>
<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=246278">Bug 246278</a>: NPE in DefaultDetailPane.java:264<br>
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/AbstractSourceLookupDirector.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/AbstractSourceLookupDirector.java
index e5a28922f..b8bac41bc 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/AbstractSourceLookupDirector.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/AbstractSourceLookupDirector.java
@@ -11,7 +11,6 @@
*******************************************************************************/
package org.eclipse.debug.core.sourcelookup;
-import com.ibm.icu.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -40,6 +39,8 @@ import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
+import com.ibm.icu.text.MessageFormat;
+
/**
* Directs source lookup among a collection of source lookup participants,
* and a common collection of source containers.
@@ -85,6 +86,8 @@ public abstract class AbstractSourceLookupDirector implements ISourceLookupDirec
* Keys are the duplicates, values are the source element to use.
*/
protected Map fResolvedElements = null;
+ // current participant performing lookup or <code>null</code>
+ private ISourceLookupParticipant fCurrentParticipant;
protected static final IStatus fPromptStatus = new Status(IStatus.INFO, "org.eclipse.debug.ui", 200, "", null); //$NON-NLS-1$//$NON-NLS-2$
protected static final IStatus fResolveDuplicatesStatus = new Status(IStatus.INFO, "org.eclipse.debug.ui", 205, "", null); //$NON-NLS-1$//$NON-NLS-2$
@@ -130,31 +133,36 @@ public abstract class AbstractSourceLookupDirector implements ISourceLookupDirec
MultiStatus multiStatus = null;
CoreException single = null;
ISourceLookupParticipant[] participants = getParticipants();
- for(int i=0; i < participants.length; i++) {
- Object[] sourceArray;
- try {
- sourceArray = participants[i].findSourceElements(fElement);
- if (sourceArray !=null && sourceArray.length > 0) {
- if (isFindDuplicates()) {
- for(int j=0; j<sourceArray.length; j++)
- if(!checkDuplicate(sourceArray[j], fSourceElements))
- fSourceElements.add(sourceArray[j]);
+ try {
+ for(int i=0; i < participants.length; i++) {
+ setCurrentParticipant(participants[i]);
+ Object[] sourceArray;
+ try {
+ sourceArray = participants[i].findSourceElements(fElement);
+ if (sourceArray !=null && sourceArray.length > 0) {
+ if (isFindDuplicates()) {
+ for(int j=0; j<sourceArray.length; j++)
+ if(!checkDuplicate(sourceArray[j], fSourceElements))
+ fSourceElements.add(sourceArray[j]);
+ } else {
+ fSourceElements.add(sourceArray[0]);
+ return;
+ }
+ }
+ } catch (CoreException e) {
+ if (single == null) {
+ single = e;
+ } else if (multiStatus == null) {
+ multiStatus = new MultiStatus(DebugPlugin.getUniqueIdentifier(), DebugPlugin.ERROR, new IStatus[]{single.getStatus()}, SourceLookupMessages.Source_Lookup_Error, null);
+ multiStatus.add(e.getStatus());
} else {
- fSourceElements.add(sourceArray[0]);
- return;
+ multiStatus.add(e.getStatus());
}
}
- } catch (CoreException e) {
- if (single == null) {
- single = e;
- } else if (multiStatus == null) {
- multiStatus = new MultiStatus(DebugPlugin.getUniqueIdentifier(), DebugPlugin.ERROR, new IStatus[]{single.getStatus()}, SourceLookupMessages.Source_Lookup_Error, null);
- multiStatus.add(e.getStatus());
- } else {
- multiStatus.add(e.getStatus());
- }
}
- }
+ } finally {
+ setCurrentParticipant(null);
+ }
if (fSourceElements.isEmpty()) {
// set exception if there was one
if (multiStatus != null) {
@@ -743,4 +751,25 @@ public abstract class AbstractSourceLookupDirector implements ISourceLookupDirec
return null;
}
}
+
+ /**
+ * Sets the current participant or <code>null</code> if none.
+ *
+ * @param participant active participant or <code>null</code>
+ */
+ private void setCurrentParticipant(ISourceLookupParticipant participant) {
+ fCurrentParticipant = participant;
+ }
+
+ /**
+ * Returns the participant currently looking up source or <code>null</code>
+ * if none.
+ *
+ * @return the participant currently looking up source or <code>null</code>
+ * if none
+ * @since 3.5
+ */
+ public ISourceLookupParticipant getCurrentParticipant() {
+ return fCurrentParticipant;
+ }
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/AbstractSourceLookupParticipant.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/AbstractSourceLookupParticipant.java
index cbf21d2fa..4eb54a752 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/AbstractSourceLookupParticipant.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/AbstractSourceLookupParticipant.java
@@ -132,15 +132,16 @@ public abstract class AbstractSourceLookupParticipant implements ISourceLookupPa
*
* @return whether this participant's source lookup director is configured
* to search for duplicate source elements
+ * @since 3.5
*/
- protected boolean isFindDuplicates() {
+ public boolean isFindDuplicates() {
ISourceLookupDirector director = getDirector();
if (director != null) {
return director.isFindDuplicates();
}
return false;
- }
-
+ }
+
/**
* Returns the source containers currently registered with this participant's
* source lookup director.
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/AbstractSourceContainer.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/AbstractSourceContainer.java
index 70e15a6cd..6b87cf1b2 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/AbstractSourceContainer.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/AbstractSourceContainer.java
@@ -15,9 +15,12 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.PlatformObject;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector;
+import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupParticipant;
import org.eclipse.debug.core.sourcelookup.ISourceContainer;
import org.eclipse.debug.core.sourcelookup.ISourceContainerType;
import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector;
+import org.eclipse.debug.core.sourcelookup.ISourceLookupParticipant;
/**
* Common function for source containers.
@@ -100,15 +103,25 @@ public abstract class AbstractSourceContainer extends PlatformObject implements
}
/**
- * Returns whether this container's source lookup director is configured
- * to search for duplicate source elements.
+ * Returns whether this container's source should search for duplicate source
+ * elements. Since 3.5, the current participant is consulted to determine if
+ * duplicates should be found. Fall back to querying the source lookup director
+ * if the participant is not an {@link AbstractSourceLookupParticipant}.
*
- * @return whether this container's source lookup director is configured
- * to search for duplicate source elements
+ * @return whether to search for duplicate source elements
*/
protected boolean isFindDuplicates() {
- if (getDirector() != null) {
- return getDirector().isFindDuplicates();
+ ISourceLookupDirector director = getDirector();
+ if (director != null) {
+ if (director instanceof AbstractSourceLookupDirector) {
+ AbstractSourceLookupDirector asld = (AbstractSourceLookupDirector) director;
+ ISourceLookupParticipant participant = asld.getCurrentParticipant();
+ if (participant instanceof AbstractSourceLookupParticipant ) {
+ AbstractSourceLookupParticipant aslp = (AbstractSourceLookupParticipant) participant;
+ return aslp.isFindDuplicates();
+ }
+ }
+ return director.isFindDuplicates();
}
return false;
}

Back to the top