Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--launch/org.eclipse.cdt.launch/plugin.xml1
-rw-r--r--launch/org.eclipse.cdt.launch/schema/launchConfigAffinity.exsd107
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/LaunchConfigAffinityExtensionPoint.java43
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/refactoring/ResourceRenameParticipant.java11
4 files changed, 160 insertions, 2 deletions
diff --git a/launch/org.eclipse.cdt.launch/plugin.xml b/launch/org.eclipse.cdt.launch/plugin.xml
index cd7d9fde661..871c0094320 100644
--- a/launch/org.eclipse.cdt.launch/plugin.xml
+++ b/launch/org.eclipse.cdt.launch/plugin.xml
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<plugin>
+ <extension-point id="launchConfigAffinity" name="CDT Launch Config Affinity" schema="schema/launchConfigAffinity.exsd"/>
<extension
point="org.eclipse.debug.core.launchDelegates">
diff --git a/launch/org.eclipse.cdt.launch/schema/launchConfigAffinity.exsd b/launch/org.eclipse.cdt.launch/schema/launchConfigAffinity.exsd
new file mode 100644
index 00000000000..1cc9274219d
--- /dev/null
+++ b/launch/org.eclipse.cdt.launch/schema/launchConfigAffinity.exsd
@@ -0,0 +1,107 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.cdt.launch" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.cdt.launch" id="launchConfigAffinity" name="CDT Launch Config Affinity"/>
+ </appInfo>
+ <documentation>
+ CDT adopters can extend this extension point to declare that their launch configurations are CDT-ish. CDT features that manipulate CDT launch configurations in a generic enough way to make them equally applicable to third-party solutions will look at this extension point to see what additional configurations to operate on.
+
+Adopters that contribute launch configurations that are vastly different from the standard CDT ones should not declare an affinity, as it&apos;s unlikely CDT features would know what to do with them.
+
+One feature that uses this extension point (as a consumer) is CDT&apos;s support for adjusting a launch configuration when the user renames the project.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence minOccurs="1" maxOccurs="unbounded">
+ <element ref="launchConfigTypeId" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="launchConfigTypeId">
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ launch configuration type ID
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ 7.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ &lt;extension
+ point=&quot;org.eclipse.cdt.launch.launchConfigAffinity&quot;&gt;
+ &lt;launchConfigTypeId id=&quot;com.acme.launchTypeAttach&quot;/&gt;
+ &lt;launchConfigTypeId id=&quot;com.acme.launchTypeCreateProcess&quot;/&gt;
+&lt;/extension&gt;
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiinfo"/>
+ </appInfo>
+ <documentation>
+ There is no API associated with this extension point.
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/LaunchConfigAffinityExtensionPoint.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/LaunchConfigAffinityExtensionPoint.java
new file mode 100644
index 00000000000..89872f4ceb3
--- /dev/null
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/LaunchConfigAffinityExtensionPoint.java
@@ -0,0 +1,43 @@
+package org.eclipse.cdt.launch.internal;
+
+import java.util.Collection;
+
+import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.Platform;
+
+/**
+ * Encapsulates logic to get the launchConfigAffinity extensions information.
+ * The extension point is very simple. Basically, it allows an extension to
+ * provide a collection of strings (launch configuration type IDs).
+ */
+public class LaunchConfigAffinityExtensionPoint {
+
+ static private final String EXTENSION_POINT_NAME = "launchConfigAffinity"; //$NON-NLS-1$
+ static private final String EXTENSION_ELEMENT_NAME = "launchConfigTypeId"; //$NON-NLS-1$
+ static private final String EXTENSION_ELEMENT_ATTR = "id"; //$NON-NLS-1$
+
+ /**
+ * Returns all launch configuration type IDs registered via the extension
+ * point.
+ *
+ * @param ids
+ * Caller provides the collection. We just add to it. We do not
+ * clear it. Caller can provide any type of collection.
+ */
+ static public <T extends Collection<String>> void getLaunchConfigTypeIds(T ids) {
+ IExtension[] extensions = Platform.getExtensionRegistry().getExtensionPoint(LaunchUIPlugin.PLUGIN_ID, EXTENSION_POINT_NAME).getExtensions();
+ for (IExtension extension : extensions) {
+ IConfigurationElement[] elements = extension.getConfigurationElements();
+ for (IConfigurationElement element : elements) {
+ if (element.getName().equals(EXTENSION_ELEMENT_NAME)) {
+ String id = element.getAttribute(EXTENSION_ELEMENT_ATTR);
+ if (id != null) {
+ ids.add(id);
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/refactoring/ResourceRenameParticipant.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/refactoring/ResourceRenameParticipant.java
index 4451ec320d8..343c35e1ef3 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/refactoring/ResourceRenameParticipant.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/refactoring/ResourceRenameParticipant.java
@@ -12,9 +12,11 @@
package org.eclipse.cdt.launch.internal.refactoring;
import java.util.Collection;
+import java.util.HashSet;
import java.util.Set;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
+import org.eclipse.cdt.launch.internal.LaunchConfigAffinityExtensionPoint;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
@@ -111,10 +113,15 @@ public class ResourceRenameParticipant extends RenameParticipant implements
static Collection<ILaunchConfigurationType> getCLaunchConfigTypes() {
Set<ILaunchConfigurationType> result = new java.util.HashSet<ILaunchConfigurationType>();
+ // Get launch config types registered by CDT adopters
+ Set<String> thirdPartyConfgTypeIds = new HashSet<String>(5);
+ LaunchConfigAffinityExtensionPoint.getLaunchConfigTypeIds(thirdPartyConfgTypeIds);
+
ILaunchManager mgr = DebugPlugin.getDefault().getLaunchManager();
for (ILaunchConfigurationType next : mgr.getLaunchConfigurationTypes()) {
- // is it a CDT launch type?
- if (next.getPluginIdentifier().startsWith("org.eclipse.cdt.")) { //$NON-NLS-1$
+ // is it a CDT launch type or a third party one that is CDT-ish?
+ if (next.getPluginIdentifier().startsWith("org.eclipse.cdt.") || //$NON-NLS-1$
+ thirdPartyConfgTypeIds.contains(next.getIdentifier())) {
result.add(next);
}
}

Back to the top