1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 01:36:01 +02:00

Fixed bug 181829. Debugger was not enforcing extension point schema. Also renamed 'breakpointActionPage' extension point to have an uppercase first letter, for consistency with all other CDT debugger extension points.

This commit is contained in:
John Cortell 2007-04-10 19:28:22 +00:00
parent 5cf3a081fb
commit 2ef0a88398
8 changed files with 580 additions and 570 deletions

View file

@ -77,7 +77,11 @@ public class CDebugCorePlugin extends Plugin {
*/
private BreakpointActionManager breakpointActionManager;
public static final String BREAKPOINT_ACTION_SIMPLE_ID = "BreakpointActionType"; //$NON-NLS-1$
public static final String CDEBUGGER_EXTENSION_POINT_ID = "CDebugger"; //$NON-NLS-1$
public static final String DEBUGGER_ELEMENT = "debugger"; //$NON-NLS-1$
public static final String BREAKPOINT_ACTION_EXTENSION_POINT_ID = "BreakpointActionType"; //$NON-NLS-1$
public static final String ACTION_TYPE_ELEMENT = "actionType"; //$NON-NLS-1$
/**
* Dummy source lookup director needed to manage common source containers.
@ -165,15 +169,17 @@ public class CDebugCorePlugin extends Plugin {
}
private void initializeDebugConfiguration() {
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint( getUniqueIdentifier(), "CDebugger" ); //$NON-NLS-1$
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint( getUniqueIdentifier(), CDEBUGGER_EXTENSION_POINT_ID ); //$NON-NLS-1$
IConfigurationElement[] infos = extensionPoint.getConfigurationElements();
fDebugConfigurations = new HashMap( infos.length );
for( int i = 0; i < infos.length; i++ ) {
IConfigurationElement configurationElement = infos[i];
if (configurationElement.getName().equals(DEBUGGER_ELEMENT)) {
DebugConfiguration configType = new DebugConfiguration( configurationElement );
fDebugConfigurations.put( configType.getID(), configType );
}
}
}
private void initializeActiveDebugConfigurations() {
fActiveDebugConfigurations = new HashSet( getDebugConfigurations().length );

View file

@ -65,14 +65,16 @@ public class BreakpointActionManager {
for (int i = 0; i < actionExtensions.length && action == null; i++) {
IConfigurationElement[] elements = actionExtensions[i].getConfigurationElements();
for (int j = 0; j < elements.length && action == null; j++) {
if (elements[j].getAttribute("class").equals(className)) { //$NON-NLS-1$
action = (IBreakpointAction) elements[j].createExecutableExtension("class"); //$NON-NLS-1$
IConfigurationElement element = elements[j];
if (element.getName().equals(CDebugCorePlugin.ACTION_TYPE_ELEMENT)) {
if (element.getAttribute("class").equals(className)) { //$NON-NLS-1$
action = (IBreakpointAction) element.createExecutableExtension("class"); //$NON-NLS-1$
action.setName(name);
CDebugCorePlugin.getDefault().getBreakpointActionManager().addAction(action);
}
}
}
}
} catch (CoreException e) {
e.printStackTrace();
@ -121,7 +123,7 @@ public class BreakpointActionManager {
public IExtension[] getBreakpointActionExtensions() {
if (breakpointActionExtensions == null) {
IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(CDebugCorePlugin.PLUGIN_ID, CDebugCorePlugin.BREAKPOINT_ACTION_SIMPLE_ID);
IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(CDebugCorePlugin.PLUGIN_ID, CDebugCorePlugin.BREAKPOINT_ACTION_EXTENSION_POINT_ID);
if (point == null)
breakpointActionExtensions = new IExtension[0];
else {

View file

@ -11,24 +11,21 @@
id="org.eclipse.cdt.debug.mi.core.CDebuggerNew"
modes="run,core,attach"
name="%GDBMIDebugger.name"
platform="*">
</debugger>
platform="*"/>
<debugger
platform="win32"
name="%CygwinGDBDebugger.name"
modes="run,core,attach"
cpu="native"
class="org.eclipse.cdt.debug.mi.core.CygwinGDBCDIDebugger2"
id="org.eclipse.cdt.debug.mi.core.CygwinCDebugger">
</debugger>
id="org.eclipse.cdt.debug.mi.core.CygwinCDebugger"/>
<debugger
platform="*"
name="%GDBServer.name"
modes="run"
cpu="*"
class="org.eclipse.cdt.debug.mi.core.GDBServerCDIDebugger2"
id="org.eclipse.cdt.debug.mi.core.GDBServerCDebugger">
</debugger>
id="org.eclipse.cdt.debug.mi.core.GDBServerCDebugger"/>
<debugger
class="org.eclipse.cdt.debug.mi.core.GDBCDIDebugger2"
cpu="native"

View file

@ -7,18 +7,15 @@
<debuggerPage
class="org.eclipse.cdt.debug.mi.internal.ui.GDBDebuggerPage"
debuggerID="org.eclipse.cdt.debug.mi.core.CDebugger"
id="org.eclipse.cdt.debug.mi.GDBDebuggerPage">
</debuggerPage>
id="org.eclipse.cdt.debug.mi.GDBDebuggerPage"/>
<debuggerPage
class="org.eclipse.cdt.debug.mi.internal.ui.CygwinDebuggerPage"
debuggerID="org.eclipse.cdt.debug.mi.core.CygwinCDebugger"
id="org.eclipse.cdt.debug.mi.CygwinDebuggerPage">
</debuggerPage>
id="org.eclipse.cdt.debug.mi.CygwinDebuggerPage"/>
<debuggerPage
class="org.eclipse.cdt.debug.mi.internal.ui.GDBServerDebuggerPage"
debuggerID="org.eclipse.cdt.debug.mi.core.GDBServerCDebugger"
id="org.eclipse.cdt.debug.mi.GDBServerDebuggerPage">
</debuggerPage>
id="org.eclipse.cdt.debug.mi.GDBServerDebuggerPage"/>
<debuggerPage
class="org.eclipse.cdt.debug.mi.internal.ui.StandardGDBDebuggerPage"
debuggerID="org.eclipse.cdt.debug.mi.core.CDebuggerNew"

View file

@ -3,7 +3,7 @@
<plugin>
<extension-point id="CDebuggerPage" name="%CDebuggerPage" schema="schema/CDebuggerPage.exsd"/>
<extension-point id="breakpointActionPage" name="%BreakpointActionPage" schema="schema/BreakpointActionPage.exsd"/>
<extension-point id="BreakpointActionPage" name="%BreakpointActionPage" schema="schema/BreakpointActionPage.exsd"/>
<!-- Extensions -->
<extension
@ -1315,68 +1315,58 @@
<actionType
name="%SoundAction.name"
class="org.eclipse.cdt.debug.ui.breakpointactions.SoundAction"
id="org.eclipse.cdt.debug.ui.breakpointactions.SoundAction">
</actionType>
id="org.eclipse.cdt.debug.ui.breakpointactions.SoundAction"/>
</extension>
<extension
point="org.eclipse.cdt.debug.core.BreakpointActionType">
<actionType
name="%LogAction.name"
class="org.eclipse.cdt.debug.ui.breakpointactions.LogAction"
id="org.eclipse.cdt.debug.ui.breakpointactions.LogAction">
</actionType>
id="org.eclipse.cdt.debug.ui.breakpointactions.LogAction"/>
</extension>
<extension
point="org.eclipse.cdt.debug.core.BreakpointActionType">
<actionType
name="%ResumeAction.name"
class="org.eclipse.cdt.debug.ui.breakpointactions.ResumeAction"
id="org.eclipse.cdt.debug.ui.breakpointactions.ResumeAction">
</actionType>
id="org.eclipse.cdt.debug.ui.breakpointactions.ResumeAction"/>
</extension>
<extension
<extension
point="org.eclipse.cdt.debug.core.BreakpointActionType">
<actionType
name="%ExternalToolAction.name"
class="org.eclipse.cdt.debug.ui.breakpointactions.ExternalToolAction"
id="org.eclipse.cdt.debug.ui.breakpointactions.ExternalToolAction">
</actionType>
id="org.eclipse.cdt.debug.ui.breakpointactions.ExternalToolAction"/>
</extension>
<extension
point="org.eclipse.cdt.debug.ui.breakpointActionPage">
point="org.eclipse.cdt.debug.ui.BreakpointActionPage">
<actionPage
class="org.eclipse.cdt.debug.ui.breakpointactions.SoundActionPage"
id="org.eclipse.cdt.debug.ui.breakpointactions.SoundActionPage"
actionType="org.eclipse.cdt.debug.ui.breakpointactions.SoundAction">
</actionPage>
actionType="org.eclipse.cdt.debug.ui.breakpointactions.SoundAction"/>
</extension>
<extension
point="org.eclipse.cdt.debug.ui.breakpointActionPage">
point="org.eclipse.cdt.debug.ui.BreakpointActionPage">
<actionPage
class="org.eclipse.cdt.debug.ui.breakpointactions.LogActionPage"
id="org.eclipse.cdt.debug.ui.breakpointactions.LogActionPage"
actionType="org.eclipse.cdt.debug.ui.breakpointactions.LogAction">
</actionPage>
actionType="org.eclipse.cdt.debug.ui.breakpointactions.LogAction"/>
</extension>
<extension
point="org.eclipse.cdt.debug.ui.breakpointActionPage">
point="org.eclipse.cdt.debug.ui.BreakpointActionPage">
<actionPage
class="org.eclipse.cdt.debug.ui.breakpointactions.ResumeActionPage"
id="org.eclipse.cdt.debug.ui.breakpointactions.ResumeActionPage"
actionType="org.eclipse.cdt.debug.ui.breakpointactions.ResumeAction">
</actionPage>
actionType="org.eclipse.cdt.debug.ui.breakpointactions.ResumeAction"/>
</extension>
<extension
point="org.eclipse.cdt.debug.ui.breakpointActionPage">
point="org.eclipse.cdt.debug.ui.BreakpointActionPage">
<actionPage
class="org.eclipse.cdt.debug.ui.breakpointactions.ExternalToolActionPage"
id="org.eclipse.cdt.debug.ui.breakpointactions.ExternalToolActionPage"
actionType="org.eclipse.cdt.debug.ui.breakpointactions.ExternalToolAction">
</actionPage>
actionType="org.eclipse.cdt.debug.ui.breakpointactions.ExternalToolAction"/>
</extension>
<extension
point="org.eclipse.ui.startup">

View file

@ -3,7 +3,7 @@
<schema targetNamespace="org.eclipse.cdt.debug.ui">
<annotation>
<appInfo>
<meta.schema plugin="org.eclipse.cdt.debug.ui" id="breakpointActionPage" name="Breakpoint Action UI Page"/>
<meta.schema plugin="org.eclipse.cdt.debug.ui" id="BreakpointActionPage" name="Breakpoint Action UI Page"/>
</appInfo>
<documentation>
This extension point provides a mechanism for contributing UI to define and edit a breakpoint action.

View file

@ -65,6 +65,9 @@ public class CDebugUIPlugin extends AbstractUIPlugin {
*/
public static final String PLUGIN_ID = "org.eclipse.cdt.debug.ui"; //$NON-NLS-1$
public static final String CDEBUGGER_PAGE_EXTENSION_POINT_ID = "CDebuggerPage";
public static final String DEBUGGER_PAGE_ELEMENT = "debuggerPage";
//The shared instance.
private static CDebugUIPlugin plugin;
@ -173,11 +176,16 @@ public class CDebugUIPlugin extends AbstractUIPlugin {
protected void initializeDebuggerPageMap() {
fDebuggerPageMap = new HashMap( 10 );
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint( PLUGIN_ID, "CDebuggerPage" ); //$NON-NLS-1$
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint( PLUGIN_ID, CDEBUGGER_PAGE_EXTENSION_POINT_ID ); //$NON-NLS-1$
IConfigurationElement[] infos = extensionPoint.getConfigurationElements();
for( int i = 0; i < infos.length; i++ ) {
String id = infos[i].getAttribute( "debuggerID" ); //$NON-NLS-1$
fDebuggerPageMap.put( id, infos[i] );
IConfigurationElement info = infos[i];
if (info.getName().equals(DEBUGGER_PAGE_ELEMENT)) {
String id = info.getAttribute( "debuggerID" ); //$NON-NLS-1$
if (id != null) {
fDebuggerPageMap.put( id, info );
}
}
}
}

View file

@ -36,7 +36,9 @@ import org.eclipse.swt.widgets.Text;
public class ActionDialog extends Dialog {
public static final String BREAKPOINT_ACTION_PAGE_SIMPLE_ID = "breakpointActionPage"; //$NON-NLS-1$
public static final String BREAKPOINT_ACTION_PAGE_EXTENSION_POINT_ID = "BreakpointActionPage"; //$NON-NLS-1$
public static final String ACTION_PAGE_ELEMENT = "actionPage"; //$NON-NLS-1$
private static final String ACTION_DIALOG_LAST_SELECTED = "ActionDialog.lastSelectedAction"; //$NON-NLS-1$
@ -141,12 +143,15 @@ public class ActionDialog extends Dialog {
for (int i = 0; i < actionExtensions.length; i++) {
IConfigurationElement[] elements = actionExtensions[i].getConfigurationElements();
for (int j = 0; j < elements.length; j++) {
String actionTypeName = elements[j].getAttribute("name"); //$NON-NLS-1$
IConfigurationElement element = elements[j];
if (element.getName().equals(CDebugCorePlugin.ACTION_TYPE_ELEMENT)) {
String actionTypeName = element.getAttribute("name"); //$NON-NLS-1$
combo.add(actionTypeName);
if (actionTypeName.equals(lastTypeName))
lastSelectedActionTypeIndex = i;
}
}
}
combo.select(lastSelectedActionTypeIndex);
if (originalAction != null)
@ -210,11 +215,14 @@ public class ActionDialog extends Dialog {
for (int i = 0; i < actionExtensions.length && selectedElement == null; i++) {
IConfigurationElement[] elements = actionExtensions[i].getConfigurationElements();
for (int j = 0; j < elements.length && selectedElement == null; j++) {
IConfigurationElement element = elements[j];
if (element.getName().equals(CDebugCorePlugin.ACTION_TYPE_ELEMENT)) {
if (elementCount == selectedTypeIndex)
selectedElement = elements[j];
selectedElement = element;
elementCount++;
}
}
}
breakpointAction = (IBreakpointAction) selectedElement.createExecutableExtension("class"); //$NON-NLS-1$
breakpointAction.setName(breakpointAction.getDefaultName());
@ -239,7 +247,7 @@ public class ActionDialog extends Dialog {
public IExtension[] getBreakpointActionPageExtensions() {
if (breakpointActionPageExtensions == null) {
IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(CDebugUIPlugin.PLUGIN_ID, BREAKPOINT_ACTION_PAGE_SIMPLE_ID);
IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(CDebugUIPlugin.PLUGIN_ID, BREAKPOINT_ACTION_PAGE_EXTENSION_POINT_ID);
if (point == null)
breakpointActionPageExtensions = new IExtension[0];
else {
@ -259,9 +267,11 @@ public class ActionDialog extends Dialog {
for (int i = 0; i < actionExtensions.length && actionPageResult == null; i++) {
IConfigurationElement[] elements = actionExtensions[i].getConfigurationElements();
for (int j = 0; j < elements.length && actionPageResult == null; j++) {
if (elements[j].getAttribute("actionType").equals(breakpointAction.getIdentifier())) { //$NON-NLS-1$
actionPageResult = (IBreakpointActionPage) elements[j].createExecutableExtension("class"); //$NON-NLS-1$
IConfigurationElement element = elements[j];
if (element.getName().equals(ACTION_PAGE_ELEMENT)) {
if (element.getAttribute("actionType").equals(breakpointAction.getIdentifier())) { //$NON-NLS-1$
actionPageResult = (IBreakpointActionPage) element.createExecutableExtension("class"); //$NON-NLS-1$
}
}
}
}