diff --git a/dsf/org.eclipse.cdt.dsf/.options b/dsf/org.eclipse.cdt.dsf/.options index 9f4737ddab8..695cffd7f84 100644 --- a/dsf/org.eclipse.cdt.dsf/.options +++ b/dsf/org.eclipse.cdt.dsf/.options @@ -4,4 +4,5 @@ org.eclipse.cdt.dsf/debug/executorName = org.eclipse.cdt.dsf/debugCache = false org.eclipse.cdt.dsf/debug/session = false org.eclipse.cdt.dsf/debug/session/listeners = false -org.eclipse.cdt.dsf/debug/session/dispatches = false \ No newline at end of file +org.eclipse.cdt.dsf/debug/session/dispatches = false +org.eclipse.cdt.dsf/debug/session/modelAdapters = false \ No newline at end of file diff --git a/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/service/DsfSession.java b/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/service/DsfSession.java index 897016694c4..a17eb43823f 100644 --- a/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/service/DsfSession.java +++ b/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/service/DsfSession.java @@ -81,6 +81,14 @@ public class DsfSession */ private static final boolean DEBUG_SESSION_DISPATCHES; + /** + * Has the "debug/session/modelAdapters" tracing option been turned on? Requires + * "debug/session" to also be turned on. + * + * @since 2.1 + */ + private static final boolean DEBUG_SESSION_MODELADAPTERS; + static { DEBUG_SESSION = DsfPlugin.DEBUG && "true".equals( //$NON-NLS-1$ Platform.getDebugOption("org.eclipse.cdt.dsf/debug/session")); //$NON-NLS-1$ @@ -88,6 +96,8 @@ public class DsfSession Platform.getDebugOption("org.eclipse.cdt.dsf/debug/session/listeners")); //$NON-NLS-1$ DEBUG_SESSION_DISPATCHES = DEBUG_SESSION && "true".equals( //$NON-NLS-1$ Platform.getDebugOption("org.eclipse.cdt.dsf/debug/session/dispatches")); //$NON-NLS-1$ + DEBUG_SESSION_MODELADAPTERS = DEBUG_SESSION && "true".equals( //$NON-NLS-1$ + Platform.getDebugOption("org.eclipse.cdt.dsf/debug/session/modelAdapters")); //$NON-NLS-1$ } /** @@ -361,6 +371,19 @@ public class DsfSession */ @ThreadSafe public void registerModelAdapter(Class adapterType, Object adapter) { + if (DEBUG_SESSION_MODELADAPTERS) { + String msg = new Formatter().format( + "%s Registering model adapter %s of type %s to session %s (%s)", //$NON-NLS-1$ + DsfPlugin.getDebugTime(), + LoggingUtils.toString(adapter), + adapterType.getName(), + LoggingUtils.toString(this), + getId() + ).toString(); + + DsfPlugin.debug(msg); + } + fAdapters.put(adapterType, adapter); } @@ -371,6 +394,18 @@ public class DsfSession */ @ThreadSafe public void unregisterModelAdapter(Class adapterType) { + if (DEBUG_SESSION_MODELADAPTERS) { + String msg = new Formatter().format( + "%s Unregistering model adapter of type %s from session %s (%s)", //$NON-NLS-1$ + DsfPlugin.getDebugTime(), + adapterType.getName(), + LoggingUtils.toString(this), + getId() + ).toString(); + + DsfPlugin.debug(msg); + } + fAdapters.remove(adapterType); }