extend DSF to support state change reason details (https://bugs.eclipse.org/bugs/show_bug.cgi?id=288962)
authorwpaul
Wed, 09 Sep 2009 12:47:57 -0500
changeset 94 1bce8db24d38
parent 93 a89fb2f3244c
child 95 fafaec74d446
extend DSF to support state change reason details (https://bugs.eclipse.org/bugs/show_bug.cgi?id=288962)
cdt/cdt_6_0_x/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/launch/AbstractContainerVMNode.java
cdt/cdt_6_0_x/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/launch/AbstractThreadVMNode.java
cdt/cdt_6_0_x/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/launch/ExecutionContextLabelText.java
cdt/cdt_6_0_x/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/launch/ILaunchVMConstants.java
cdt/cdt_6_0_x/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/launch/messages.properties
cdt/cdt_6_0_x/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/IRunControl.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/launch/AbstractContainerVMNode.java	Wed Sep 09 11:13:29 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/launch/AbstractContainerVMNode.java	Wed Sep 09 12:47:57 2009 -0500
@@ -28,6 +28,7 @@
 import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerSuspendedDMEvent;
 import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
 import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMData;
+import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMData2;
 import org.eclipse.cdt.dsf.debug.service.IRunControl.IExitedDMEvent;
 import org.eclipse.cdt.dsf.debug.service.IRunControl.IStartedDMEvent;
 import org.eclipse.cdt.dsf.debug.service.IRunControl.StateChangeReason;
@@ -177,6 +178,13 @@
         if (reason != null) {
         	update.setProperty(ILaunchVMConstants.PROP_STATE_CHANGE_REASON, data.getStateChangeReason().name());
         }
+        
+        if (data instanceof IExecutionDMData2) {
+        	String details = ((IExecutionDMData2)data).getDetails();
+        	if (details != null) {
+            	update.setProperty(ILaunchVMConstants.PROP_STATE_CHANGE_DETAILS, details);
+        	}
+        }
     }
 
     @Override
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/launch/AbstractThreadVMNode.java	Wed Sep 09 11:13:29 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/launch/AbstractThreadVMNode.java	Wed Sep 09 12:47:57 2009 -0500
@@ -29,6 +29,7 @@
 import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerSuspendedDMEvent;
 import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
 import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMData;
+import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMData2;
 import org.eclipse.cdt.dsf.debug.service.IRunControl.IResumedDMEvent;
 import org.eclipse.cdt.dsf.debug.service.IRunControl.ISuspendedDMEvent;
 import org.eclipse.cdt.dsf.debug.service.IRunControl.StateChangeReason;
@@ -107,7 +108,9 @@
                         ILaunchVMConstants.PROP_ID, 
                         ILaunchVMConstants.PROP_IS_SUSPENDED, 
                         ExecutionContextLabelText.PROP_STATE_CHANGE_REASON_KNOWN, 
-                        ILaunchVMConstants.PROP_STATE_CHANGE_REASON }),
+                        ILaunchVMConstants.PROP_STATE_CHANGE_REASON,
+                        ExecutionContextLabelText.PROP_STATE_CHANGE_DETAILS_KNOWN, 
+                        ILaunchVMConstants.PROP_STATE_CHANGE_DETAILS }),
                 new LabelText(MessagesForLaunchVM.AbstractThreadVMNode_No_columns__Error__label, new String[0]),
                 new LabelImage(DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_THREAD_RUNNING)) {
                     { setPropertyNames(new String[] { ILaunchVMConstants.PROP_IS_SUSPENDED }); }
@@ -208,6 +211,13 @@
         if (reason != null) {
             update.setProperty(ILaunchVMConstants.PROP_STATE_CHANGE_REASON, data.getStateChangeReason().name());
         }
+
+        if (data instanceof IExecutionDMData2) {
+        	String details = ((IExecutionDMData2)data).getDetails();
+        	if (details != null) {
+            	update.setProperty(ILaunchVMConstants.PROP_STATE_CHANGE_DETAILS, details);
+        	}
+        }
     }
     
     @Override
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/launch/ExecutionContextLabelText.java	Wed Sep 09 11:13:29 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/launch/ExecutionContextLabelText.java	Wed Sep 09 12:47:57 2009 -0500
@@ -30,6 +30,11 @@
     /**
      * Value <code>0</code> means it's not known.  Value <code>1</code>, means it's known.
      */
