diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/plugin.xml b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/plugin.xml index 226008465d9..74b85610460 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/plugin.xml +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/plugin.xml @@ -318,17 +318,6 @@ - - - - - - - - - + + + + + + + + diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/DisassemblyToggleBreakpointsTarget.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/DisassemblyToggleBreakpointsTarget.java similarity index 99% rename from dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/DisassemblyToggleBreakpointsTarget.java rename to dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/DisassemblyToggleBreakpointsTarget.java index f3848214d11..f5918c9b9b7 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/DisassemblyToggleBreakpointsTarget.java +++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/DisassemblyToggleBreakpointsTarget.java @@ -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; diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/Messages.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/Messages.java new file mode 100644 index 00000000000..2d39d3dfa2f --- /dev/null +++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/Messages.java @@ -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() { + } +} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/ToggleBreakpointsTargetFactory.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/ToggleBreakpointsTargetFactory.java similarity index 70% rename from dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/ToggleBreakpointsTargetFactory.java rename to dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/ToggleBreakpointsTargetFactory.java index a4b6862dc58..c5120997003 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/ToggleBreakpointsTargetFactory.java +++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/ToggleBreakpointsTargetFactory.java @@ -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; + } + } diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/messages.properties b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/messages.properties new file mode 100644 index 00000000000..3a4d2afadc8 --- /dev/null +++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/messages.properties @@ -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