1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

Bug 290572 - [reverse] Reverse buttons don't appear as soon as we turn on Reverse Debugging

This commit is contained in:
Anton Leherbauer 2010-12-22 11:22:16 +00:00
parent 7d24065c7d
commit d395d762b8
2 changed files with 44 additions and 26 deletions

View file

@ -1918,20 +1918,16 @@
<reference <reference
definitionId="org.eclipse.cdt.debug.ui.testIsReverseDebuggingActionSetActive"> definitionId="org.eclipse.cdt.debug.ui.testIsReverseDebuggingActionSetActive">
</reference> </reference>
<or>
<with <with
variable="activePart"> variable="debugContext">
<test <iterate
property="org.eclipse.cdt.debug.ui.isReverseDebuggingEnabled"> ifEmpty="false"
</test> operator="and">
<test
property="org.eclipse.cdt.debug.ui.isReverseDebuggingEnabled">
</test>
</iterate>
</with> </with>
<with
variable="selection">
<test
property="org.eclipse.cdt.debug.ui.isReverseDebuggingEnabled">
</test>
</with>
</or>
</and> </and>
</definition> </definition>
<definition id="org.eclipse.cdt.debug.ui.testIsTracepointActionSetActive"> <definition id="org.eclipse.cdt.debug.ui.testIsTracepointActionSetActive">

View file

@ -15,7 +15,11 @@ import java.util.Map;
import org.eclipse.cdt.debug.core.model.IReverseToggleHandler; import org.eclipse.cdt.debug.core.model.IReverseToggleHandler;
import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IAdapterManager; import org.eclipse.core.runtime.IAdapterManager;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.IRequest;
import org.eclipse.debug.ui.DebugUITools; import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.actions.DebugCommandHandler; import org.eclipse.debug.ui.actions.DebugCommandHandler;
import org.eclipse.debug.ui.contexts.DebugContextEvent; import org.eclipse.debug.ui.contexts.DebugContextEvent;
@ -28,6 +32,8 @@ import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.commands.ICommandService; import org.eclipse.ui.commands.ICommandService;
import org.eclipse.ui.commands.IElementUpdater; import org.eclipse.ui.commands.IElementUpdater;
import org.eclipse.ui.menus.UIElement; import org.eclipse.ui.menus.UIElement;
import org.eclipse.ui.progress.WorkbenchJob;
import org.eclipse.ui.services.IEvaluationService;
/** /**
* Command handler to toggle reverse debugging mode * Command handler to toggle reverse debugging mode
@ -35,10 +41,10 @@ import org.eclipse.ui.menus.UIElement;
* @since 7.0 * @since 7.0
*/ */
public class ReverseToggleCommandHandler extends DebugCommandHandler implements IDebugContextListener, IElementUpdater { public class ReverseToggleCommandHandler extends DebugCommandHandler implements IDebugContextListener, IElementUpdater {
@Override @Override
protected Class<?> getCommandType() { protected Class<?> getCommandType() {
return IReverseToggleHandler.class; return IReverseToggleHandler.class;
} }
// //
// The below logic allows us to keep the checked state of the toggle button // The below logic allows us to keep the checked state of the toggle button
@ -71,14 +77,14 @@ public class ReverseToggleCommandHandler extends DebugCommandHandler implements
} }
@Override @Override
public void dispose() { public void dispose() {
// Must use the stored context service. If we try to fetch the service // Must use the stored context service. If we try to fetch the service
// again with the workbenchWindow, it may fail if the window is // again with the workbenchWindow, it may fail if the window is
// already closed. // already closed.
if (fContextService != null) { if (fContextService != null) {
fContextService.removePostDebugContextListener(this); fContextService.removePostDebugContextListener(this);
} }
fTargetAdapter = null; fTargetAdapter = null;
super.dispose(); super.dispose();
} }
@ -115,8 +121,24 @@ public class ReverseToggleCommandHandler extends DebugCommandHandler implements
return adapter; return adapter;
} }
public void updateElement(UIElement element, @Override
@SuppressWarnings("unchecked") Map parameters) { protected void postExecute(IRequest request, Object[] targets) {
super.postExecute(request, targets);
// request re-evaluation of property "org.eclipse.cdt.debug.ui.isReverseDebuggingEnabled"
new WorkbenchJob("") { //$NON-NLS-1$
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
IEvaluationService exprService = (IEvaluationService) PlatformUI.getWorkbench().getService(IEvaluationService.class);
if (exprService != null) {
exprService.requestEvaluation("org.eclipse.cdt.debug.ui.isReverseDebuggingEnabled"); //$NON-NLS-1$
}
return Status.OK_STATUS;
}
}.schedule();
}
public void updateElement(UIElement element,
@SuppressWarnings("rawtypes") Map parameters) {
// Make sure the toggle state reflects the actual state // Make sure the toggle state reflects the actual state
// We must check this, in case we have multiple launches // We must check this, in case we have multiple launches
// or if we re-launch (restart) // or if we re-launch (restart)