From d76cfab002243bacb4e45ea6c41dbae5759a1561 Mon Sep 17 00:00:00 2001 From: Mikhail Khodjaiants Date: Wed, 15 Jul 2009 15:32:05 +0000 Subject: [PATCH] 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". --- .../plugin.properties | 2 + debug/org.eclipse.cdt.debug.core/plugin.xml | 16 +++ .../schema/SupportedSourceContainerTypes.exsd | 105 ++++++++++++++++++ .../sourcelookup/CSourceLookupDirector.java | 40 +++++-- 4 files changed, 151 insertions(+), 12 deletions(-) create mode 100644 debug/org.eclipse.cdt.debug.core/schema/SupportedSourceContainerTypes.exsd diff --git a/debug/org.eclipse.cdt.debug.core/plugin.properties b/debug/org.eclipse.cdt.debug.core/plugin.properties index 5131be6d796..fff2ac69084 100644 --- a/debug/org.eclipse.cdt.debug.core/plugin.properties +++ b/debug/org.eclipse.cdt.debug.core/plugin.properties @@ -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 diff --git a/debug/org.eclipse.cdt.debug.core/plugin.xml b/debug/org.eclipse.cdt.debug.core/plugin.xml index 158c37b6dd5..7eddf760880 100644 --- a/debug/org.eclipse.cdt.debug.core/plugin.xml +++ b/debug/org.eclipse.cdt.debug.core/plugin.xml @@ -5,6 +5,7 @@ + @@ -256,5 +257,20 @@ markerType="org.eclipse.cdt.debug.core.cBreakpointMarker"> + + + + + + + + diff --git a/debug/org.eclipse.cdt.debug.core/schema/SupportedSourceContainerTypes.exsd b/debug/org.eclipse.cdt.debug.core/schema/SupportedSourceContainerTypes.exsd new file mode 100644 index 00000000000..d10dfe303d1 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.core/schema/SupportedSourceContainerTypes.exsd @@ -0,0 +1,105 @@ + + + + + + + + + The extension point provides a mechanism for contributing source container types to the preference page "C/C++, Debug,Common Source Lookup Path". + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Value of this attribute must be a contribution to the extension point "org.eclipse.debug.core.sourceContainerTypes". + + + + + + + + + + + + + + + + In the above example, C debugger specifies that it supports absolutePath contaner type. +<pre> + <extension + point="org.eclipse.cdt.debug.core.supportedSourceContainerTypes"> + <sourceContainer + id="org.eclipse.cdt.debug.core.containerType.absolutePath"/> + </extension> +</pre> + + + + + + + + + Value of the attribute id must be a contribution to the extension point "org.eclipse.debug.core.sourceContainerTypes". + + + + + + + + + + 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 + + + + diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceLookupDirector.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceLookupDirector.java index f7957c02c94..2c7fa5cc3d8 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceLookupDirector.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceLookupDirector.java @@ -7,7 +7,8 @@ * * Contributors: * QNX Software Systems - Initial API and implementation - * Nokia - Added support for AbsoluteSourceContainer( 159833 ) + * 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 fSupportedTypes; - - static { - fSupportedTypes = new HashSet(); - 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 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 }