1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Bug 279473: Custom C/C++ Debuggers need a way to add their source containers to the preference page "C/C++, Debug, Common Source Lookup Path".

This commit is contained in:
Mikhail Khodjaiants 2009-07-15 15:32:05 +00:00
parent 3d7ad1a899
commit d76cfab002
4 changed files with 151 additions and 12 deletions

View file

@ -11,6 +11,7 @@
# Ken Ryall (Nokia) - Added support for breakpoint problems( 170027 )
# Ken Ryall (Nokia) - Added support for Breakpoint Actions ( 118308 )
# IBM Corporation
# Texas Instruments - added extension point for source container type (279473)
###############################################################################
pluginName=C/C++ Development Tools Debug Model
providerName=Eclipse CDT
@ -21,6 +22,7 @@ PostMortemLaunch.name=C/C++ Postmortem Debugger
CDebugger.name=C/C++ Development Tools Core Debugger Extension
BreakpointAction.name=Breakpoint Action Extension
SupportedSourceContainerTypes.name=C/C++ Supported Source Container Types Extension
cLineBreakpoints.name=C/C++ Line Breakpoints
cAddressBreakpoints.name=C/C++ Address Breakpoints

View file

@ -5,6 +5,7 @@
<extension-point id="CDebugger" name="%CDebugger.name" schema="schema/CDebugger.exsd"/>
<extension-point id="BreakpointActionType" name="%BreakpointAction" schema="schema/BreakpointAction.exsd"/>
<extension-point id="BreakpointExtension" name="%BreakpointAction" schema="schema/BreakpointExtension.exsd"/>
<extension-point id="supportedSourceContainerTypes" name="%SupportedSourceContainerTypes.name" schema="schema/SupportedSourceContainerTypes.exsd"/>
<extension
point="org.eclipse.debug.core.launchConfigurationTypes">
@ -256,5 +257,20 @@
markerType="org.eclipse.cdt.debug.core.cBreakpointMarker">
</breakpointExtension>
</extension>
<extension
point="org.eclipse.cdt.debug.core.supportedSourceContainerTypes">
<sourceContainer
id="org.eclipse.cdt.debug.core.containerType.absolutePath"/>
<sourceContainer
id="org.eclipse.cdt.debug.core.containerType.mapping"/>
<sourceContainer
id="org.eclipse.debug.core.containerType.folder"/>
<sourceContainer
id="org.eclipse.debug.core.containerType.workspace"/>
<sourceContainer
id="org.eclipse.debug.core.containerType.directory"/>
<sourceContainer
id="org.eclipse.debug.core.containerType.project"/>
</extension>
</plugin>

View file

@ -0,0 +1,105 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.eclipse.cdt.debug.core" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appInfo>
<meta.schema plugin="org.eclipse.cdt.debug.core" id="supportedSourceContainerTypes" name="C/C++ Supported Source Container Types Extension"/>
</appInfo>
<documentation>
The extension point provides a mechanism for contributing source container types to the preference page &quot;C/C++, Debug,Common Source Lookup Path&quot;.
</documentation>
</annotation>
<element name="extension">
<annotation>
<appInfo>
<meta.element />
</appInfo>
</annotation>
<complexType>
<sequence minOccurs="1" maxOccurs="unbounded">
<element ref="sourceContainer" 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="sourceContainer">
<complexType>
<attribute name="id" type="string" use="required">
<annotation>
<documentation>
Value of this attribute must be a contribution to the extension point &quot;org.eclipse.debug.core.sourceContainerTypes&quot;.
</documentation>
<appInfo>
<meta.attribute kind="identifier"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appInfo>
<meta.section type="examples"/>
</appInfo>
<documentation>
In the above example, C debugger specifies that it supports absolutePath contaner type.
&lt;pre&gt;
&lt;extension
point=&quot;org.eclipse.cdt.debug.core.supportedSourceContainerTypes&quot;&gt;
&lt;sourceContainer
id=&quot;org.eclipse.cdt.debug.core.containerType.absolutePath&quot;/&gt;
&lt;/extension&gt;
&lt;/pre&gt;
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="apiinfo"/>
</appInfo>
<documentation>
Value of the attribute id must be a contribution to the extension point &quot;org.eclipse.debug.core.sourceContainerTypes&quot;.
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="copyright"/>
</appInfo>
<documentation>
Copyright (c) 2009 Texas Instruments 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
</documentation>
</annotation>
</schema>

