TCF Debugger: don't show temporary stepping breakpoints in the Breakpoints view
diff --git a/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/TCFBreakpointStatusListener.java b/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/TCFBreakpointStatusListener.java
index a1af6a7..29da703 100644
--- a/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/TCFBreakpointStatusListener.java
+++ b/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/TCFBreakpointStatusListener.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2010, 2013 Wind River Systems, Inc. and others.
+ * Copyright (c) 2010, 2015 Wind River Systems, Inc. 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
@@ -39,6 +39,7 @@
 import org.eclipse.debug.core.DebugPlugin;
 import org.eclipse.debug.core.IBreakpointListener;
 import org.eclipse.debug.core.model.IBreakpoint;
+import org.eclipse.tcf.internal.debug.actions.TCFAction;
 import org.eclipse.tcf.internal.debug.model.ITCFBreakpointListener;
 import org.eclipse.tcf.internal.debug.model.TCFBreakpoint;
 import org.eclipse.tcf.internal.debug.model.TCFBreakpointsModel;
@@ -253,6 +254,7 @@
         }
 
         private void createOrUpdateBreakpoint(final String id) {
+            if (id.startsWith(TCFAction.STEP_BREAKPOINT_PREFIX)) return;
             Map<String,Object> properties = status.getProperties(id);
             if (properties == null) return;
             if (TCFBreakpointsModel.isLocal(properties)) return;
diff --git a/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/TCFSuspendResumeAdapter.java b/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/TCFSuspendResumeAdapter.java
index 749a2ca..d58c583 100644
--- a/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/TCFSuspendResumeAdapter.java
+++ b/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/TCFSuspendResumeAdapter.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2010, 2011 Wind River Systems, Inc. and others.
+ * Copyright (c) 2010, 2015 Wind River Systems, Inc. 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
@@ -31,6 +31,7 @@
 import org.eclipse.debug.core.DebugException;
 import org.eclipse.debug.core.model.ISourceLocator;
 import org.eclipse.debug.core.model.ISuspendResume;
+import org.eclipse.tcf.internal.debug.actions.TCFAction;
 import org.eclipse.tcf.internal.debug.model.TCFContextState;
 import org.eclipse.tcf.internal.debug.ui.model.TCFChildren;
 import org.eclipse.tcf.internal.debug.ui.model.TCFDebugTask;
@@ -136,17 +137,16 @@
                     return;
                 }
                 IRunControl.RunControlContext runCtx = cache.getData();
-                if (runCtx.canResume(IRunControl.RM_RESUME)) {
-                    runCtx.resume(IRunControl.RM_RESUME, 1, new IRunControl.DoneCommand() {
-                        public void doneCommand(IToken token, Exception error) {
-                            if (error != null) {
-                                error(error);
-                            } else {
-                                done(null);
-                            }
+                runCtx.resume(IRunControl.RM_RESUME, 1, new IRunControl.DoneCommand() {
+                    public void doneCommand(IToken token, Exception error) {
+                        if (error != null) {
+                            error(error);
                         }
-                    });
-                }
+                        else {
+                            done(null);
+                        }
+                    }
+                });
             }
         }.getD();
     }
@@ -169,7 +169,8 @@
                         public void doneCommand(IToken token, Exception error) {
                             if (error != null) {
                                 error(error);
-                            } else {
+                            }
+                            else {
                                 done(null);
                             }
                         }
@@ -274,10 +275,6 @@
                     done(null);
                     return;
                 }
