1
/*******************************************************************************
2
* Copyright (c) 2008 Wind River Systems, Inc. and others.
3
* All rights reserved. This program and the accompanying materials
4
* are made available under the terms of the Eclipse Public License v1.0
5
* which accompanies this distribution, and is available at
6
* http://www.eclipse.org/legal/epl-v10.html
9
* Wind River Systems - initial API and implementation
10
*******************************************************************************/
11
package org.eclipse.cdt.dsf.debug.internal.ui.disassembly.actions;
13
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
14
import org.eclipse.cdt.debug.internal.ui.CBreakpointContext;
15
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.DisassemblyMessages;
16
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.IDisassemblyPart;
17
import org.eclipse.debug.core.model.IBreakpoint;
18
import org.eclipse.debug.ui.DebugUITools;
19
import org.eclipse.jface.text.source.IVerticalRulerInfo;
20
import org.eclipse.jface.viewers.ISelection;
21
import org.eclipse.jface.viewers.ISelectionChangedListener;
22
import org.eclipse.jface.viewers.ISelectionProvider;
23
import org.eclipse.jface.viewers.StructuredSelection;
24
import org.eclipse.ui.dialogs.PropertyDialogAction;
27
* Ruler action to display breakpoint properties.
29
public class BreakpointPropertiesRulerAction extends AbstractDisassemblyBreakpointRulerAction {
31
private Object fContext;
33
protected BreakpointPropertiesRulerAction(IDisassemblyPart disassemblyPart, IVerticalRulerInfo rulerInfo) {
34
super(disassemblyPart, rulerInfo);
35
setText(DisassemblyMessages.Disassembly_action_BreakpointProperties_label);
39
* @see org.eclipse.cdt.dsf.debug.internal.ui.disassembly.actions.AbstractDisassemblyAction#run()
43
if ( fContext != null ) {
44
PropertyDialogAction action = new PropertyDialogAction( getDisassemblyPart().getSite(), new ISelectionProvider() {
46
public void addSelectionChangedListener( ISelectionChangedListener listener ) {
49
public ISelection getSelection() {
50
return new StructuredSelection( fContext );
53
public void removeSelectionChangedListener( ISelectionChangedListener listener ) {
56
public void setSelection( ISelection selection ) {
65
* @see IUpdate#update()
68
public void update() {
69
IBreakpoint breakpoint= getBreakpoint();
70
if (breakpoint instanceof ICBreakpoint) {
71
fContext = new CBreakpointContext((ICBreakpoint)breakpoint, getDebugContext());
73
fContext = breakpoint;
75
setEnabled( fContext != null );
78
private ISelection getDebugContext() {
79
return DebugUITools.getDebugContextManager().getContextService(getDisassemblyPart().getSite().getWorkbenchWindow()).getActiveContext();