Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Loskutov2020-02-26 20:05:46 +0000
committerAndrey Loskutov2020-05-14 08:16:46 +0000
commiteb88fc52b3ea850a942e749b8eb3a764674d8417 (patch)
treeb3a00ea6921bb30c0594d3aafc343f92aa1857b6
parent84fc28ba536ab34a5311e337134fc5d0e13e00c8 (diff)
downloadeclipse.platform.debug-eb88fc52b3ea850a942e749b8eb3a764674d8417.tar.gz
eclipse.platform.debug-eb88fc52b3ea850a942e749b8eb3a764674d8417.tar.xz
eclipse.platform.debug-eb88fc52b3ea850a942e749b8eb3a764674d8417.zip
Bug 563154 - Add tracing to DebugCommandService
Change-Id: I9549ebac8e45d70f3141e45a20887ec5a15fbb55 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/commands/AbstractDebugCommand.java5
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/DebugCommandRequest.java6
-rw-r--r--org.eclipse.debug.ui/.options1
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java13
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandService.java17
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/UpdateActionsRequest.java9
6 files changed, 45 insertions, 6 deletions
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 89f371ded..0471431ca 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 abstract class AbstractDebugCommand implements IDebugCommandHandler {
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 eac8a170a..14c8f661a 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 @@ public class DebugCommandRequest extends Request implements IDebugCommandRequest
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 1b586a599..24f7c7e4c 100644
--- a/org.eclipse.debug.ui/.options
+++ b/org.eclipse.debug.ui/.options
@@ -11,3 +11,4 @@ org.eclipse.debug.ui/debug/viewers/stateSaveRestore = false
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 08680061c..4095e260a 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 class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener,
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 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener,
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 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener,
}
/**
- * 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 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener,
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 8bfeda65f..96afac9b8 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.core.runtime.jobs.Job;
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 @@ public class DebugCommandService implements IDebugContextListener {
/**
* 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 @@ public class DebugCommandService implements IDebugContextListener {
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 @@ public class DebugCommandService implements IDebugContextListener {
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 @@ public class DebugCommandService implements IDebugContextListener {
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 b40a9aede..701099563 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 @@ public class UpdateActionsRequest extends DebugCommandRequest implements IEnable
}
}
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + " on " + fActions.length //$NON-NLS-1$
+ + " actions from " //$NON-NLS-1$
+ + Arrays.toString(getElements());
+ }
+
}

Back to the top