diff options
author | eutarass | 2008-04-25 18:39:50 +0000 |
---|---|---|
committer | eutarass | 2008-04-25 18:39:50 +0000 |
commit | 1385e5e84da91b77f0ac875d25a80a3fe6490c82 (patch) | |
tree | 034b344acd4e7c18fa76cc5de1b492bf1bd6ad26 /plugins/org.eclipse.tm.tcf | |
parent | 3be680f61e65a1481bb83537704751d3ff024b2d (diff) | |
download | org.eclipse.tcf-1385e5e84da91b77f0ac875d25a80a3fe6490c82.tar.gz org.eclipse.tcf-1385e5e84da91b77f0ac875d25a80a3fe6490c82.tar.xz org.eclipse.tcf-1385e5e84da91b77f0ac875d25a80a3fe6490c82.zip |
Bug 227874: [tcf][api] breakpoint event and capabilities changes
Diffstat (limited to 'plugins/org.eclipse.tm.tcf')
-rw-r--r-- | plugins/org.eclipse.tm.tcf/src/org/eclipse/tm/internal/tcf/services/remote/BreakpointsProxy.java | 41 | ||||
-rw-r--r-- | plugins/org.eclipse.tm.tcf/src/org/eclipse/tm/tcf/services/IBreakpoints.java | 63 |
2 files changed, 97 insertions, 7 deletions
diff --git a/plugins/org.eclipse.tm.tcf/src/org/eclipse/tm/internal/tcf/services/remote/BreakpointsProxy.java b/plugins/org.eclipse.tm.tcf/src/org/eclipse/tm/internal/tcf/services/remote/BreakpointsProxy.java index 3a7ac8ef7..577681ca8 100644 --- a/plugins/org.eclipse.tm.tcf/src/org/eclipse/tm/internal/tcf/services/remote/BreakpointsProxy.java +++ b/plugins/org.eclipse.tm.tcf/src/org/eclipse/tm/internal/tcf/services/remote/BreakpointsProxy.java @@ -32,7 +32,7 @@ public class BreakpointsProxy implements IBreakpoints { this.channel = channel; } - public IToken set(Map<String, Object>[] properties, final DoneCommand done) { + public IToken set(Map<String,Object>[] properties, final DoneCommand done) { return new Command(channel, this, "set", new Object[]{ properties }) { @Override public void done(Exception error, Object[] args) { @@ -45,7 +45,7 @@ public class BreakpointsProxy implements IBreakpoints { }.token; } - public IToken add(Map<String, Object> properties, final DoneCommand done) { + public IToken add(Map<String,Object> properties, final DoneCommand done) { return new Command(channel, this, "add", new Object[]{ properties }) { @Override public void done(Exception error, Object[] args) { @@ -58,7 +58,7 @@ public class BreakpointsProxy implements IBreakpoints { }.token; } - public IToken change(Map<String, Object> properties, final DoneCommand done) { + public IToken change(Map<String,Object> properties, final DoneCommand done) { return new Command(channel, this, "change", new Object[]{ properties }) { @Override public void done(Exception error, Object[] args) { @@ -157,6 +157,22 @@ public class BreakpointsProxy implements IBreakpoints { }.token; } + public IToken getCapabilities(String id, final DoneGetCapabilities done) { + return new Command(channel, this, "getCapabilities", new Object[]{ id }) { + @SuppressWarnings("unchecked") + @Override + public void done(Exception error, Object[] args) { + Map<String,Object> map = null; + if (error == null) { + assert args.length == 3; + error = toError(args[0], args[1]); + map = (Map<String,Object>)args[2]; + } + done.doneGetCapabilities(token, error, map); + } + }.token; + } + public String getName() { return NAME; } @@ -168,6 +184,13 @@ public class BreakpointsProxy implements IBreakpoints { return (String[])c.toArray(new String[c.size()]); } + @SuppressWarnings("unchecked") + private Map<String,Object>[] toBreakpointArray(Object o) { + Collection<Map<String,Object>> c = (Collection<Map<String,Object>>)o; + if (c == null) return new Map[0]; + return (Map<String,Object>[])c.toArray(new Map[c.size()]); + } + public void addListener(final BreakpointsListener listener) { IChannel.IEventListener l = new IChannel.IEventListener() { @@ -179,6 +202,18 @@ public class BreakpointsProxy implements IBreakpoints { assert args.length == 2; listener.breakpointStatusChanged((String)args[0], (Map<String,Object>)args[1]); } + else if (name.equals("contextAdded")) { + assert args.length == 1; + listener.contextAdded(toBreakpointArray(args[0])); + } + else if (name.equals("contextChanged")) { + assert args.length == 1; + listener.contextChanged(toBreakpointArray(args[0])); + } + else if (name.equals("contextRemoved")) { + assert args.length == 1; + listener.contextRemoved(toStringArray(args[0])); + } else { throw new IOException("Breakpoints service: unknown event: " + name); } diff --git a/plugins/org.eclipse.tm.tcf/src/org/eclipse/tm/tcf/services/IBreakpoints.java b/plugins/org.eclipse.tm.tcf/src/org/eclipse/tm/tcf/services/IBreakpoints.java index ec1477341..c29e100e3 100644 --- a/plugins/org.eclipse.tm.tcf/src/org/eclipse/tm/tcf/services/IBreakpoints.java +++ b/plugins/org.eclipse.tm.tcf/src/org/eclipse/tm/tcf/services/IBreakpoints.java @@ -20,11 +20,11 @@ import org.eclipse.tm.tcf.protocol.IToken; * Breakpoint is represented by unique identifier and set of properties. * Breakpoint identifier (String id) needs to be unique across all hosts and targets. * - * Breakpoint properties (Map<String,Object>) is extendable collection of named attributes, + * Breakpoint properties (Map<String,Object>) is extendible collection of named attributes, * which define breakpoint location and behavior. This module defines some common * attribute names (see PROP_*), host tools and target agents may support additional attributes. * - * For each breakpoint a target agent maintains another extendable collection of named attributes: + * For each breakpoint a target agent maintains another extendible collection of named attributes: * breakpoint status (Map<String,Object>, see STATUS_*). While breakpoint properties are * persistent and represent user input, breakpoint status reflects dynamic target agent reports * about breakpoint current state, like actual addresses where breakpoint is planted or planting errors. @@ -59,6 +59,16 @@ public interface IBreakpoints extends IService { STATUS_COLUMN = "Column"; // Number /** + * Breakpoint service capabilities. + */ + static final String + CAPABILITY_CONTEXT_ID = "ID", // String + CAPABILITY_HAS_CHILDREN = "HasChildren", // Boolean + CAPABILITY_ADDRESS = "Address", // Boolean + CAPABILITY_CONDITION = "Condition", // Boolean + CAPABILITY_FILE_LINE = "FileLine"; // Boolean + + /** * Call back interface for breakpoint service commands. */ interface DoneCommand { @@ -92,7 +102,7 @@ public interface IBreakpoints extends IService { IToken change(Map<String,Object> properties, DoneCommand done); /** - * Tell target to change (only) PROP_ENABLED breakpoint property 'true'. + * Tell target to change (only) PROP_ENABLED breakpoint property to 'true'. * @param ids - array of enabled breakpoint identifiers. * @param done - command result call back object. */ @@ -106,7 +116,7 @@ public interface IBreakpoints extends IService { IToken disable(String[] ids, DoneCommand done); /** - * Tell target to remove breakpoint. + * Tell target to remove breakpoints. * @param id - unique breakpoint identifier. * @param done - command result call back object. */ @@ -145,7 +155,26 @@ public interface IBreakpoints extends IService { } /** + * Report breakpoint service capabilities to clients so they + * can adjust to different implementations of the service. + * When called with a null ("") context ID the global capabilities are returned, + * otherwise context specific capabilities are returned. A special capability + * property is used to indicate that all child contexts have the same + * capabilities. + * @param id - a context ID or null. + * @param done - command result call back object. + */ + IToken getCapabilities(String id, DoneGetCapabilities done); + + interface DoneGetCapabilities { + void doneGetCapabilities(IToken token, Exception error, Map<String,Object> capabilities); + } + + /** * Breakpoints service events listener. + * Note that contextAdded, contextChanged and contextRemoved events carry exactly same set + * of breakpoint properties that was sent by a client to a target. The purpose of these events is to + * let all clients know about breakpoints that were created by other clients. */ interface BreakpointsListener { @@ -155,9 +184,35 @@ public interface IBreakpoints extends IService { * @param status - breakpoint status. */ void breakpointStatusChanged(String id, Map<String,Object> status); + + /** + * Called when a new breakpoints are added. + * @param bps - array of breakpoints. + */ + void contextAdded(Map<String,Object>[] bps); + + /** + * Called when breakpoint properties change. + * @param bps - array of breakpoints. + */ + void contextChanged(Map<String,Object>[] bps); + + /** + * Called when breakpoints are removed . + * @param ids - array of breakpoint IDs. + */ + void contextRemoved(String[] ids); } + /** + * Add breakpoints service event listener. + * @param listener - object that implements BreakpointsListener interface. + */ void addListener(BreakpointsListener listener); + /** + * Remove breakpoints service event listener. + * @param listener - object that implements BreakpointsListener interface. + */ void removeListener(BreakpointsListener listener); } |