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

@ -76,8 +76,12 @@ public class CDebugCorePlugin extends Plugin {
* Breakpoint action manager. * Breakpoint action manager.
*/ */
private BreakpointActionManager breakpointActionManager; private BreakpointActionManager breakpointActionManager;
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_SIMPLE_ID = "BreakpointActionType"; //$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. * Dummy source lookup director needed to manage common source containers.
@ -165,13 +169,15 @@ public class CDebugCorePlugin extends Plugin {
} }
private void initializeDebugConfiguration() { 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(); IConfigurationElement[] infos = extensionPoint.getConfigurationElements();
fDebugConfigurations = new HashMap( infos.length ); fDebugConfigurations = new HashMap( infos.length );
for( int i = 0; i < infos.length; i++ ) { for( int i = 0; i < infos.length; i++ ) {
IConfigurationElement configurationElement = infos[i]; IConfigurationElement configurationElement = infos[i];
DebugConfiguration configType = new DebugConfiguration( configurationElement ); if (configurationElement.getName().equals(DEBUGGER_ELEMENT)) {
fDebugConfigurations.put( configType.getID(), configType ); DebugConfiguration configType = new DebugConfiguration( configurationElement );
fDebugConfigurations.put( configType.getID(), configType );
}
} }
} }

View file

@ -1,247 +1,249 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007 Nokia and others. * Copyright (c) 2007 Nokia and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* Nokia - initial API and implementation * Nokia - initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.debug.core.breakpointactions; package org.eclipse.cdt.debug.core.breakpointactions;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.StringReader; import java.io.StringReader;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.OutputKeys; import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer; import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory; import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource; import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamResult;
import org.eclipse.cdt.debug.core.CDebugCorePlugin; import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension; import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint; import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Platform;
import org.eclipse.debug.core.model.IBreakpoint; import org.eclipse.debug.core.model.IBreakpoint;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import org.w3c.dom.NodeList; import org.w3c.dom.NodeList;
import org.xml.sax.InputSource; import org.xml.sax.InputSource;
import org.xml.sax.helpers.DefaultHandler; import org.xml.sax.helpers.DefaultHandler;
public class BreakpointActionManager { public class BreakpointActionManager {
public static final String BREAKPOINT_ACTION_ATTRIBUTE = "BREAKPOINT_ACTIONS"; //$NON-NLS-1$ public static final String BREAKPOINT_ACTION_ATTRIBUTE = "BREAKPOINT_ACTIONS"; //$NON-NLS-1$
private static final String BREAKPOINT_ACTION_DATA = "BreakpointActionManager.actionData"; //$NON-NLS-1$ private static final String BREAKPOINT_ACTION_DATA = "BreakpointActionManager.actionData"; //$NON-NLS-1$
private IExtension[] breakpointActionExtensions = null; private IExtension[] breakpointActionExtensions = null;
private ArrayList breakpointActions = null; private ArrayList breakpointActions = null;
public BreakpointActionManager() { public BreakpointActionManager() {
} }
public void addAction(IBreakpointAction action) { public void addAction(IBreakpointAction action) {
getBreakpointActions().add(action); getBreakpointActions().add(action);
} }
private IBreakpointAction createActionFromClassName(String name, String className) { private IBreakpointAction createActionFromClassName(String name, String className) {
IBreakpointAction action = null; IBreakpointAction action = null;
IExtension[] actionExtensions = CDebugCorePlugin.getDefault().getBreakpointActionManager().getBreakpointActionExtensions(); IExtension[] actionExtensions = CDebugCorePlugin.getDefault().getBreakpointActionManager().getBreakpointActionExtensions();
try { try {
for (int i = 0; i < actionExtensions.length && action == null; i++) { for (int i = 0; i < actionExtensions.length && action == null; i++) {
IConfigurationElement[] elements = actionExtensions[i].getConfigurationElements(); IConfigurationElement[] elements = actionExtensions[i].getConfigurationElements();
for (int j = 0; j < elements.length && action == null; j++) { for (int j = 0; j < elements.length && action == null; j++) {
IConfigurationElement element = elements[j];
if (elements[j].getAttribute("class").equals(className)) { //$NON-NLS-1$ if (element.getName().equals(CDebugCorePlugin.ACTION_TYPE_ELEMENT)) {
action = (IBreakpointAction) elements[j].createExecutableExtension("class"); //$NON-NLS-1$ if (element.getAttribute("class").equals(className)) { //$NON-NLS-1$
action.setName(name); action = (IBreakpointAction) element.createExecutableExtension("class"); //$NON-NLS-1$
CDebugCorePlugin.getDefault().getBreakpointActionManager().addAction(action); action.setName(name);
} CDebugCorePlugin.getDefault().getBreakpointActionManager().addAction(action);
} }
} }
}
} catch (CoreException e) { }
e.printStackTrace();
} } catch (CoreException e) {
e.printStackTrace();
return action; }
}
return action;
public void deleteAction(IBreakpointAction action) { }
getBreakpointActions().remove(action);
} public void deleteAction(IBreakpointAction action) {
getBreakpointActions().remove(action);
public boolean breakpointHasActions(IBreakpoint breakpoint) { }
if (breakpoint != null) {
IMarker marker = breakpoint.getMarker(); public boolean breakpointHasActions(IBreakpoint breakpoint) {
String actionNames = marker.getAttribute(BREAKPOINT_ACTION_ATTRIBUTE, ""); //$NON-NLS-1$ if (breakpoint != null) {
return actionNames.length() > 0; IMarker marker = breakpoint.getMarker();
} String actionNames = marker.getAttribute(BREAKPOINT_ACTION_ATTRIBUTE, ""); //$NON-NLS-1$
return false; return actionNames.length() > 0;
} }
return false;
public void executeActions(IBreakpoint breakpoint, IAdaptable context) { }
if (breakpoint != null) { public void executeActions(IBreakpoint breakpoint, IAdaptable context) {
IMarker marker = breakpoint.getMarker();
String actionNames = marker.getAttribute(BREAKPOINT_ACTION_ATTRIBUTE, ""); //$NON-NLS-1$ if (breakpoint != null) {
StringTokenizer tok = new StringTokenizer(actionNames, ","); //$NON-NLS-1$ IMarker marker = breakpoint.getMarker();
while (tok.hasMoreTokens()) { String actionNames = marker.getAttribute(BREAKPOINT_ACTION_ATTRIBUTE, ""); //$NON-NLS-1$
String actionName = tok.nextToken(); StringTokenizer tok = new StringTokenizer(actionNames, ","); //$NON-NLS-1$
IBreakpointAction action = findBreakpointAction(actionName); while (tok.hasMoreTokens()) {
if (action != null) { String actionName = tok.nextToken();
action.execute(breakpoint, context); IBreakpointAction action = findBreakpointAction(actionName);
} if (action != null) {
} action.execute(breakpoint, context);
} }
} }
}
public IBreakpointAction findBreakpointAction(String name) { }
for (Iterator iter = getBreakpointActions().iterator(); iter.hasNext();) {
IBreakpointAction action = (IBreakpointAction) iter.next(); public IBreakpointAction findBreakpointAction(String name) {
if (action.getName().equals(name)) for (Iterator iter = getBreakpointActions().iterator(); iter.hasNext();) {
return action; IBreakpointAction action = (IBreakpointAction) iter.next();
} if (action.getName().equals(name))
return null; return action;
} }
return null;
public IExtension[] getBreakpointActionExtensions() { }
if (breakpointActionExtensions == null) {
IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(CDebugCorePlugin.PLUGIN_ID, CDebugCorePlugin.BREAKPOINT_ACTION_SIMPLE_ID); public IExtension[] getBreakpointActionExtensions() {
if (point == null) if (breakpointActionExtensions == null) {
breakpointActionExtensions = new IExtension[0]; IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(CDebugCorePlugin.PLUGIN_ID, CDebugCorePlugin.BREAKPOINT_ACTION_EXTENSION_POINT_ID);
else { if (point == null)
breakpointActionExtensions = point.getExtensions(); breakpointActionExtensions = new IExtension[0];
} else {
} breakpointActionExtensions = point.getExtensions();
}
return breakpointActionExtensions; }
}
return breakpointActionExtensions;
public ArrayList getBreakpointActions() { }
if (breakpointActions == null) {
breakpointActions = new ArrayList(); public ArrayList getBreakpointActions() {
CDebugCorePlugin.getDefault().getBreakpointActionManager().loadActionData(); if (breakpointActions == null) {
} breakpointActions = new ArrayList();
return breakpointActions; CDebugCorePlugin.getDefault().getBreakpointActionManager().loadActionData();
} }
return breakpointActions;
private void loadActionData() { }
String actionData = CDebugCorePlugin.getDefault().getPluginPreferences().getString(BREAKPOINT_ACTION_DATA); private void loadActionData() {
if (actionData == null || actionData.length() == 0) String actionData = CDebugCorePlugin.getDefault().getPluginPreferences().getString(BREAKPOINT_ACTION_DATA);
return;
if (actionData == null || actionData.length() == 0)
Element root = null; return;
DocumentBuilder parser;
try { Element root = null;
parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); DocumentBuilder parser;
parser.setErrorHandler(new DefaultHandler()); try {
root = parser.parse(new InputSource(new StringReader(actionData))).getDocumentElement(); parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
parser.setErrorHandler(new DefaultHandler());
NodeList nodeList = root.getChildNodes(); root = parser.parse(new InputSource(new StringReader(actionData))).getDocumentElement();
int entryCount = nodeList.getLength();
NodeList nodeList = root.getChildNodes();
for (int i = 0; i < entryCount; i++) { int entryCount = nodeList.getLength();
Node node = nodeList.item(i);
short type = node.getNodeType(); for (int i = 0; i < entryCount; i++) {
if (type == Node.ELEMENT_NODE) { Node node = nodeList.item(i);
Element subElement = (Element) node; short type = node.getNodeType();
String nodeName = subElement.getNodeName(); if (type == Node.ELEMENT_NODE) {
if (nodeName.equalsIgnoreCase("actionEntry")) { //$NON-NLS-1$ Element subElement = (Element) node;
String name = subElement.getAttribute("name"); //$NON-NLS-1$ String nodeName = subElement.getNodeName();
if (name == null) if (nodeName.equalsIgnoreCase("actionEntry")) { //$NON-NLS-1$
throw new Exception(); String name = subElement.getAttribute("name"); //$NON-NLS-1$
String value = subElement.getAttribute("value"); //$NON-NLS-1$ if (name == null)
if (value == null) throw new Exception();
throw new Exception(); String value = subElement.getAttribute("value"); //$NON-NLS-1$
String className = subElement.getAttribute("class"); //$NON-NLS-1$ if (value == null)
if (className == null) throw new Exception();
throw new Exception(); String className = subElement.getAttribute("class"); //$NON-NLS-1$
if (className == null)
IBreakpointAction action = createActionFromClassName(name, className); throw new Exception();
action.initializeFromMemento(value);
} IBreakpointAction action = createActionFromClassName(name, className);
} action.initializeFromMemento(value);
} }
}
} catch (Exception e) { }
e.printStackTrace();
} } catch (Exception e) {
} e.printStackTrace();
}
public String makeUniqueActionName(String defaultName) { }
String result = defaultName;
IBreakpointAction action = findBreakpointAction(defaultName); public String makeUniqueActionName(String defaultName) {
int actionCount = 1; String result = defaultName;
while (action != null) { IBreakpointAction action = findBreakpointAction(defaultName);
result = defaultName + "(" + actionCount + ")"; //$NON-NLS-1$ //$NON-NLS-2$ int actionCount = 1;
action = findBreakpointAction(result); while (action != null) {
actionCount++; result = defaultName + "(" + actionCount + ")"; //$NON-NLS-1$ //$NON-NLS-2$
} action = findBreakpointAction(result);
return result; actionCount++;
} }
return result;
public void revertActionData() { }
breakpointActions = null;
} public void revertActionData() {
breakpointActions = null;
public void saveActionData() { }
String actionData = new String(""); //$NON-NLS-1$
public void saveActionData() {
DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance(); String actionData = new String(""); //$NON-NLS-1$
DocumentBuilder docBuilder = null;
try { DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
docBuilder = dfactory.newDocumentBuilder(); DocumentBuilder docBuilder = null;
Document doc = docBuilder.newDocument(); try {
docBuilder = dfactory.newDocumentBuilder();
Element rootElement = doc.createElement("breakpointActionData"); //$NON-NLS-1$ Document doc = docBuilder.newDocument();
doc.appendChild(rootElement);
Element rootElement = doc.createElement("breakpointActionData"); //$NON-NLS-1$
for (Iterator iter = getBreakpointActions().iterator(); iter.hasNext();) { doc.appendChild(rootElement);
IBreakpointAction action = (IBreakpointAction) iter.next();
for (Iterator iter = getBreakpointActions().iterator(); iter.hasNext();) {
Element element = doc.createElement("actionEntry"); //$NON-NLS-1$ IBreakpointAction action = (IBreakpointAction) iter.next();
element.setAttribute("name", action.getName()); //$NON-NLS-1$
element.setAttribute("class", action.getClass().getName()); //$NON-NLS-1$ Element element = doc.createElement("actionEntry"); //$NON-NLS-1$
element.setAttribute("value", action.getMemento()); //$NON-NLS-1$ element.setAttribute("name", action.getName()); //$NON-NLS-1$
rootElement.appendChild(element); element.setAttribute("class", action.getClass().getName()); //$NON-NLS-1$
element.setAttribute("value", action.getMemento()); //$NON-NLS-1$
} rootElement.appendChild(element);
ByteArrayOutputStream s = new ByteArrayOutputStream(); }
TransformerFactory factory = TransformerFactory.newInstance(); ByteArrayOutputStream s = new ByteArrayOutputStream();
Transformer transformer = factory.newTransformer();
transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$ TransformerFactory factory = TransformerFactory.newInstance();
transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$ Transformer transformer = factory.newTransformer();
transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$
DOMSource source = new DOMSource(doc); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$
StreamResult outputTarget = new StreamResult(s);
transformer.transform(source, outputTarget); DOMSource source = new DOMSource(doc);
StreamResult outputTarget = new StreamResult(s);
actionData = s.toString("UTF8"); //$NON-NLS-1$ transformer.transform(source, outputTarget);
} catch (Exception e) { actionData = s.toString("UTF8"); //$NON-NLS-1$
e.printStackTrace();
} } catch (Exception e) {
CDebugCorePlugin.getDefault().getPluginPreferences().setValue(BREAKPOINT_ACTION_DATA, actionData); e.printStackTrace();
CDebugCorePlugin.getDefault().savePluginPreferences(); }
} CDebugCorePlugin.getDefault().getPluginPreferences().setValue(BREAKPOINT_ACTION_DATA, actionData);
CDebugCorePlugin.getDefault().savePluginPreferences();
} }
}

