Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarin Wright2004-01-27 09:47:34 -0500
committerDarin Wright2004-01-27 09:47:34 -0500
commit2f4789dd6b3522ff6f285ac9858901f4581c8ffe (patch)
treec252445a4dc4dd08fe632a7889470998246785cb
parentc9b81766bcf07a316b919b350707fbdfe3ca4215 (diff)
downloadeclipse.platform.debug-2f4789dd6b3522ff6f285ac9858901f4581c8ffe.tar.gz
eclipse.platform.debug-2f4789dd6b3522ff6f285ac9858901f4581c8ffe.tar.xz
eclipse.platform.debug-2f4789dd6b3522ff6f285ac9858901f4581c8ffe.zip
Bug 29890 - Debug Platform Source Lookup Facilites
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java6
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java11
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/AbstractSourceLookupDirector.java33
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/SourceLookupMessages.properties2
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/containers/DefaultSourceContainer.java15
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/containers/DefaultSourceContainerType.java10
-rw-r--r--org.eclipse.debug.core/schema/launchConfigurationTypes.exsd2
-rw-r--r--org.eclipse.debug.core/schema/sourceContainerTypes.exsd12
8 files changed, 58 insertions, 33 deletions
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java
index cdad9dad1..6d61f3cc4 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java
@@ -42,6 +42,7 @@ import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.Launch;
import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
import org.eclipse.debug.core.model.IPersistableSourceLocator;
+import org.eclipse.debug.internal.core.sourcelookup.IPersistableSourceLocator2;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.InputSource;
@@ -182,7 +183,10 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
if (memento == null) {
locator.initializeDefaults(this);
} else {
- locator.initializeFromMemento(memento);
+ if(locator instanceof IPersistableSourceLocator2)
+ ((IPersistableSourceLocator2)locator).initializeFromMemento(memento, this);
+ else
+ locator.initializeFromMemento(memento);
}
launch.setSourceLocator(locator);
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java
index 28cb94990..f0bc82f86 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java
@@ -77,6 +77,7 @@ import org.eclipse.debug.core.model.IDebugTarget;
import org.eclipse.debug.core.model.IPersistableSourceLocator;
import org.eclipse.debug.core.model.IProcess;
import org.eclipse.debug.internal.core.sourcelookup.ISourcePathComputer;
+import org.eclipse.debug.internal.core.sourcelookup.SourceLookupUtils;
import org.eclipse.osgi.service.environment.Constants;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -1628,8 +1629,14 @@ public class LaunchManager implements ILaunchManager, IResourceChangeListener {
* @see org.eclipse.debug.core.ILaunchManager#newSourcePathComputer(org.eclipse.debug.core.ILaunchConfiguration)
*/
public ISourcePathComputer newSourcePathComputer(ILaunchConfiguration configuration) throws CoreException {
- // TODO: to be implemented
- return null;
+ String id = null;
+ id = configuration.getAttribute(ISourcePathComputer.ATTR_SOURCE_PATH_COMPUTER_ID, (String)null);
+
+ if (id == null) {
+ //use default computer for configuration type, if any
+ return configuration.getType().getSourcePathComputer();
+ }
+ return SourceLookupUtils.getSourcePathComputer(id);
}
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/AbstractSourceLookupDirector.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/AbstractSourceLookupDirector.java
index c0cf2f568..9facaadb5 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/AbstractSourceLookupDirector.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/AbstractSourceLookupDirector.java
@@ -145,7 +145,9 @@ public abstract class AbstractSourceLookupDirector implements IPersistableSource
Iterator iterator = fParticipants.iterator();
while (iterator.hasNext()) {
ISourceLookupParticipant participant = (ISourceLookupParticipant) iterator.next();
- participant.dispose();
+ //director may also be a participant
+ if(participant != this)
+ participant.dispose();
}
fParticipants.clear();
if (fSourceContainers != null) {
@@ -301,14 +303,15 @@ public abstract class AbstractSourceLookupDirector implements IPersistableSource
pathNode.setAttribute(DUPLICATES_ATTR, "false"); //$NON-NLS-1$
}
rootNode.appendChild(pathNode);
-
- for(int i=0; i<fSourceContainers.length; i++){
- Element node = doc.createElement(CONTAINER_NODE);
- ISourceContainer container = fSourceContainers[i];
- ISourceContainerType type = container.getType();
- node.setAttribute(CONTAINER_TYPE_ATTR, type.getId());
- node.setAttribute(CONTAINER_MEMENTO_ATTR, type.getMemento(container));
- pathNode.appendChild(node);
+ if(fSourceContainers !=null){
+ for(int i=0; i<fSourceContainers.length; i++){
+ Element node = doc.createElement(CONTAINER_NODE);
+ ISourceContainer container = fSourceContainers[i];
+ ISourceContainerType type = container.getType();
+ node.setAttribute(CONTAINER_TYPE_ATTR, type.getId());
+ node.setAttribute(CONTAINER_MEMENTO_ATTR, type.getMemento(container));
+ pathNode.appendChild(node);
+ }
}
return SourceLookupUtils.serializeDocument(doc);
}
@@ -339,6 +342,12 @@ public abstract class AbstractSourceLookupDirector implements IPersistableSource
}
}
+ /**
+ * Sets the source containers used by this source lookup
+ * director, and notifies participants of the change.
+ *
+ * @param containers source containers to use
+ */
public void setSourceContainers(ISourceContainer[] containers) {
fSourceContainers = containers;
Iterator participants = fParticipants.iterator();
@@ -372,8 +381,8 @@ public abstract class AbstractSourceLookupDirector implements IPersistableSource
* for a stack frame, and allows the source director to select a single
* source element to associate with the stack frame.
* <p>
- * Subclasses should override this method as appropriated. For example,
- * a to prompt the user to choose a source element.
+ * Subclasses should override this method as appropriate. For example,
+ * to prompt the user to choose a source element.
* </p>
* @param frame the frame for which source is being searched for
* @param sources the source elements found for the given stack frame
@@ -440,7 +449,7 @@ public abstract class AbstractSourceLookupDirector implements IPersistableSource
* is a persisted launch configration, this director will respond to changes
* in the persisted launch configuration.
*
- * @param configuration launch configuration to associated with this
+ * @param configuration launch configuration to associate with this
* source lookup director, or <code>null</code> if none
*/
protected void setLaunchConfiguration(ILaunchConfiguration configuration) {
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/SourceLookupMessages.properties b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/SourceLookupMessages.properties
index b640ddd8d..9d698d2fa 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/SourceLookupMessages.properties
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/SourceLookupMessages.properties
@@ -15,7 +15,7 @@ AbstractSourceLookupDirector.13=Unable to restore source lookup path - expecting
AbstractSourceLookupDirector.14=Unable to read source lookup path - expecting sourceLookupDirector node.
DefaultSourceContainer.0=Default
-
+DefaultSourceContainer.1=Error creating source path computer.
DefaultSourceContainerType.5=Unable to restore default source lookup path - missing launchConfiguration attribute.
DefaultSourceContainerType.6=Unable to restore default source lookup path - expecting default element.
DefaultSourceContainerType.7=Unable to restore default source lookup path - invalid memento.
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/containers/DefaultSourceContainer.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/containers/DefaultSourceContainer.java
index d298d7e16..5be53f72a 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/containers/DefaultSourceContainer.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/containers/DefaultSourceContainer.java
@@ -11,6 +11,7 @@
package org.eclipse.debug.internal.core.sourcelookup.containers;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.internal.core.sourcelookup.ISourceContainer;
import org.eclipse.debug.internal.core.sourcelookup.ISourceContainerType;
@@ -89,16 +90,12 @@ public class DefaultSourceContainer extends CompositeSourceContainer {
* if none
*/
private ISourcePathComputer getSourcePathComputer() {
- String id;
- try {
- id = fConfiguration.getAttribute(ISourcePathComputer.ATTR_SOURCE_PATH_COMPUTER_ID, (String)null);
- } catch (CoreException e) {
- return null;
+ try{
+ return DebugPlugin.getDefault().getLaunchManager().newSourcePathComputer(fConfiguration);
+ }catch(CoreException e){
+ DebugPlugin.logMessage(SourceLookupMessages.getString("DefaultSourceContainer.1"),e);
}
- if (id == null) {
- return null;
- }
- return SourceLookupUtils.getSourcePathComputer(id);
+ return null;
}
/* (non-Javadoc)
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/containers/DefaultSourceContainerType.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/containers/DefaultSourceContainerType.java
index 88d1ca6c7..f22d80597 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/containers/DefaultSourceContainerType.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/containers/DefaultSourceContainerType.java
@@ -13,6 +13,7 @@ package org.eclipse.debug.internal.core.sourcelookup.containers;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.internal.core.sourcelookup.ISourceContainer;
import org.eclipse.debug.internal.core.sourcelookup.SourceLookupMessages;
import org.eclipse.debug.internal.core.sourcelookup.SourceLookupUtils;
@@ -41,7 +42,14 @@ public class DefaultSourceContainerType extends AbstractSourceContainerTypeDeleg
DefaultSourceContainer def = (DefaultSourceContainer) container;
Document document = SourceLookupUtils.newDocument();
Element element = document.createElement("default"); //$NON-NLS-1$
- element.setAttribute("launchConfiguration", def.getLaunchConfiguration().getMemento()); //$NON-NLS-1$
+ //working copies produce null mementos
+ //this isn't a good solution though...causes problems sometimes since it might be working off the right copy
+ //may be avoidable if we stop writing to the config too often
+ if(def.getLaunchConfiguration().isWorkingCopy()) {
+ element.setAttribute("launchConfiguration", ((ILaunchConfigurationWorkingCopy)def.getLaunchConfiguration()).getOriginal().getMemento()); //$NON-NLS-1$
+ } else {
+ element.setAttribute("launchConfiguration", def.getLaunchConfiguration().getMemento()); //$NON-NLS-1$
+ }
document.appendChild(element);
return SourceLookupUtils.serializeDocument(document);
}
diff --git a/org.eclipse.debug.core/schema/launchConfigurationTypes.exsd b/org.eclipse.debug.core/schema/launchConfigurationTypes.exsd
index 2a9624c11..daed02682 100644
--- a/org.eclipse.debug.core/schema/launchConfigurationTypes.exsd
+++ b/org.eclipse.debug.core/schema/launchConfigurationTypes.exsd
@@ -177,7 +177,7 @@ The launch configuration is applicable to .txt and .gif files, and is the defaul
&lt;p&gt;
&lt;a href=&quot;hglegal.htm&quot;&gt;
&lt;img SRC=&quot;ngibmcpy.gif&quot;
- ALT=&quot;Copyright (c) 2000, 2003 IBM Corporation and others. All Rights Reserved.&quot;
+ ALT=&quot;Copyright (c) 2000, 2004 IBM Corporation and others. All Rights Reserved.&quot;
BORDER=0 height=14 width=324&gt;&lt;/a&gt;
&lt;/p&gt;
</documentation>
diff --git a/org.eclipse.debug.core/schema/sourceContainerTypes.exsd b/org.eclipse.debug.core/schema/sourceContainerTypes.exsd
index 776190399..9e3fa5b86 100644
--- a/org.eclipse.debug.core/schema/sourceContainerTypes.exsd
+++ b/org.eclipse.debug.core/schema/sourceContainerTypes.exsd
@@ -6,7 +6,7 @@
<meta.schema plugin="org.eclipse.debug.core" id="sourceContainerTypes" name="Source Container Types"/>
</appInfo>
<documentation>
- This extension point allows for an extensible set of source container types to be contributed by the debug platform
+ This extension point allows for an extensible set of source container types to be contributed by the debug platform
source lookup facilities.
</documentation>
</annotation>
@@ -110,11 +110,11 @@
<meta.section type="copyright"/>
</appInfo>
<documentation>
- &lt;p&gt;
- &lt;a href=&quot;hglegal.htm&quot;&gt;
- &lt;img SRC=&quot;ngibmcpy.gif&quot;
- ALT=&quot;Copyright (c) 2003 IBM Corporation and others. All Rights Reserved.&quot;
- BORDER=0 height=14 width=324&gt;&lt;/a&gt;
+ &lt;p&gt;
+ &lt;a href=&quot;hglegal.htm&quot;&gt;
+ &lt;img SRC=&quot;ngibmcpy.gif&quot;
+ ALT=&quot;Copyright (c) 2003, 2004 IBM Corporation and others. All Rights Reserved.&quot;
+ BORDER=0 height=14 width=324&gt;&lt;/a&gt;
&lt;/p&gt;
</documentation>
</annotation>

Back to the top