Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarin Wright2009-10-15 13:52:17 +0000
committerDarin Wright2009-10-15 13:52:17 +0000
commitd4166175b34e76a23f5effa0f869ae7582357283 (patch)
tree1145b9768f2c548402176afcc24f14f3b1f50424 /org.eclipse.debug.core
parent0c7c758321cae2823cc925c614fd85a90636846f (diff)
downloadeclipse.platform.debug-d4166175b34e76a23f5effa0f869ae7582357283.tar.gz
eclipse.platform.debug-d4166175b34e76a23f5effa0f869ae7582357283.tar.xz
eclipse.platform.debug-d4166175b34e76a23f5effa0f869ae7582357283.zip
Bug 41353 - [launching] Launch config templates
Diffstat (limited to 'org.eclipse.debug.core')
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationType.java37
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationType.java41
2 files changed, 44 insertions, 34 deletions
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationType.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationType.java
index 4cf7e9c82..4f8ff9cc3 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationType.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationType.java
@@ -310,27 +310,40 @@ public interface ILaunchConfigurationType extends IAdaptable {
public String getContributorName();
/**
- * Sets the template for this launch configuration type in the specified scope,
- * or removes the template for the scope when the specified configuration is
+ * Sets the default template for this launch configuration type in the specified scope,
+ * or removes the default template for the scope when the specified configuration is
* <code>null</code>.
*
- * @param configuration template for the specified scope, or <code>null</code> if none
+ * @param configuration default template for the specified scope, or <code>null</code> if none
* @param scope scope
- * @throws CoreException if unable to to set/remove the template for the given scope
+ * @throws CoreException if unable to to set/remove the default template for the given scope
* @since 3.6
*/
- public void setTemplate(ILaunchConfiguration configuration, IScopeContext scope) throws CoreException;
+ public void setDefaultTemplate(ILaunchConfiguration configuration, IScopeContext scope) throws CoreException;
/**
- * Returns the template for this launch configuration type in the specified scope
- * or <code>null</code> if no template has been set for the scope.
+ * Returns the default template for this launch configuration type in the specified scope
+ * or <code>null</code> if no default template has been set for the scope.
*
* @param scope scope
- * @return template for the scope or <code>null</code>
- * @throws CoreException if unable to retrieve the template for the scope
+ * @return default template for the scope or <code>null</code>
+ * @throws CoreException if unable to retrieve the default template for the scope
* @since 3.6
*/
- public ILaunchConfiguration getTemplate(IScopeContext scope) throws CoreException;
+ public ILaunchConfiguration getDefaultTemplate(IScopeContext scope) throws CoreException;
+
+ /**
+ * Resolves and returns the first default template found in the given canonical scope order
+ * or <code>null</code> if none.
+ *
+ * @param scopes context objects to determine which scopes are searched
+ * for a default launch configuration template
+ * @return default template found in the given canonical scope order
+ * or <code>null</code> if none
+ * @exception CoreException if an exception occurs retrieving a default template
+ * @since 3.6
+ */
+ public ILaunchConfiguration resolveDefaultTemplate(IScopeContext[] scopes) throws CoreException;
/**
* Returns all launch configuration templates of the this type, possibly
@@ -345,7 +358,7 @@ public interface ILaunchConfigurationType extends IAdaptable {
/**
* Returns a new launch configuration working copy of this type,
* that resides in the specified container, with the given name, initialized
- * with values in the first template found in the given canonical scope order.
+ * with values from the first default template found in the given canonical scope order.
* When <code>container</code> is </code>null</code>, the configuration
* will reside locally in the metadata area.
* Note: a launch configuration is not actually created until the working copy is saved.
@@ -355,7 +368,7 @@ public interface ILaunchConfigurationType extends IAdaptable {
* locally with the metadata.
* @param name name for the launch configuration
* @param scopes optional context objects to determine which scopes are search
- * for a launch configuration template, or <code>null</code> if template scopes
+ * for a default launch configuration template, or <code>null</code> if template scopes
* should not be considered
* @return a new launch configuration working copy instance of this type
* @exception CoreException if an instance of this type
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationType.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationType.java
index f976c1466..e9fa9c9ed 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationType.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationType.java
@@ -503,7 +503,7 @@ public class LaunchConfigurationType extends PlatformObject implements ILaunchCo
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfigurationType#getTemplate(org.eclipse.core.runtime.preferences.IScopeContext)
*/
- public ILaunchConfiguration getTemplate(IScopeContext scope) throws CoreException {
+ public ILaunchConfiguration getDefaultTemplate(IScopeContext scope) throws CoreException {
IEclipsePreferences node = scope.getNode(DebugPlugin.getUniqueIdentifier());
try {
if (node.nodeExists(TEMPLATES_NODE)) {
@@ -538,7 +538,10 @@ public class LaunchConfigurationType extends PlatformObject implements ILaunchCo
* @see org.eclipse.debug.core.ILaunchConfigurationType#newInstance(org.eclipse.core.resources.IContainer, java.lang.String, org.eclipse.core.runtime.preferences.IScopeContext[])
*/
public ILaunchConfigurationWorkingCopy newInstance(IContainer container, String name, IScopeContext[] scopes) throws CoreException {
- ILaunchConfiguration template = findTemplate(scopes);
+ ILaunchConfiguration template = null;
+ if (scopes != null) {
+ template = resolveDefaultTemplate(scopes);
+ }
ILaunchConfigurationWorkingCopy wc = new LaunchConfigurationWorkingCopy(container, name, this);
if (template != null) {
wc.copyAttributes(template);
@@ -546,30 +549,11 @@ public class LaunchConfigurationType extends PlatformObject implements ILaunchCo
}
return wc;
}
-
- /**
- * Returns the first template found in the given scopes or <code>null</code> if none.
- *
- * @param contexts scopes to search in or <code>null</code>
- * @return template or <code>null</code>
- * @throws CoreException if unable to retrieve template
- */
- private ILaunchConfiguration findTemplate(IScopeContext[] contexts) throws CoreException {
- if (contexts != null) {
- for (int i = 0; i < contexts.length; i++) {
- ILaunchConfiguration template = getTemplate(contexts[i]);
- if (template != null) {
- return template;
- }
- }
- }
- return null;
- }
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfigurationType#setTemplate(org.eclipse.debug.core.ILaunchConfiguration, org.eclipse.core.runtime.preferences.IScopeContext)
*/
- public void setTemplate(ILaunchConfiguration configuration, IScopeContext scope) throws CoreException {
+ public void setDefaultTemplate(ILaunchConfiguration configuration, IScopeContext scope) throws CoreException {
IEclipsePreferences node = scope.getNode(DebugPlugin.getUniqueIdentifier());
Preferences templates = node.node(TEMPLATES_NODE);
if (configuration == null) {
@@ -591,5 +575,18 @@ public class LaunchConfigurationType extends PlatformObject implements ILaunchCo
}
}
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.core.ILaunchConfigurationType#resolveDefaultTemplate(org.eclipse.core.runtime.preferences.IScopeContext[])
+ */
+ public ILaunchConfiguration resolveDefaultTemplate(IScopeContext[] scopes) throws CoreException {
+ for (int i = 0; i < scopes.length; i++) {
+ ILaunchConfiguration template = getDefaultTemplate(scopes[i]);
+ if (template != null) {
+ return template;
+ }
+ }
+ return null;
+ }
+
}

Back to the top