-                final TCFDataCache<IRunControl.RunControlContext> cache = fExecCtx.getRunContext();
-                if (!cache.validate(this)) {
-                    return;
-                }
                 final IChannel channel = fExecCtx.getChannel();
                 final IBreakpoints breakpoints = channel.getRemoteService(IBreakpoints.class);
                 if (breakpoints == null) {
@@ -289,13 +286,14 @@
                 if (location.fFile != null) {
                     properties.put(IBreakpoints.PROP_FILE, location.fFile);
                     properties.put(IBreakpoints.PROP_LINE, location.fLine);
-                } else {
+                }
+                else {
                     properties.put(IBreakpoints.PROP_LOCATION, location.fAddress.toString());
                 }
 //                properties.put(IBreakpoints.PROP_CONTEXTIDS, new String[] { contextId });
                 properties.put(IBreakpoints.PROP_ENABLED, Boolean.TRUE);
 //                properties.put(IBreakpoints.PROP_TEMPORARY, Boolean.TRUE);
-                final String breakpointId = "runtoline"+location.hashCode();
+                final String breakpointId = TCFAction.STEP_BREAKPOINT_PREFIX + contextId;
                 properties.put(IBreakpoints.PROP_ID, breakpointId);
                 breakpoints.add(properties, new IBreakpoints.DoneCommand() {
                     public void doneCommand(IToken token, Exception error) {
@@ -320,8 +318,8 @@
                                     removeBreakpoint.run();
                                     return;
                                 }
+                                final TCFDataCache<IRunControl.RunControlContext> cache = fExecCtx.getRunContext();
                                 if (!cache.validate(this)) {
-                                    removeBreakpoint.run();
                                     return;
                                 }
                                 if (cache.getError() != null) {
@@ -330,22 +328,18 @@
                                     return;
                                 }
                                 runControl.addListener(new RunControlListener() {
-                                    boolean fRunning;
-                                    public void contextSuspended(String context, String pc, String reason,
-                                            Map<String, Object> params) {
-                                        if (contextId.equals(context) && fRunning) {
-                                            finished();
-                                        }
-                                    }
                                     private void finished() {
                                         runControl.removeListener(this);
                                         removeBreakpoint.run();
                                     }
-                                    public void contextResumed(String context) {
-                                        if (contextId.equals(context) && !fRunning) {
-                                            fRunning = true;
+                                    public void contextSuspended(String context, String pc, String reason,
+                                            Map<String, Object> params) {
+                                        if (contextId.equals(context)) {
+                                            finished();
                                         }
                                     }
+                                    public void contextResumed(String context) {
+                                    }
                                     public void contextRemoved(String[] context_ids) {
                                         for (String context : context_ids) {
                                             if (contextId.equals(context)) {
@@ -362,42 +356,30 @@
                                     }
                                     public void containerSuspended(String context, String pc, String reason,
                                             Map<String, Object> params, String[] suspended_ids) {
-                                        if (fRunning) {
-                                            for (String context2 : suspended_ids) {
-                                                if (contextId.equals(context2)) {
-                                                    finished();
-                                                }
+                                        for (String context2 : suspended_ids) {
+                                            if (contextId.equals(context2)) {
+                                                finished();
+                                                return;
                                             }
                                         }
                                     }
                                     public void containerResumed(String[] context_ids) {
-                                        if (!fRunning) {
-                                            for (String context2 : context_ids) {
-                                                if (contextId.equals(context2)) {
-                                                    fRunning = true;
-                                                    return;
-                                                }
-                                            }
-                                        }
                                     }
                                 });
                                 IRunControl.RunControlContext runCtx = cache.getData();
-                                if (runCtx.canResume(IRunControl.RM_RESUME)) {
-                                    runCtx.resume(IRunControl.RM_RESUME, 1, new IRunControl.DoneCommand() {
-                                        public void doneCommand(IToken token, Exception error) {
-                                            if (error != null) {
-                                                error(error);
-                                            } else {
-                                                done(null);
-                                            }
+                                runCtx.resume(IRunControl.RM_RESUME, 1, new IRunControl.DoneCommand() {
+                                    public void doneCommand(IToken token, Exception error) {
+                                        if (error != null) {
+                                            error(error);
                                         }
-                                    });
-                                }
+                                        else {
+                                            done(null);
+                                        }
+                                    }
+                                });
                             }
                         };
-                        if (cache.validate(resume)) {
-                            resume.run();
-                        }
+                        resume.run();
                     }
                 });
             }
@@ -516,23 +498,23 @@
                                         return;
                                     }
                                     IRunControl.RunControlContext runCtx = cache.getData();
-                                    if (runCtx.canResume(IRunControl.RM_RESUME)) {
-                                        runCtx.resume(IRunControl.RM_RESUME, 1, new IRunControl.DoneCommand() {
-                                            public void doneCommand(IToken token, Exception error) {
-                                                if (error != null) {
-                                                    error(error);
-                                                } else {
-                                                    done(null);
-                                                }
+                                    runCtx.resume(IRunControl.RM_RESUME, 1, new IRunControl.DoneCommand() {
+                                        public void doneCommand(IToken token, Exception error) {
+                                            if (error != null) {
+                                                error(error);
                                             }
-                                        });
-                                    }
+                                            else {
+                                                done(null);
+                                            }
+                                        }
+                                    });
                                 }
                             };
                             if (cache.validate(resume)) {
                                 resume.run();
                             }
-                        } else {
+                        }
+                        else {
                             done(null);
                         }
                     }
diff --git a/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/actions/TCFAction.java b/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/actions/TCFAction.java
index 7fedaf9..ab15ec1 100644
--- a/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/actions/TCFAction.java
+++ b/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/actions/TCFAction.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2008, 2011 Wind River Systems, Inc. and others.
+ * Copyright (c) 2008, 2015 Wind River Systems, Inc. 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
@@ -27,6 +27,8 @@
  */
 public abstract class TCFAction implements Runnable {
 
+    public static final String STEP_BREAKPOINT_PREFIX = "Step.";
+
     protected final TCFLaunch launch;
     protected final String ctx_id;
 
diff --git a/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/actions/TCFActionStepOut.java b/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/actions/TCFActionStepOut.java
index fa0c613..c24c86c 100644
--- a/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/actions/TCFActionStepOut.java
+++ b/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/actions/TCFActionStepOut.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2010, 2013 Wind River Systems, Inc. and others.
+ * Copyright (c) 2010, 2015 Wind River Systems, Inc. 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
@@ -118,7 +118,7 @@
                     BigInteger n = JSON.toBigInteger(addr);
                     addr = n.subtract(BigInteger.valueOf(1));
                 }
-                String id = "Step." + ctx.getID();
+                String id = STEP_BREAKPOINT_PREFIX + ctx.getID();
                 bp = new HashMap<String,Object>();
                 bp.put(IBreakpoints.PROP_ID, id);
                 bp.put(IBreakpoints.PROP_LOCATION, addr.toString());
diff --git a/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/actions/TCFActionStepOver.java b/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/actions/TCFActionStepOver.java
index 235cf58..52a738f 100644
--- a/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/actions/TCFActionStepOver.java
+++ b/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/actions/TCFActionStepOver.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2010, 2011 Wind River Systems, Inc. and others.
+ * Copyright (c) 2010, 2015 Wind River Systems, Inc. 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
@@ -177,7 +177,7 @@
                         BigInteger n = JSON.toBigInteger(addr);
                         addr = n.subtract(BigInteger.valueOf(1));
                     }
-                    String id = "Step." + ctx.getID();
+                    String id = STEP_BREAKPOINT_PREFIX + ctx.getID();
                     bp = new HashMap<String,Object>();
                     bp.put(IBreakpoints.PROP_ID, id);
                     bp.put(IBreakpoints.PROP_LOCATION, addr.toString());