Bug 563154 - Add tracing to DebugCommandService
Change-Id: I9549ebac8e45d70f3141e45a20887ec5a15fbb55
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/commands/AbstractDebugCommand.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/commands/AbstractDebugCommand.java
index 89f371d..0471431 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/commands/AbstractDebugCommand.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/commands/AbstractDebugCommand.java
@@ -162,6 +162,11 @@
public void sleeping(IJobChangeEvent event) {
}
+ @Override
+ public String toString() {
+ return getName() + " on " + request; //$NON-NLS-1$
+ }
+
}
/**
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/DebugCommandRequest.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/DebugCommandRequest.java
index eac8a17..14c8f66 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/DebugCommandRequest.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/DebugCommandRequest.java
@@ -13,6 +13,8 @@
*******************************************************************************/
package org.eclipse.debug.internal.core.commands;
+import java.util.Arrays;
+
import org.eclipse.debug.core.commands.IDebugCommandRequest;
/**
@@ -31,5 +33,9 @@
return fElements;
}
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + " on " + Arrays.toString(fElements); //$NON-NLS-1$
+ }
}
diff --git a/org.eclipse.debug.ui/.options b/org.eclipse.debug.ui/.options
index 1b586a5..24f7c7e 100644
--- a/org.eclipse.debug.ui/.options
+++ b/org.eclipse.debug.ui/.options
@@ -11,3 +11,4 @@
org.eclipse.debug.ui/debug/viewers/presentationId =
org.eclipse.debug.ui/debug/breadcrumb = false
org.eclipse.debug.ui/debug/memory/dynamicLoading = false
+org.eclipse.debug.ui/debug/commandservice = false
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java
index 0868006..4095e26 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java
@@ -142,6 +142,7 @@
public static boolean DEBUG_STATE_SAVE_RESTORE = false;
public static String DEBUG_PRESENTATION_ID = null;
public static boolean DEBUG_DYNAMIC_LOADING = false;
+ public static boolean DEBUG_COMMAND_SERVICE = false;
static final String DEBUG_FLAG = "org.eclipse.debug.ui/debug"; //$NON-NLS-1$
static final String DEBUG_BREAKPOINT_DELTAS_FLAG = "org.eclipse.debug.ui/debug/viewers/breakpointDeltas"; //$NON-NLS-1$
@@ -155,6 +156,7 @@
static final String DEBUG_STATE_SAVE_RESTORE_FLAG = "org.eclipse.debug.ui/debug/viewers/stateSaveRestore"; //$NON-NLS-1$
static final String DEBUG_PRESENTATION_ID_FLAG ="org.eclipse.debug.ui/debug/viewers/presentationId"; //$NON-NLS-1$
static final String DEBUG_DYNAMIC_LOADING_FLAG = "org.eclipse.debug.ui/debug/memory/dynamicLoading"; //$NON-NLS-1$
+ static final String DEBUG_COMMAND_SERVICE_FLAG = "org.eclipse.debug.ui/debug/commandservice"; //$NON-NLS-1$
/**
* The {@link DebugTrace} object to print to OSGi tracing
* @since 3.8
@@ -260,16 +262,18 @@
}
/**
- * Prints the given message to System.out and to the OSGi tracing (if started)
- * @param option the option or <code>null</code>
- * @param message the message to print or <code>null</code>
+ * Prints the given message to System.out or to the OSGi tracing (if started)
+ *
+ * @param option the option or <code>null</code>
+ * @param message the message to print or <code>null</code>
* @param throwable the {@link Throwable} or <code>null</code>
* @since 3.8
*/
public static void trace(String option, String message, Throwable throwable) {
- System.out.println(message);
if(fgDebugTrace != null) {
fgDebugTrace.trace(option, message, throwable);
+ } else {
+ System.out.println(message);
}
}
@@ -595,6 +599,7 @@
DEBUG_DELTAS = DEBUG && options.getBooleanOption(DEBUG_DELTAS_FLAG, false);
DEBUG_STATE_SAVE_RESTORE = DEBUG && options.getBooleanOption(DEBUG_STATE_SAVE_RESTORE_FLAG, false);
DEBUG_DYNAMIC_LOADING = DEBUG && options.getBooleanOption(DEBUG_DYNAMIC_LOADING_FLAG, false);
+ DEBUG_COMMAND_SERVICE = DEBUG && options.getBooleanOption(DEBUG_COMMAND_SERVICE_FLAG, false);
if(DEBUG) {
DEBUG_PRESENTATION_ID = options.getOption(DEBUG_PRESENTATION_ID_FLAG, IInternalDebugCoreConstants.EMPTY_STRING);
if(IInternalDebugCoreConstants.EMPTY_STRING.equals(DEBUG_PRESENTATION_ID)) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandService.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandService.java
index 8bfeda6..96afac9 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandService.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandService.java
@@ -23,6 +23,7 @@
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.commands.IDebugCommandHandler;
import org.eclipse.debug.core.commands.IDebugCommandRequest;
+import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.contexts.DebugContextEvent;
import org.eclipse.debug.ui.contexts.IDebugContextListener;
@@ -48,12 +49,12 @@
/**
* Window this service is for.
*/
- private IWorkbenchWindow fWindow = null;
+ private IWorkbenchWindow fWindow;
/**
* The context service for this command service.
*/
- private IDebugContextService fContextService = null;
+ private IDebugContextService fContextService;
/**
* Service per window
@@ -186,6 +187,9 @@
IDebugCommandHandler handler = getHandler(element, handlerType);
if (handler != null) {
UpdateActionsRequest request = new UpdateActionsRequest(elements, actions);
+ if (DebugUIPlugin.DEBUG_COMMAND_SERVICE) {
+ DebugUIPlugin.trace(request + " to " + handler); //$NON-NLS-1$
+ }
handler.canExecute(request);
return;
}
@@ -195,6 +199,9 @@
ActionsUpdater updater = new ActionsUpdater(actions, map.size());
for (Entry<IDebugCommandHandler, List<Object>> entry : map.entrySet()) {
UpdateHandlerRequest request = new UpdateHandlerRequest(entry.getValue().toArray(), updater);
+ if (DebugUIPlugin.DEBUG_COMMAND_SERVICE) {
+ DebugUIPlugin.trace(request + " to " + entry.getKey()); //$NON-NLS-1$
+ }
entry.getKey().canExecute(request);
}
return;
@@ -291,6 +298,12 @@
if (handlerType != null) {
boolean hasMultipleWindowServices = hasMultipleWindowServices();
if (!hasMultipleWindowServices) {
+ if (DebugUIPlugin.DEBUG_COMMAND_SERVICE) {
+ Job[] jobs = Job.getJobManager().find(handlerType);
+ for (Job job : jobs) {
+ DebugUIPlugin.trace("WOULD cancel " + job); //$NON-NLS-1$
+ }
+ }
Job.getJobManager().cancel(handlerType);
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/UpdateActionsRequest.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/UpdateActionsRequest.java
index b40a9ae..7010995 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/UpdateActionsRequest.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/UpdateActionsRequest.java
@@ -13,6 +13,8 @@
*******************************************************************************/
package org.eclipse.debug.internal.ui.commands.actions;
+import java.util.Arrays;
+
import org.eclipse.debug.core.commands.IEnabledStateRequest;
import org.eclipse.debug.internal.core.commands.DebugCommandRequest;
@@ -47,4 +49,11 @@
}
}
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + " on " + fActions.length //$NON-NLS-1$
+ + " actions from " //$NON-NLS-1$
+ + Arrays.toString(getElements());
+ }
+
}