View file

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

View file

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

View file

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

View file

@ -3,14 +3,14 @@
<schema targetNamespace="org.eclipse.cdt.debug.ui"> <schema targetNamespace="org.eclipse.cdt.debug.ui">
<annotation> <annotation>
<appInfo> <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> </appInfo>
<documentation> <documentation>
This extension point provides a mechanism for contributing UI to define and edit a breakpoint action. This extension point provides a mechanism for contributing UI to define and edit a breakpoint action.
</documentation> </documentation>
</annotation> </annotation>
<element name="extension"> <element name="extension">
<complexType> <complexType>
<sequence> <sequence>
<element ref="actionPage"/> <element ref="actionPage"/>
@ -34,7 +34,7 @@
</documentation> </documentation>
</annotation> </annotation>
</attribute> </attribute>
<attribute name="class" type="string"> <attribute name="class" type="string">
<annotation> <annotation>
<documentation> <documentation>
@ -50,7 +50,7 @@
</attribute> </attribute>
</complexType> </complexType>
</element> </element>
<annotation> <annotation>
<appInfo> <appInfo>
<meta.section type="since"/> <meta.section type="since"/>

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 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. //The shared instance.
private static CDebugUIPlugin plugin; private static CDebugUIPlugin plugin;
@ -173,11 +176,16 @@ public class CDebugUIPlugin extends AbstractUIPlugin {
protected void initializeDebuggerPageMap() { protected void initializeDebuggerPageMap() {
fDebuggerPageMap = new HashMap( 10 ); 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(); IConfigurationElement[] infos = extensionPoint.getConfigurationElements();
for( int i = 0; i < infos.length; i++ ) { for( int i = 0; i < infos.length; i++ ) {
String id = infos[i].getAttribute( "debuggerID" ); //$NON-NLS-1$ IConfigurationElement info = infos[i];
fDebuggerPageMap.put( id, 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

@ -1,276 +1,286 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007 Nokia and others. * Copyright (c) 2007 Nokia and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* Nokia - initial API and implementation * Nokia - initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.debug.ui.breakpointactions; package org.eclipse.cdt.debug.ui.breakpointactions;
import org.eclipse.cdt.debug.core.CDebugCorePlugin; import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.breakpointactions.IBreakpointAction; import org.eclipse.cdt.debug.core.breakpointactions.IBreakpointAction;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin; import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension; import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint; import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StackLayout; import org.eclipse.swt.custom.StackLayout;
import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text; import org.eclipse.swt.widgets.Text;
public class ActionDialog extends Dialog { 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$
private static final String ACTION_DIALOG_LAST_SELECTED = "ActionDialog.lastSelectedAction"; //$NON-NLS-1$ public static final String ACTION_PAGE_ELEMENT = "actionPage"; //$NON-NLS-1$
private Composite actionArea; private static final String ACTION_DIALOG_LAST_SELECTED = "ActionDialog.lastSelectedAction"; //$NON-NLS-1$
private Composite[] actionComposites;
private IBreakpointAction breakpointAction; private Composite actionArea;
private IBreakpointActionPage actionPage; private Composite[] actionComposites;
private IBreakpointAction[] breakpointActions; private IBreakpointAction breakpointAction;
private IBreakpointActionPage[] actionPages; private IBreakpointActionPage actionPage;
private String actionName; private IBreakpointAction[] breakpointActions;
private Text actionNameTextWidget; private IBreakpointActionPage[] actionPages;
private Combo combo; private String actionName;
private Composite dialogArea; private Text actionNameTextWidget;
private int lastSelectedActionTypeIndex; private Combo combo;
private IBreakpointAction originalAction; private Composite dialogArea;
private int lastSelectedActionTypeIndex;
private IExtension[] breakpointActionPageExtensions; private IBreakpointAction originalAction;
/** private IExtension[] breakpointActionPageExtensions;
* Create the dialog
* /**
* @param parentShell * Create the dialog
*/ *
public ActionDialog(Shell parentShell, IBreakpointAction action) { * @param parentShell
super(parentShell); */
setShellStyle(getShellStyle() | SWT.MAX | SWT.RESIZE); public ActionDialog(Shell parentShell, IBreakpointAction action) {
this.originalAction = action; super(parentShell);
this.breakpointAction = action; setShellStyle(getShellStyle() | SWT.MAX | SWT.RESIZE);
lastSelectedActionTypeIndex = 0; this.originalAction = action;
} this.breakpointAction = action;
lastSelectedActionTypeIndex = 0;
protected void cancelPressed() { }
actionPage.actionDialogCanceled();
super.cancelPressed(); protected void cancelPressed() {
} actionPage.actionDialogCanceled();
super.cancelPressed();
protected void configureShell(Shell newShell) { }
super.configureShell(newShell);
if (originalAction == null) protected void configureShell(Shell newShell) {
newShell.setText(Messages.getString("ActionDialog.0")); //$NON-NLS-1$ super.configureShell(newShell);
else if (originalAction == null)
newShell.setText(originalAction.getName()); newShell.setText(Messages.getString("ActionDialog.0")); //$NON-NLS-1$
} else
newShell.setText(originalAction.getName());
/** }
* Create contents of the button bar
* /**
* @param parent * Create contents of the button bar
*/ *
protected void createButtonsForButtonBar(Composite parent) { * @param parent
createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); */
createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); protected void createButtonsForButtonBar(Composite parent) {
} createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
/** }
* Create contents of the dialog
* /**
* @param parent * Create contents of the dialog
*/ *
protected Control createDialogArea(Composite parent) { * @param parent
dialogArea = (Composite) super.createDialogArea(parent); */
final GridLayout gridLayout = new GridLayout(); protected Control createDialogArea(Composite parent) {
gridLayout.numColumns = 2; dialogArea = (Composite) super.createDialogArea(parent);
dialogArea.setLayout(gridLayout); final GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 2;
final Label actionNameLabel = new Label(dialogArea, SWT.NONE); dialogArea.setLayout(gridLayout);
actionNameLabel.setText(Messages.getString("ActionDialog.1")); //$NON-NLS-1$
final Label actionNameLabel = new Label(dialogArea, SWT.NONE);
actionNameTextWidget = new Text(dialogArea, SWT.BORDER); actionNameLabel.setText(Messages.getString("ActionDialog.1")); //$NON-NLS-1$
actionNameTextWidget.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
actionNameTextWidget = new Text(dialogArea, SWT.BORDER);
final Label breakpointActionTypeLabel = new Label(dialogArea, SWT.NONE); actionNameTextWidget.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
breakpointActionTypeLabel.setText(Messages.getString("ActionDialog.2")); //$NON-NLS-1$
final Label breakpointActionTypeLabel = new Label(dialogArea, SWT.NONE);
combo = new Combo(dialogArea, SWT.READ_ONLY); breakpointActionTypeLabel.setText(Messages.getString("ActionDialog.2")); //$NON-NLS-1$
combo.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent e) { combo = new Combo(dialogArea, SWT.READ_ONLY);
try { combo.addSelectionListener(new SelectionAdapter() {
showActionComposite(); public void widgetSelected(final SelectionEvent e) {
} catch (CoreException e1) { try {
} showActionComposite();
} } catch (CoreException e1) {
}); }
combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); }
// });
combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
IExtension[] actionExtensions = CDebugCorePlugin.getDefault().getBreakpointActionManager().getBreakpointActionExtensions(); //
breakpointActions = new IBreakpointAction[actionExtensions.length]; IExtension[] actionExtensions = CDebugCorePlugin.getDefault().getBreakpointActionManager().getBreakpointActionExtensions();
actionPages = new IBreakpointActionPage[actionExtensions.length];
actionComposites = new Composite[actionExtensions.length]; breakpointActions = new IBreakpointAction[actionExtensions.length];
actionPages = new IBreakpointActionPage[actionExtensions.length];
if (actionExtensions.length > 0) { actionComposites = new Composite[actionExtensions.length];
String lastTypeName = CDebugUIPlugin.getDefault().getPreferenceStore().getString(ACTION_DIALOG_LAST_SELECTED); if (actionExtensions.length > 0) {
if (breakpointAction != null) { String lastTypeName = CDebugUIPlugin.getDefault().getPreferenceStore().getString(ACTION_DIALOG_LAST_SELECTED);
lastTypeName = breakpointAction.getTypeName();
actionName = breakpointAction.getName(); if (breakpointAction != null) {
} lastTypeName = breakpointAction.getTypeName();
actionName = breakpointAction.getName();
for (int i = 0; i < actionExtensions.length; i++) { }
IConfigurationElement[] elements = actionExtensions[i].getConfigurationElements();
for (int j = 0; j < elements.length; j++) { for (int i = 0; i < actionExtensions.length; i++) {
String actionTypeName = elements[j].getAttribute("name"); //$NON-NLS-1$ IConfigurationElement[] elements = actionExtensions[i].getConfigurationElements();
combo.add(actionTypeName); for (int j = 0; j < elements.length; j++) {
if (actionTypeName.equals(lastTypeName)) IConfigurationElement element = elements[j];
lastSelectedActionTypeIndex = i; if (element.getName().equals(CDebugCorePlugin.ACTION_TYPE_ELEMENT)) {
} String actionTypeName = element.getAttribute("name"); //$NON-NLS-1$
} combo.add(actionTypeName);
if (actionTypeName.equals(lastTypeName))
combo.select(lastSelectedActionTypeIndex); lastSelectedActionTypeIndex = i;
if (originalAction != null) }
combo.setEnabled(false); }
}
breakpointActions[combo.getSelectionIndex()] = breakpointAction;
combo.select(lastSelectedActionTypeIndex);
actionArea = new Composite(dialogArea, SWT.NONE); if (originalAction != null)
actionArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1)); combo.setEnabled(false);
actionArea.setLayout(new StackLayout());
try { breakpointActions[combo.getSelectionIndex()] = breakpointAction;
showActionComposite();
} catch (CoreException e) { actionArea = new Composite(dialogArea, SWT.NONE);
// TODO Auto-generated catch block actionArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
e.printStackTrace(); actionArea.setLayout(new StackLayout());
} try {
showActionComposite();
} } catch (CoreException e) {
// TODO Auto-generated catch block
return dialogArea; e.printStackTrace();
} }
public IBreakpointAction getBreakpointAction() { }
return breakpointAction;
} return dialogArea;
}
public String getActionName() {
return actionName; public IBreakpointAction getBreakpointAction() {
} return breakpointAction;
}
/**
* Return the initial size of the dialog public String getActionName() {
*/ return actionName;
protected Point getInitialSize() { }
return new Point(500, 375);
} /**
* Return the initial size of the dialog
protected void okPressed() { */
if (originalAction == null) protected Point getInitialSize() {
CDebugUIPlugin.getDefault().getPreferenceStore().setValue(ACTION_DIALOG_LAST_SELECTED, breakpointAction.getTypeName()); return new Point(500, 375);
String newName = actionNameTextWidget.getText(); }
if (originalAction == null || !originalAction.getName().equals(newName)) {
actionName = CDebugCorePlugin.getDefault().getBreakpointActionManager().makeUniqueActionName(newName); protected void okPressed() {
breakpointAction.setName(actionName); if (originalAction == null)
} CDebugUIPlugin.getDefault().getPreferenceStore().setValue(ACTION_DIALOG_LAST_SELECTED, breakpointAction.getTypeName());
actionPage.actionDialogOK(); String newName = actionNameTextWidget.getText();
super.okPressed(); if (originalAction == null || !originalAction.getName().equals(newName)) {
} actionName = CDebugCorePlugin.getDefault().getBreakpointActionManager().makeUniqueActionName(newName);
breakpointAction.setName(actionName);
void showActionComposite() throws CoreException { }
// Find the selected extension actionPage.actionDialogOK();
int selectedTypeIndex = combo.getSelectionIndex(); super.okPressed();
lastSelectedActionTypeIndex = selectedTypeIndex; }
breakpointAction = breakpointActions[selectedTypeIndex];
if (breakpointAction == null) { void showActionComposite() throws CoreException {
int elementCount = 0; // Find the selected extension
IConfigurationElement selectedElement = null; int selectedTypeIndex = combo.getSelectionIndex();
lastSelectedActionTypeIndex = selectedTypeIndex;
IExtension[] actionExtensions = CDebugCorePlugin.getDefault().getBreakpointActionManager().getBreakpointActionExtensions(); breakpointAction = breakpointActions[selectedTypeIndex];
if (breakpointAction == null) {
for (int i = 0; i < actionExtensions.length && selectedElement == null; i++) { int elementCount = 0;
IConfigurationElement[] elements = actionExtensions[i].getConfigurationElements(); IConfigurationElement selectedElement = null;
for (int j = 0; j < elements.length && selectedElement == null; j++) {
if (elementCount == selectedTypeIndex) IExtension[] actionExtensions = CDebugCorePlugin.getDefault().getBreakpointActionManager().getBreakpointActionExtensions();
selectedElement = elements[j];
elementCount++; 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];
breakpointAction = (IBreakpointAction) selectedElement.createExecutableExtension("class"); //$NON-NLS-1$ if (element.getName().equals(CDebugCorePlugin.ACTION_TYPE_ELEMENT)) {
breakpointAction.setName(breakpointAction.getDefaultName()); if (elementCount == selectedTypeIndex)
breakpointActions[selectedTypeIndex] = breakpointAction; selectedElement = element;
} elementCount++;
actionPage = actionPages[selectedTypeIndex]; }
if (actionPage == null) { }
actionPages[selectedTypeIndex] = getActionPage(breakpointActions[selectedTypeIndex]); }
actionPage = actionPages[selectedTypeIndex];
} breakpointAction = (IBreakpointAction) selectedElement.createExecutableExtension("class"); //$NON-NLS-1$
if (actionComposites[selectedTypeIndex] == null) { breakpointAction.setName(breakpointAction.getDefaultName());
Composite actionComposite = actionPages[selectedTypeIndex].createComposite(breakpointAction, actionArea, SWT.NONE); breakpointActions[selectedTypeIndex] = breakpointAction;
actionComposites[selectedTypeIndex] = actionComposite; }
} actionPage = actionPages[selectedTypeIndex];
actionName = breakpointAction.getName(); if (actionPage == null) {
actionPages[selectedTypeIndex] = getActionPage(breakpointActions[selectedTypeIndex]);
actionNameTextWidget.setText(actionName); actionPage = actionPages[selectedTypeIndex];
StackLayout stacklayout = (StackLayout) actionArea.getLayout(); }
stacklayout.topControl = actionComposites[selectedTypeIndex]; if (actionComposites[selectedTypeIndex] == null) {
actionArea.layout(); Composite actionComposite = actionPages[selectedTypeIndex].createComposite(breakpointAction, actionArea, SWT.NONE);
} actionComposites[selectedTypeIndex] = actionComposite;
}
public IExtension[] getBreakpointActionPageExtensions() { actionName = breakpointAction.getName();
if (breakpointActionPageExtensions == null) {
IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(CDebugUIPlugin.PLUGIN_ID, BREAKPOINT_ACTION_PAGE_SIMPLE_ID); actionNameTextWidget.setText(actionName);
if (point == null) StackLayout stacklayout = (StackLayout) actionArea.getLayout();
breakpointActionPageExtensions = new IExtension[0]; stacklayout.topControl = actionComposites[selectedTypeIndex];
else { actionArea.layout();
breakpointActionPageExtensions = point.getExtensions(); }
}
} public IExtension[] getBreakpointActionPageExtensions() {
if (breakpointActionPageExtensions == null) {
return breakpointActionPageExtensions; IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(CDebugUIPlugin.PLUGIN_ID, BREAKPOINT_ACTION_PAGE_EXTENSION_POINT_ID);
} if (point == null)
breakpointActionPageExtensions = new IExtension[0];
private IBreakpointActionPage getActionPage(IBreakpointAction breakpointAction) { else {
IExtension[] actionExtensions = getBreakpointActionPageExtensions(); breakpointActionPageExtensions = point.getExtensions();
}
IBreakpointActionPage actionPageResult = null; }
try {
return breakpointActionPageExtensions;
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++) { private IBreakpointActionPage getActionPage(IBreakpointAction breakpointAction) {
IExtension[] actionExtensions = getBreakpointActionPageExtensions();
if (elements[j].getAttribute("actionType").equals(breakpointAction.getIdentifier())) { //$NON-NLS-1$
actionPageResult = (IBreakpointActionPage) elements[j].createExecutableExtension("class"); //$NON-NLS-1$ IBreakpointActionPage actionPageResult = null;
} try {
}
} for (int i = 0; i < actionExtensions.length && actionPageResult == null; i++) {
IConfigurationElement[] elements = actionExtensions[i].getConfigurationElements();
} catch (CoreException e) { for (int j = 0; j < elements.length && actionPageResult == null; j++) {
// TODO Auto-generated catch block IConfigurationElement element = elements[j];
e.printStackTrace(); if (element.getName().equals(ACTION_PAGE_ELEMENT)) {
} if (element.getAttribute("actionType").equals(breakpointAction.getIdentifier())) { //$NON-NLS-1$
return actionPageResult; actionPageResult = (IBreakpointActionPage) element.createExecutableExtension("class"); //$NON-NLS-1$
} }
}
} }
}
} catch (CoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return actionPageResult;
}
}