mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-06 17:26:01 +02:00
Bug 290572: Cleanup of ReverseDebuggingPropertyTester to remove code that is no longer necessary.
This commit is contained in:
parent
d395d762b8
commit
1be3c0dbd9
2 changed files with 3 additions and 48 deletions
|
@ -281,13 +281,6 @@
|
||||||
properties="isReverseDebuggingEnabled"
|
properties="isReverseDebuggingEnabled"
|
||||||
type="org.eclipse.cdt.dsf.ui.viewmodel.datamodel.IDMVMContext">
|
type="org.eclipse.cdt.dsf.ui.viewmodel.datamodel.IDMVMContext">
|
||||||
</propertyTester>
|
</propertyTester>
|
||||||
<propertyTester
|
|
||||||
class="org.eclipse.cdt.dsf.gdb.internal.ui.actions.ReverseDebuggingPropertyTester"
|
|
||||||
id="org.eclipse.cdt.dsf.gdb.ui.partReverseDebuggingTester"
|
|
||||||
namespace="org.eclipse.cdt.debug.ui"
|
|
||||||
properties="isReverseDebuggingEnabled"
|
|
||||||
type="org.eclipse.ui.IWorkbenchPart">
|
|
||||||
</propertyTester>
|
|
||||||
</extension>
|
</extension>
|
||||||
<extension
|
<extension
|
||||||
point="org.eclipse.ui.preferencePages">
|
point="org.eclipse.ui.preferencePages">
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2009 Ericsson and others.
|
* Copyright (c) 2009, 2010 Ericsson and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -15,18 +15,10 @@ import org.eclipse.cdt.dsf.datamodel.DMContexts;
|
||||||
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
|
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
|
||||||
import org.eclipse.cdt.dsf.ui.viewmodel.datamodel.IDMVMContext;
|
import org.eclipse.cdt.dsf.ui.viewmodel.datamodel.IDMVMContext;
|
||||||
import org.eclipse.core.expressions.PropertyTester;
|
import org.eclipse.core.expressions.PropertyTester;
|
||||||
import org.eclipse.debug.ui.DebugUITools;
|
|
||||||
import org.eclipse.debug.ui.contexts.IDebugContextService;
|
|
||||||
import org.eclipse.jface.viewers.ISelection;
|
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
|
||||||
import org.eclipse.ui.IViewPart;
|
|
||||||
import org.eclipse.ui.IViewSite;
|
|
||||||
import org.eclipse.ui.IWorkbenchPart;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property tester for reverse debugging information available through the given
|
* Property tester for reverse debugging information available through the given
|
||||||
* object. The object being tested could either be a {@link IWorkbenchPart} or
|
* object. The object being tested is an {@link IDMVMContext}.
|
||||||
* a {@link IDMVMContext}.
|
|
||||||
* <p>
|
* <p>
|
||||||
* One property is supported:
|
* One property is supported:
|
||||||
* <ul>
|
* <ul>
|
||||||
|
@ -41,12 +33,7 @@ public class ReverseDebuggingPropertyTester extends PropertyTester {
|
||||||
|
|
||||||
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
|
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
|
||||||
if (ENABLED.equals(property)) {
|
if (ENABLED.equals(property)) {
|
||||||
if (receiver instanceof IWorkbenchPart) {
|
if (receiver instanceof IDMVMContext) {
|
||||||
Object selection = getContextSelectionForPart((IWorkbenchPart)receiver);
|
|
||||||
if (selection instanceof IDMVMContext) {
|
|
||||||
return test((IDMVMContext)selection);
|
|
||||||
}
|
|
||||||
} else if (receiver instanceof IDMVMContext) {
|
|
||||||
return test((IDMVMContext)receiver);
|
return test((IDMVMContext)receiver);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,29 +51,4 @@ public class ReverseDebuggingPropertyTester extends PropertyTester {
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Object getContextSelectionForPart(IWorkbenchPart part) {
|
|
||||||
IDebugContextService contextService =
|
|
||||||
DebugUITools.getDebugContextManager().getContextService(part.getSite().getWorkbenchWindow());
|
|
||||||
|
|
||||||
ISelection debugContext = contextService.getActiveContext(getPartId(part));
|
|
||||||
if (debugContext == null) {
|
|
||||||
debugContext = contextService.getActiveContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (debugContext instanceof IStructuredSelection) {
|
|
||||||
return ((IStructuredSelection)debugContext).getFirstElement();
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
private static String getPartId(IWorkbenchPart part) {
|
|
||||||
if (part instanceof IViewPart) {
|
|
||||||
IViewSite site = (IViewSite)part.getSite();
|
|
||||||
return site.getId() + (site.getSecondaryId() != null ? (":" + site.getSecondaryId()) : ""); //$NON-NLS-1$ //$NON-NLS-2$
|
|
||||||
} else {
|
|
||||||
return part.getSite().getId();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue