1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-05 16:56:04 +02:00

Bug 305071 - Support breakpoints in Disassembly at the DSF level.

This commit is contained in:
Ken Ryall 2010-03-09 16:53:32 +00:00
parent 74a6686a10
commit 2edac02083
8 changed files with 82 additions and 18 deletions

View file

@ -318,17 +318,6 @@
</initializer>
</extension>
<extension point="org.eclipse.debug.ui.toggleBreakpointsTargetFactories">
<toggleTargetFactory
id="org.eclipse.cdt.dsf.gdb.ui.ToggleBreakpointsTargetFactory"
class="org.eclipse.cdt.dsf.gdb.internal.ui.breakpoints.ToggleBreakpointsTargetFactory">
<enablement>
<!-- Enable the breakpoint toggle for DSF Disassembly -->
<instanceof value="org.eclipse.cdt.dsf.debug.internal.ui.disassembly.DisassemblyPart"/>
</enablement>
</toggleTargetFactory>
</extension>
<extension
point="org.eclipse.cdt.ui.textHovers">
<hover

View file

@ -15,8 +15,6 @@ import org.eclipse.osgi.util.NLS;
public class Messages extends NLS {
private static final String BUNDLE_NAME= "org.eclipse.cdt.dsf.gdb.internal.ui.breakpoints.messages"; //$NON-NLS-1$
public static String ToggleBreakpointsTargetFactory_description;
public static String ToggleBreakpointsTargetFactory_name;
public static String ToggleTracepointsTargetFactory_description;
public static String ToggleTracepointsTargetFactory_name;
public static String TracepointPropertyPage_integer_negative;

View file

@ -10,8 +10,6 @@
# Ericsson - added Tracepoint support
###############################################################################
ToggleBreakpointsTargetFactory_description=Standard C/C++ breakpoint type.
ToggleBreakpointsTargetFactory_name=C/C++ Breakpoints
ToggleTracepointsTargetFactory_description=Standard C/C++ tracepoint type.
ToggleTracepointsTargetFactory_name=C/C++ Tracepoints

View file

@ -695,5 +695,15 @@
</factory>
</extension>
<extension point="org.eclipse.debug.ui.toggleBreakpointsTargetFactories">
<toggleTargetFactory
id="org.eclipse.cdt.dsf.ui.ToggleBreakpointsTargetFactory"
class="org.eclipse.cdt.dsf.debug.internal.ui.ToggleBreakpointsTargetFactory">
<enablement>
<!-- Enable the breakpoint toggle for DSF Disassembly -->
<instanceof value="org.eclipse.cdt.dsf.debug.internal.ui.disassembly.DisassemblyPart"/>
</enablement>
</toggleTargetFactory>
</extension>
</plugin>

View file

@ -8,7 +8,7 @@
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal.ui.breakpoints;
package org.eclipse.cdt.dsf.debug.internal.ui;
import java.net.URI;
import java.util.ArrayList;

View file

@ -0,0 +1,28 @@
/*******************************************************************************
* Copyright (c) 2009 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.dsf.debug.internal.ui;
import org.eclipse.osgi.util.NLS;
public class Messages extends NLS {
private static final String BUNDLE_NAME= "org.eclipse.cdt.dsf.internal.ui.messages"; //$NON-NLS-1$
public static String ToggleBreakpointsTargetFactory_description;
public static String ToggleBreakpointsTargetFactory_name;
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
}
private Messages() {
}
}

View file

@ -8,17 +8,24 @@
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal.ui.breakpoints;
package org.eclipse.cdt.dsf.debug.internal.ui;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import org.eclipse.cdt.debug.core.CDIDebugModel;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblyPart;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.debug.core.model.IDebugModelProvider;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
import org.eclipse.debug.ui.actions.IToggleBreakpointsTargetFactory;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.ui.IWorkbenchPart;
/**
@ -61,7 +68,18 @@ public class ToggleBreakpointsTargetFactory implements IToggleBreakpointsTargetF
public String getDefaultToggleTarget(IWorkbenchPart part, ISelection selection) {
if (part instanceof IDisassemblyPart) {
return TOGGLE_C_BREAKPOINT_TARGET_ID;
Object element = getDebugContext(part).getFirstElement();
if (element instanceof IAdaptable) {
IDebugModelProvider modelProvider =
(IDebugModelProvider)((IAdaptable)element).getAdapter(IDebugModelProvider.class);
if (modelProvider != null) {
String[] models = modelProvider.getModelIdentifiers();
if (Arrays.asList(models).contains(CDIDebugModel.getPluginIdentifier())) {
return TOGGLE_C_BREAKPOINT_TARGET_ID;
}
}
}
return null;
}
return null;
}
@ -81,4 +99,13 @@ public class ToggleBreakpointsTargetFactory implements IToggleBreakpointsTargetF
return Collections.emptySet();
}
private IStructuredSelection getDebugContext(IWorkbenchPart part) {
ISelection selection = DebugUITools.getDebugContextManager().
getContextService(part.getSite().getWorkbenchWindow()).getActiveContext();
if (selection instanceof IStructuredSelection) {
return (IStructuredSelection)selection;
}
return StructuredSelection.EMPTY;
}
}

View file

@ -0,0 +1,14 @@
###############################################################################
# Copyright (c) 2009 Wind River Systems and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors:
# Wind River Systems - initial API and implementation
# Ericsson - added Tracepoint support
###############################################################################
ToggleBreakpointsTargetFactory_description=Standard C/C++ breakpoint type.
ToggleBreakpointsTargetFactory_name=C/C++ Breakpoints