View file

@ -8,6 +8,7 @@
* Contributors:
* QNX Software Systems - Initial API and implementation
* Nokia - Added support for AbsoluteSourceContainer( 159833 )
* Texas Instruments - added extension point for source container type (279473)
*******************************************************************************/
package org.eclipse.cdt.debug.internal.core.sourcelookup;
@ -15,6 +16,7 @@ import java.io.File;
import java.util.HashSet;
import java.util.Set;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
import org.eclipse.cdt.debug.core.sourcelookup.AbsolutePathSourceContainer;
import org.eclipse.cdt.debug.core.sourcelookup.MappingSourceContainer;
@ -22,8 +24,12 @@ import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector;
import org.eclipse.debug.core.sourcelookup.ISourceContainer;
import org.eclipse.debug.core.sourcelookup.ISourceContainerType;
@ -31,7 +37,6 @@ import org.eclipse.debug.core.sourcelookup.ISourceLookupParticipant;
import org.eclipse.debug.core.sourcelookup.containers.DirectorySourceContainer;
import org.eclipse.debug.core.sourcelookup.containers.FolderSourceContainer;
import org.eclipse.debug.core.sourcelookup.containers.ProjectSourceContainer;
import org.eclipse.debug.core.sourcelookup.containers.WorkspaceSourceContainer;
/**
* C/C++ source lookup director.
@ -39,16 +44,7 @@ import org.eclipse.debug.core.sourcelookup.containers.WorkspaceSourceContainer;
public class CSourceLookupDirector extends AbstractSourceLookupDirector {
private static Set<String> fSupportedTypes;
static {
fSupportedTypes = new HashSet<String>();
fSupportedTypes.add( WorkspaceSourceContainer.TYPE_ID );
fSupportedTypes.add( ProjectSourceContainer.TYPE_ID );
fSupportedTypes.add( FolderSourceContainer.TYPE_ID );
fSupportedTypes.add( DirectorySourceContainer.TYPE_ID );
fSupportedTypes.add( MappingSourceContainer.TYPE_ID );
fSupportedTypes.add( AbsolutePathSourceContainer.TYPE_ID );
}
private static Object fSupportedTypesLock = new Object();
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceLookupDirector#initializeParticipants()
@ -60,6 +56,7 @@ public class CSourceLookupDirector extends AbstractSourceLookupDirector {
* @see org.eclipse.debug.core.sourcelookup.ISourceLookupDirector#supportsSourceContainerType(org.eclipse.debug.core.sourcelookup.ISourceContainerType)
*/
public boolean supportsSourceContainerType( ISourceContainerType type ) {
readSupportedContainerTypes();
return fSupportedTypes.contains( type.getId() );
}
@ -192,4 +189,23 @@ public class CSourceLookupDirector extends AbstractSourceLookupDirector {
}
return path;
}
// >> Bugzilla 279473
private void readSupportedContainerTypes() {
synchronized (fSupportedTypesLock) {
if( fSupportedTypes == null) {
fSupportedTypes = new HashSet<String>();
String name = CDebugCorePlugin.PLUGIN_ID+".supportedSourceContainerTypes"; //$NON-NLS-1$;
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint( name);
if( extensionPoint != null)
for( IExtension extension : extensionPoint.getExtensions())
for( IConfigurationElement configurationElements : extension.getConfigurationElements()) {
String id = configurationElements.getAttribute("id");//$NON-NLS-1$;
if( id != null)
fSupportedTypes.add(id);
}
}
}
}
// << Bugzilla 279473
}