+    public static final String PROP_STATE_CHANGE_DETAILS_KNOWN = "state_change_details_known";  //$NON-NLS-1$
+
+    /**
+     * Value <code>0</code> means it's not known.  Value <code>1</code>, means it's known.
+     */
     public static final String PROP_ID_KNOWN = "id_known";  //$NON-NLS-1$
 
     /**
@@ -68,12 +73,17 @@
                 reasonLabel = MessagesForLaunchVM.State_change_reason__Watchpoint__label;
             }
             return reasonLabel;
+        } else if ( ILaunchVMConstants.PROP_STATE_CHANGE_DETAILS.equals(propertyName) ) {
+            return properties.get(propertyName);
         } else if ( ILaunchVMConstants.PROP_IS_SUSPENDED.equals(propertyName) ) {
             Boolean suspended = (Boolean)properties.get(propertyName);
             return suspended ? 1 : 0;
         } else if ( PROP_STATE_CHANGE_REASON_KNOWN.equals(propertyName) ) {
             String reason = (String)properties.get(ILaunchVMConstants.PROP_STATE_CHANGE_REASON);
             return (reason != null && !StateChangeReason.UNKNOWN.name().equals(reason)) ? 1 : 0;
+        } else if ( PROP_STATE_CHANGE_DETAILS_KNOWN.equals(propertyName) ) {
+            String details = (String)properties.get(ILaunchVMConstants.PROP_STATE_CHANGE_DETAILS);
+            return (details != null) ? 1 : 0;
         } else if (PROP_NAME_KNOWN.equals(propertyName)) {
             return properties.get(IElementPropertiesProvider.PROP_NAME) != null ? 1 : 0;
         } else if (IElementPropertiesProvider.PROP_NAME.equals(propertyName)) {
@@ -94,6 +104,8 @@
             IElementPropertiesProvider.PROP_NAME.equals(propertyName) ||
             PROP_STATE_CHANGE_REASON_KNOWN.equals(propertyName) ||
             ILaunchVMConstants.PROP_STATE_CHANGE_REASON.equals(propertyName) ||
+            PROP_STATE_CHANGE_DETAILS_KNOWN.equals(propertyName) ||
+            ILaunchVMConstants.PROP_STATE_CHANGE_DETAILS.equals(propertyName) ||
             PROP_ID_KNOWN.equals(propertyName) ||
             ILaunchVMConstants.PROP_ID.equals(propertyName)) 
         {
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/launch/ILaunchVMConstants.java	Wed Sep 09 11:13:29 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/launch/ILaunchVMConstants.java	Wed Sep 09 12:47:57 2009 -0500
@@ -36,4 +36,6 @@
     
     public static final String PROP_STATE_CHANGE_REASON = "state_change_reason";  //$NON-NLS-1$
 
+    public static final String PROP_STATE_CHANGE_DETAILS = "state_change_details";  //$NON-NLS-1$
+
 }
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/launch/messages.properties	Wed Sep 09 11:13:29 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/launch/messages.properties	Wed Sep 09 12:47:57 2009 -0500
@@ -50,7 +50,9 @@
 # {4} - 0=running/1=suspended
 # {5} - state change reason available, 0=not available/1=available
 # {6} - state change reason
-AbstractThreadVMNode_No_columns__text_format={0,choice,0#Thread|1#{1}}{2,choice,0#|1# [{3}]} ({4,choice,0#Running|1#Suspended}{5,choice,0#|1# : {6}})
+# {7} - state change details available, 0=not available/1=available
+# {8} - state change details
+AbstractThreadVMNode_No_columns__text_format={0,choice,0#Thread|1#{1}}{2,choice,0#|1# [{3}]} ({4,choice,0#Running|1#Suspended}{5,choice,0#|1# : {6}}{7,choice,0#|1# - {8}})
 
 AbstractThreadVMNode_No_columns__Error__label=<unavailable>
 
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/IRunControl.java	Wed Sep 09 11:13:29 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/IRunControl.java	Wed Sep 09 12:47:57 2009 -0500
@@ -107,6 +107,15 @@
         StateChangeReason getStateChangeReason();
     }
 
+    public interface IExecutionDMData2 extends IExecutionDMData {
+        /**
+         * Optional method to return more detail about the suspended event, e.g.
+         * "Divide by zero exception"
+         * @return more detail about the suspended event, or null
+         */
+        String getDetails();
+    }
+
     /**
      * Retrieves execution data for given context.
      * @param dmc Context to retrieve data for.