Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions')
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ActionMessages.properties16
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddGlobalsActionDelegate.java339
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddWatchpointDialog.java436
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/BinaryVariableFormatActionDelegate.java26
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/CanFormatObjectTester.java45
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/DecVariableFormatActionDelegate.java26
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/DisableVariablesActionDelegate.java29
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/EnableVariablesActionDelegate.java159
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/HexVariableFormatActionDelegate.java26
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/LoadSymbolsForAllActionDelegate.java105
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/MoveToLineAdapter.java34
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/NaturalVariableFormatActionDelegate.java26
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/NumberFormatsContribution.java121
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RemoveAllGlobalsActionDelegate.java137
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RemoveGlobalsActionDelegate.java125
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ResumeAtLineAdapter.java32
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RunToLineAdapter.java32
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleInstructionStepModeActionDelegate.java16
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/VariableFormatActionDelegate.java150
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/ToggleBreakpointAdapter.java24
20 files changed, 6 insertions, 1898 deletions
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ActionMessages.properties b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ActionMessages.properties
index 5e60116ca7d..0b4f3ece6af 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ActionMessages.properties
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ActionMessages.properties
@@ -19,10 +19,7 @@ LoadSymbolsActionDelegate.Unable_to_load_symbols_of_shared_library_1=Unable to l
LoadSymbolsActionDelegate.Operation_failed_1=Operation failed.
LoadSymbolsForAllAction.Load_Symbols_For_All_1=Load Symbols For All
LoadSymbolsForAllAction.Load_symbols_for_all_shared_libraries_1=Load symbols for all shared libraries.
-LoadSymbolsForAllActionDelegate.Error(s)_occurred_loading_the_symbols_1=Error(s) occurred loading the symbols.
LoadSymbolsForAllAction.Load_Symbols_For_All_2=Load Symbols For All
-LoadSymbolsForAllActionDelegate.Error_1=Error
-LoadSymbolsForAllActionDelegate.0=Operation failed.
LoadModuleSymbolsActionDelegate.0=Unable to load symbols.
LoadSymbolsForAllAction.Unable_to_load_symbols_1=Unable to load symbols.
SignalZeroObjectActionDelegate.0=Unable to resume ignoring the signal.
@@ -64,14 +61,10 @@ MoveToLineAdapter.1=Missing document
MoveToLineAdapter.2=Empty editor
MoveToLineAdapter.3=Operation is not supported.
MoveToLineAdapter.4=Move To Line failed.
-AddGlobalsActionDelegate.title=Global Variables
-AddGlobalsActionDelegate.Error(s)_occured_adding_globals_1=Error(s) occurred adding globals.
ManageFunctionBreakpointActionDelegate.Error_1=Error
ManageFunctionBreakpointActionDelegate.Operation_failed_1=Operation failed.
SignalActionDelegate.0=Unable to deliver the signal to the target.
SignalActionDelegate.1=Operation failed.
-AddGlobalsActionDelegate.0=Select Variables:
-AddGlobalsActionDelegate.1=Add global variables failed.
VariableFormatActionDelegate.0=Unable to set format.
ExpressionDialog.0=Add Watch Expression
ExpressionDialog.1=Expression to watch:
@@ -88,18 +81,9 @@ CastToArrayActionDelegate.5=The 'Length' field must not be empty.
CastToArrayActionDelegate.6=Invalid length.
CastToArrayActionDelegate.7=The length must be greater than 0.
CastToArrayActionDelegate.8=Unable to display this variable as an array.
-EnableVariablesActionDelegate.0=Exceptions occurred enabling the variable(s).
-EnableVariablesActionDelegate.1=Enable variable(s) failed.
AddFunctionBreakpointActionDelegate.0=Cannot add function breakpoint.
AddLineBreakpointActionDelegate.0=Cannot add line breakpoint.
AddWatchpointActionDelegate.0=Cannot add watchpoint.
-AddWatchpointDialog.0=Add Watchpoint
-AddWatchpointDialog.1=Expression to watch:
-AddWatchpointDialog.2=Access
-AddWatchpointDialog.3=Write
-AddWatchpointDialog.4=Read
-AddWatchpointDialog.5=Memory space:
-AddWatchpointDialog.6=Units:
AddWatchpointOnVariableActionDelegate.No_Element_Size=Failed to get variable/expression size
AddWatchpointOnVariableActionDelegate.Error_Dlg_Title=Error
ResumeAtLineAdapter.0=Empty editor
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddGlobalsActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddGlobalsActionDelegate.java
deleted file mode 100644
index c799394ac5e..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddGlobalsActionDelegate.java
+++ /dev/null
@@ -1,339 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2015 QNX Software 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:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.actions;
-
-import java.util.Arrays;
-import java.util.List;
-import org.eclipse.cdt.debug.core.ICGlobalVariableManager;
-import org.eclipse.cdt.debug.core.model.IExecFileInfo;
-import org.eclipse.cdt.debug.core.model.IGlobalVariableDescriptor;
-import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.model.IDebugElement;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.debug.ui.IDebugUIConstants;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IPartListener;
-import org.eclipse.ui.ISelectionListener;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.actions.ActionDelegate;
-import org.eclipse.ui.dialogs.ListSelectionDialog;
-
-/**
- * A delegate for the "Add Globals" action.
- */
-public class AddGlobalsActionDelegate extends ActionDelegate implements IViewActionDelegate, ISelectionListener, IPartListener {
-
-
- class SortedListSelectionDialog extends ListSelectionDialog {
-
- public SortedListSelectionDialog( Shell parentShell, Object input, IStructuredContentProvider contentProvider, ILabelProvider labelProvider, String message ) {
- super( parentShell, input, contentProvider, labelProvider, message );
- }
-
- @Override
- protected Control createDialogArea( Composite parent ) {
- Control da = super.createDialogArea( parent );
- getViewer().setSorter( new ViewerSorter() );
- return da;
- }
- }
-
- private IGlobalVariableDescriptor[] fGlobals;
-
- private IViewPart fView = null;
-
- private IAction fAction;
-
- private IStructuredSelection fSelection;
-
- private IStatus fStatus = null;
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.IViewActionDelegate#init(IViewPart)
- */
- @Override
- public void init( IViewPart view ) {
- fView = view;
- view.getSite().getPage().addPartListener( this );
- view.getSite().getPage().addSelectionListener( IDebugUIConstants.ID_DEBUG_VIEW, this );
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.ISelectionListener#selectionChanged(IWorkbenchPart, ISelection)
- */
- @Override
- public void selectionChanged( IWorkbenchPart part, ISelection selection ) {
- if ( part != null && part.getSite().getId().equals( IDebugUIConstants.ID_DEBUG_VIEW ) ) {
- if ( selection instanceof IStructuredSelection ) {
- setSelection( (IStructuredSelection)selection );
- }
- else {
- setSelection( null );
- }
- update( getAction() );
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.IActionDelegate#run(IAction)
- */
- @Override
- public void run( IAction action ) {
- final IStructuredSelection selection = getSelection();
- if ( selection == null || selection.size() != 1 )
- return;
- BusyIndicator.showWhile( Display.getCurrent(), new Runnable() {
-
- @Override
- public void run() {
- try {
- doAction( selection.getFirstElement() );
- setStatus( null );
- }
- catch( DebugException e ) {
- setStatus( e.getStatus() );
- }
- }
- } );
- IStatus status = getStatus();
- if ( status != null && !status.isOK() ) {
- if ( status.isMultiStatus() ) {
- status = new MultiStatus( status.getPlugin(), status.getCode(), status.getChildren(), ActionMessages.getString( "AddGlobalsActionDelegate.Error(s)_occured_adding_globals_1" ), status.getException() ); //$NON-NLS-1$
- }
- IWorkbenchWindow window = CDebugUIPlugin.getActiveWorkbenchWindow();
- if ( window != null ) {
- CDebugUIPlugin.errorDialog( getErrorDialogMessage(), status );
- }
- else {
- CDebugUIPlugin.log( status );
- }
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection)
- */
- @Override
- public void selectionChanged( IAction action, ISelection selection ) {
- setAction( action );
- if ( getView() != null ) {
- update( action );
- }
- }
-
- protected void update( IAction action ) {
- if ( action != null ) {
- action.setEnabled( getEnableStateForSelection( getSelection() ) );
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.IPartListener#partActivated(IWorkbenchPart)
- */
- @Override
- public void partActivated( IWorkbenchPart part ) {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.IPartListener#partBroughtToTop(IWorkbenchPart)
- */
- @Override
- public void partBroughtToTop( IWorkbenchPart part ) {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.IPartListener#partClosed(IWorkbenchPart)
- */
- @Override
- public void partClosed( IWorkbenchPart part ) {
- if ( part.equals( getView() ) ) {
- dispose();
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.IPartListener#partDeactivated(IWorkbenchPart)
- */
- @Override
- public void partDeactivated( IWorkbenchPart part ) {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.IPartListener#partOpened(IWorkbenchPart)
- */
- @Override
- public void partOpened( IWorkbenchPart part ) {
- }
-
- protected IViewPart getView() {
- return fView;
- }
-
- protected void setView( IViewPart viewPart ) {
- fView = viewPart;
- }
-
- protected void setAction( IAction action ) {
- fAction = action;
- }
-
- protected IAction getAction() {
- return fAction;
- }
-
- private void setSelection( IStructuredSelection selection ) {
- fSelection = selection;
- }
-
- private IStructuredSelection getSelection() {
- return fSelection;
- }
-
- @Override
- public void dispose() {
- if ( getView() != null ) {
- getView().getViewSite().getPage().removeSelectionListener( IDebugUIConstants.ID_DEBUG_VIEW, this );
- getView().getViewSite().getPage().removePartListener( this );
- }
- }
-
- protected boolean getEnableStateForSelection( IStructuredSelection selection ) {
- if ( selection == null || selection.size() != 1 ) {
- return false;
- }
- Object element = selection.getFirstElement();
- return (element != null && element instanceof IDebugElement && ((IDebugElement)element).getDebugTarget().getAdapter( IExecFileInfo.class ) != null);
- }
-
- private SortedListSelectionDialog createDialog() {
- return new SortedListSelectionDialog( getView().getSite().getShell(), fGlobals, new IStructuredContentProvider() {
-
- @Override
- public void inputChanged( Viewer viewer, Object oldInput, Object newInput ) {
- }
-
- @Override
- public void dispose() {
- }
-
- @Override
- public Object[] getElements( Object parent ) {
- return getGlobals();
- }
- }, new LabelProvider() {
-
- @Override
- public String getText( Object element ) {
- if ( element instanceof IGlobalVariableDescriptor ) {
- String path = ""; //$NON-NLS-1$
- if ( ((IGlobalVariableDescriptor)element).getPath() != null ) {
- path = ((IGlobalVariableDescriptor)element).getPath().toString();
- int index = path.lastIndexOf( '/' );
- if ( index != -1 )
- path = path.substring( index + 1 );
- }
- return (path.length() > 0 ? ('\'' + path + "\'::") : "") + ((IGlobalVariableDescriptor)element).getName(); //$NON-NLS-1$ //$NON-NLS-2$
- }
- return null;
- }
- }, ActionMessages.getString( "AddGlobalsActionDelegate.0" ) ); //$NON-NLS-1$
- }
-
- protected IGlobalVariableDescriptor[] getGlobals() {
- return fGlobals;
- }
-
- protected void doAction( Object element ) throws DebugException {
- if ( getView() == null )
- return;
- if ( element != null && element instanceof IDebugElement ) {
- IExecFileInfo info = ((IDebugElement)element).getDebugTarget().getAdapter( IExecFileInfo.class );
- ICGlobalVariableManager gvm = ((IDebugElement)element).getDebugTarget().getAdapter( ICGlobalVariableManager.class );
- if ( info != null && gvm != null ) {
- fGlobals = info.getGlobals();
- ListSelectionDialog dlg = createDialog();
- dlg.setTitle(ActionMessages.getString("AddGlobalsActionDelegate.title")); //$NON-NLS-1$
- dlg.setInitialSelections( gvm.getDescriptors() );
- if ( dlg.open() == Window.OK ) {
- List<Object> list = Arrays.asList( dlg.getResult() );
- IGlobalVariableDescriptor[] selections = list.toArray( new IGlobalVariableDescriptor[list.size()] );
- gvm.addGlobals( selections );
- }
- }
- }
- }
-
- /**
- * @see AbstractDebugActionDelegate#getErrorDialogMessage()
- */
- protected String getErrorDialogMessage() {
- return ActionMessages.getString( "AddGlobalsActionDelegate.1" ); //$NON-NLS-1$
- }
-
- protected void setStatus( IStatus status ) {
- fStatus = status;
- }
-
- protected IStatus getStatus() {
- return fStatus;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.IActionDelegate2#init(org.eclipse.jface.action.IAction)
- */
- @Override
- public void init( IAction action ) {
- super.init( action );
- Object element = DebugUITools.getDebugContext();
- setSelection( (element != null) ? new StructuredSelection( element ) : new StructuredSelection() );
- update( action );
- }
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddWatchpointDialog.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddWatchpointDialog.java
deleted file mode 100644
index b33ea98f716..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddWatchpointDialog.java
+++ /dev/null
@@ -1,436 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.actions;
-
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.cdt.debug.core.cdi.model.ICDIMemorySpaceManagement;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleAdapter;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.events.VerifyEvent;
-import org.eclipse.swt.events.VerifyListener;
-import org.eclipse.swt.graphics.FontMetrics;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * The "Add Watchpoint" dialog of the "Toggle watchpoint" action.
- * @deprecated Replaced by opening a properties dialog on a new breakpoint.
- */
-public class AddWatchpointDialog extends Dialog implements ModifyListener, SelectionListener {
-
- private Combo fExpressionInput;
- private String fExpression;
- private static List<String> sExpressionHistory = new ArrayList<String>();
-
- private boolean fHasMemorySpaceControls;
- private Button fMemorySpaceEnableButton;
- private Combo fMemorySpaceInput;
- private String fMemorySpace;
-
- private boolean fRangeInitialEnable;
- private Button fRangeEnableButton;
- private Text fRangeField;
- private String fRange = ""; //$NON-NLS-1$
-
- private Button fChkBtnWrite;
- private Button fChkBtnRead;
- private boolean fRead;
- private boolean fWrite;
-
- private ICDIMemorySpaceManagement fMemManagement;
-
-
- /**
- * Constructor for AddWatchpointDialog.
- *
- * @param parentShell
- */
- public AddWatchpointDialog( Shell parentShell, ICDIMemorySpaceManagement memMgmt ) {
- super( parentShell );
- setShellStyle( getShellStyle() | SWT.RESIZE );
- fMemManagement = memMgmt;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
- */
- @Override
- protected Control createDialogArea( Composite parent ) {
- // The button bar will work better if we make the parent composite
- // a single column grid layout. For the widgets we add, we want a
- // a two-column grid, so we just create a sub composite for that.
- GridLayout gridLayout = new GridLayout();
- parent.setLayout( gridLayout );
- GridData gridData = new GridData( GridData.FILL_BOTH );
- parent.setLayoutData( gridData );
- Composite composite = new Composite( parent, SWT.None );
- gridLayout = new GridLayout();
- gridLayout.numColumns = 2;
- composite.setLayout( gridLayout );
- parent = composite;
-
- // Create the controls
- createExpressionControl( parent );
- boolean hasDebugContext = DebugUITools.getDebugContext() != null;
- boolean hasMemorySpaces = hasDebugContext && fMemManagement != null && fMemManagement.getMemorySpaces() != null && fMemManagement.getMemorySpaces().length > 0;
- fHasMemorySpaceControls = !hasDebugContext || hasMemorySpaces;
- if ( fHasMemorySpaceControls ) {
- createMemorySpaceControl( parent, hasMemorySpaces );
- }
- createCountField( parent );
- createAccessWidgets( parent );
-
- // Initialize the inter-control state
- if ( fExpression != null && fExpression.length() > 0 ) {
- fExpressionInput.add( fExpression, 0 );
- fExpressionInput.select( 0 );
- }
- fExpressionInput.setFocus();
- if ( fHasMemorySpaceControls ) {
- fMemorySpaceInput.setEnabled( fMemorySpaceEnableButton.getEnabled() );
- }
- fRangeField.setEnabled( fRangeEnableButton.getEnabled() );
- updateUI();
- return parent;
- }
-
- private void createExpressionControl(Composite parent ) {
-
- Label l = new Label( parent, GridData.FILL_HORIZONTAL );
- l.setText( ActionMessages.getString( "AddWatchpointDialog.1" ) ); //$NON-NLS-1$
- GridData gridData = new GridData( GridData.FILL_HORIZONTAL );
- gridData.horizontalSpan = 2;
- l.setLayoutData( gridData );
-
- fExpressionInput = new Combo( parent, SWT.BORDER );
- gridData = new GridData( GridData.FILL_HORIZONTAL );
- gridData.horizontalSpan = 2;
- fExpressionInput.setLayoutData( gridData );
- fExpressionInput.addModifyListener( this );
- for (String expression : sExpressionHistory) {
- fExpressionInput.add( expression );
- }
- }
-
- private void createMemorySpaceControl( Composite parent, boolean hasMemorySpaces ) {
- fMemorySpaceEnableButton = new Button( parent, SWT.CHECK );
- GridData gridData = new GridData( GridData.FILL_HORIZONTAL );
- gridData.horizontalSpan = 1;
- fMemorySpaceEnableButton.setLayoutData( gridData );
- fMemorySpaceEnableButton.setText( ActionMessages.getString( "AddWatchpointDialog.5" ) ); //$NON-NLS-1$
- fMemorySpaceEnableButton.setSelection( false );
- fMemorySpaceEnableButton.addSelectionListener( this );
-
- if ( hasMemorySpaces ) {
- fMemorySpaceInput = new Combo( parent, SWT.BORDER | SWT.READ_ONLY );
- } else {
- fMemorySpaceInput = new Combo( parent, SWT.BORDER );
- }
- gridData = new GridData( GridData.FILL_HORIZONTAL );
- gridData.horizontalSpan = 1;
- fMemorySpaceInput.setLayoutData( gridData );
- fMemorySpaceInput.addSelectionListener( this );
- if ( fMemManagement != null ) {
- String [] memorySpaces = fMemManagement.getMemorySpaces();
- for ( int i = 0; i < memorySpaces.length; i++ ) {
- fMemorySpaceInput.add( memorySpaces[i] );
- }
- }
- if ( fMemorySpace != null && fMemorySpace.length() > 0 ) {
- int i = fMemorySpaceInput.indexOf( fMemorySpace );
- if ( i >= 0 ) {
- fMemorySpaceInput.select( i );
- fMemorySpaceEnableButton.setSelection( true );
- } else {
- fMemorySpaceInput.add( fMemorySpace );
- }
- }
- fMemorySpaceInput.addModifyListener( this );
- //234909 - for accessibility
- fMemorySpaceInput.getAccessible().addAccessibleListener(
- new AccessibleAdapter() {
- @Override
- public void getName(AccessibleEvent e) {
- e.result = ActionMessages.getString( "AddWatchpointDialog.5" ); //$NON-NLS-1$
- }
-
- });
- }
-
- /**
- * @param text
- * @param c
- * @return true if the concatenation of text + c results
- * in a valid string representation of an integer
- * @see verifyIntegerText()
- */
- private static boolean verifyIntegerTextAddition( String text, char c ) {
-
- // pass through all control characters
- if ( Character.isISOControl( c ) ) {
- return true;
- }
-
- // case-insensitive
- c = Character.toLowerCase( c );
- text = text.toLowerCase();
-
- // first character has to be 0-9
- if ( text.length() == 0 ) {
- return Character.isDigit( c );
- }
-
- // second character must be x if preceded by a 0, otherwise 0-9 will do
- if ( text.length() == 1 ) {
- if ( text.equals( "0" ) ) { //$NON-NLS-1$
- return c == 'x';
- }
- return Character.isDigit( c );
- }
-
- // all subsequent characters must be 0-9 or a-f if started with 0x
- return Character.isDigit( c )
- || text.startsWith( "0x" ) && 'a' <= c && c <= 'f'; //$NON-NLS-1$
- }
-
- /**
- * @param text integer string built up using verifyIntegerTextAddition()
- * @return true if text represents a valid string representation of
- * an integer
- */
- private static boolean verifyIntegerText( String text ) {
- if ( text.length() == 0 ) {
- return false;
- }
- if ( text.length() == 1 ) {
- return true;
- }
- if ( text.length() == 2 ) {
- return !text.equals("0x"); //$NON-NLS-1$
- }
- return true;
- }
-
- private void createCountField( Composite parent ) {
- fRangeEnableButton = new Button( parent, SWT.CHECK );
- GridData gridData = new GridData( GridData.FILL_HORIZONTAL );
- gridData.horizontalSpan = 1;
- fRangeEnableButton.setLayoutData( gridData );
- fRangeEnableButton.setText( ActionMessages.getString( "AddWatchpointDialog.6" ) ); //$NON-NLS-1$
- fRangeEnableButton.setSelection( fRangeInitialEnable && fRange.length() > 0 );
- fRangeEnableButton.addSelectionListener( this );
-
- fRangeField = new Text( parent, SWT.BORDER );
- gridData = new GridData( GridData.FILL_HORIZONTAL );
- gridData.horizontalSpan = 1;
- GC gc = new GC( fRangeField );
- FontMetrics fm = gc.getFontMetrics();
- gridData.minimumWidth = 8 * fm.getAverageCharWidth();
- fRangeField.setLayoutData( gridData );
- fRangeField.setText( fRange );
- fRangeField.addVerifyListener( new VerifyListener() {
- @Override
- public void verifyText( VerifyEvent e ) {
- e.doit = verifyIntegerTextAddition( fRangeField.getText(), e.character );
- }
- });
- fRangeField.addModifyListener( this );
- //234909 - for accessibility
- fRangeField.getAccessible().addAccessibleListener(
- new AccessibleAdapter() {
- @Override
- public void getName(AccessibleEvent e) {
- e.result = ActionMessages.getString( "AddWatchpointDialog.6" ); //$NON-NLS-1$
- }
-
- });
- }
-
- private void createAccessWidgets( Composite parent ) {
- GridData gridData = new GridData( GridData.FILL_HORIZONTAL );
- gridData.horizontalSpan = 3;
-
- Group group = new Group( parent, SWT.NONE );
- group.setLayout( new GridLayout() );
- group.setLayoutData( gridData );
- group.setText( ActionMessages.getString( "AddWatchpointDialog.2" ) ); //$NON-NLS-1$
- fChkBtnWrite = new Button( group, SWT.CHECK );
- fChkBtnWrite.setText( ActionMessages.getString( "AddWatchpointDialog.3" ) ); //$NON-NLS-1$
- fChkBtnWrite.setSelection( true );
- fChkBtnWrite.addSelectionListener( this );
- fChkBtnRead = new Button( group, SWT.CHECK );
- fChkBtnRead.setText( ActionMessages.getString( "AddWatchpointDialog.4" ) ); //$NON-NLS-1$
- fChkBtnRead.setSelection( false );
- fChkBtnRead.addSelectionListener( this );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
- */
- @Override
- protected void configureShell( Shell newShell ) {
- super.configureShell( newShell );
-
- // use the same title used by the platform dialog
- newShell.setText( ActionMessages.getString( "AddWatchpointDialog.0" ) ); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#okPressed()
- */
- @Override
- protected void okPressed() {
- fExpression = fExpressionInput.getText().trim();
- if ( fExpression.length() > 0 ) {
- addHistory( fExpression );
- }
- if ( fHasMemorySpaceControls ) {
- fMemorySpace = fMemorySpaceEnableButton.getSelection() ? fMemorySpaceInput.getText().trim() : ""; //$NON-NLS-1$
- }
- fRange = fRangeEnableButton.getSelection() ? fRangeField.getText().trim() : "0"; //$NON-NLS-1$
- fRead = fChkBtnRead.getSelection();
- fWrite = fChkBtnWrite.getSelection();
- super.okPressed();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
- */
- @Override
- public void modifyText( ModifyEvent e ) {
- updateUI();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.TrayDialog#createButtonBar(org.eclipse.swt.widgets.Composite)
- */
- @Override
- protected Control createButtonBar( Composite parent ) {
- return super.createButtonBar( parent );
- }
-
- public String getExpression() {
- return fExpression;
- }
-
- public String getMemorySpace() {
- return fMemorySpace;
- }
-
- private static void addHistory( String item ) {
- if ( !sExpressionHistory.contains( item ) ) {
- sExpressionHistory.add( 0, item );
-
- if ( sExpressionHistory.size() > 5 )
- sExpressionHistory.remove( sExpressionHistory.size() - 1 );
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)
- */
- @Override
- public void widgetDefaultSelected( SelectionEvent e ) {
- // ignore
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- */
- @Override
- public void widgetSelected( SelectionEvent e ) {
- updateUI();
- }
-
- private void updateUI() {
- if ( fHasMemorySpaceControls ) {
- fMemorySpaceInput.setEnabled( fMemorySpaceEnableButton.getSelection() );
- }
- fRangeField.setEnabled( fRangeEnableButton.getSelection() );
- Button b = getButton( IDialogConstants.OK_ID );
- if ( b == null ) {
- return;
- }
- b.setEnabled( okayEnabled() );
- }
-
- private boolean okayEnabled() {
- if ( !fChkBtnRead.getSelection() && !fChkBtnWrite.getSelection() ) {
- return false ;
- }
- if ( fExpressionInput.getText().length() == 0 ) {
- return false;
- }
- if ( fHasMemorySpaceControls && fMemorySpaceInput.getEnabled() && fMemorySpaceInput.getText().length() == 0 ) {
- return false;
- }
- if ( fRangeField.getEnabled()
- && ( fRangeField.getText().length() == 0 || !verifyIntegerText( fRangeField.getText() ) ) ) {
- return false;
- }
- return true;
- }
-
- public boolean getWriteAccess() {
- return fWrite;
- }
-
- public boolean getReadAccess() {
- return fRead;
- }
-
- public void setExpression(String expressionString ) {
- fExpression = expressionString;
- }
-
- public BigInteger getRange() {
- return BigInteger.valueOf( Long.decode(fRange).longValue() );
- }
-
- public void initializeRange( boolean enable, String range ) {
- fRangeInitialEnable = enable;
- fRange = range;
- }
-
- public void initializeMemorySpace( String memorySpace ) {
- fMemorySpace = memorySpace;
- }
-
- @Override
- protected void createButtonsForButtonBar(Composite parent) {
- // override so we can change the initial okay enabled state
- createButton( parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL,
- true ).setEnabled( okayEnabled() );
- createButton( parent, IDialogConstants.CANCEL_ID,
- IDialogConstants.CANCEL_LABEL, false );
- }
-
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/BinaryVariableFormatActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/BinaryVariableFormatActionDelegate.java
deleted file mode 100644
index a48a9a3d92d..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/BinaryVariableFormatActionDelegate.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 QNX Software 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:
- * Mark Mitchell, CodeSourcery - Bug 136896: View variables in binary format
- *******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.actions;
-
-import org.eclipse.cdt.debug.core.model.CVariableFormat;
-
-/**
- * The delegate of the "Binary Format" action.
- */
-public class BinaryVariableFormatActionDelegate extends VariableFormatActionDelegate {
-
- /**
- * Constructor for BinaryVariableFormatActionDelegate.
- */
- public BinaryVariableFormatActionDelegate() {
- super( CVariableFormat.BINARY );
- }
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/CanFormatObjectTester.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/CanFormatObjectTester.java
deleted file mode 100644
index 8b1ff2d84ea..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/CanFormatObjectTester.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2012 QNX Software 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:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.cdt.debug.internal.ui.actions;
-
-import org.eclipse.cdt.debug.core.model.ICValue;
-import org.eclipse.cdt.debug.core.model.ICVariable;
-import org.eclipse.core.expressions.PropertyTester;
-import org.eclipse.debug.core.model.IWatchExpression;
-
-/**
- * Property test for object in selection.
- * property: canFormatObject - if object is C/C++ formattable
- * @author elaskavaia
- *
- */
-public class CanFormatObjectTester extends PropertyTester {
-
- public CanFormatObjectTester() {
-
- }
-
- @Override
- public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
- if (property.equals("canFormatObject")) { //$NON-NLS-1$
- if (receiver instanceof ICVariable) { return expectedValue == Boolean.TRUE; }
- if (receiver instanceof IWatchExpression) {
- IWatchExpression w = (IWatchExpression) receiver;
- if (w.getValue() instanceof ICValue)
- return expectedValue == Boolean.TRUE;
- }
- return expectedValue == Boolean.FALSE;
- }
- return false;
- }
-
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/DecVariableFormatActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/DecVariableFormatActionDelegate.java
deleted file mode 100644
index 613549cc459..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/DecVariableFormatActionDelegate.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 QNX Software 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:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.actions;
-
-import org.eclipse.cdt.debug.core.model.CVariableFormat;
-
-/**
- * The delegate of the "Decimal Format" action.
- */
-public class DecVariableFormatActionDelegate extends VariableFormatActionDelegate {
-
- /**
- * Constructor for DecVariableFormatActionDelegate.
- */
- public DecVariableFormatActionDelegate() {
- super( CVariableFormat.DECIMAL );
- }
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/DisableVariablesActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/DisableVariablesActionDelegate.java
deleted file mode 100644
index 5ec27b263ce..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/DisableVariablesActionDelegate.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2012 QNX Software 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:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.cdt.debug.internal.ui.actions;
-
-/**
- * Enter type comment.
- *
- * @since Jun 19, 2003
- */
-public class DisableVariablesActionDelegate extends EnableVariablesActionDelegate
-{
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.internal.ui.actions.EnableVariablesActionDelegate#isEnableAction()
- */
- @Override
- protected boolean isEnableAction()
- {
- return false;
- }
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/EnableVariablesActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/EnableVariablesActionDelegate.java
deleted file mode 100644
index bca7a42f68d..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/EnableVariablesActionDelegate.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2015 QNX Software 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:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.actions;
-
-import java.util.Iterator;
-import org.eclipse.cdt.debug.core.model.IEnableDisableTarget;
-import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-
-/**
- * The delegate of the "Enable" action contribution to the "IVariable" objects.
- */
-public class EnableVariablesActionDelegate implements IViewActionDelegate {
-
- private IViewPart fView;
-
- private IAction fAction;
-
- public EnableVariablesActionDelegate() {
- }
-
- protected IViewPart getView() {
- return fView;
- }
-
- protected void setView( IViewPart view ) {
- fView = view;
- }
-
- protected IAction getAction() {
- return fAction;
- }
-
- protected void setAction( IAction action ) {
- fAction = action;
- }
-
- /**
- * This action enables variables.
- */
- protected boolean isEnableAction() {
- return true;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
- */
- @Override
- public void init( IViewPart view ) {
- setView( view );
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
- */
- @Override
- public void run( IAction action ) {
- IStructuredSelection selection = getSelection();
- final int size = selection.size();
- if ( size == 0 )
- return;
- final Iterator it = selection.iterator();
- final MultiStatus ms = new MultiStatus( CDebugUIPlugin.getUniqueIdentifier(), DebugException.REQUEST_FAILED, ActionMessages.getString( "EnableVariablesActionDelegate.0" ), null ); //$NON-NLS-1$
- BusyIndicator.showWhile( Display.getCurrent(), new Runnable() {
-
- @Override
- public void run() {
- while( it.hasNext() ) {
- IEnableDisableTarget target = getEnableDisableTarget( it.next() );
- if ( target != null && target.canEnableDisable() ) {
- try {
- if ( size > 1 ) {
- target.setEnabled( isEnableAction() );
- }
- else
- target.setEnabled( !target.isEnabled() );
- }
- catch( DebugException e ) {
- ms.merge( e.getStatus() );
- }
- }
- }
- update();
- }
- } );
- if ( !ms.isOK() ) {
- CDebugUIPlugin.errorDialog( ActionMessages.getString( "EnableVariablesActionDelegate.1" ), ms ); //$NON-NLS-1$
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
- */
- @Override
- public void selectionChanged( IAction action, ISelection selection ) {
- setAction( action );
- if ( !(selection instanceof IStructuredSelection) )
- return;
- IStructuredSelection sel = (IStructuredSelection)selection;
- Object o = sel.getFirstElement();
- if ( getEnableDisableTarget( o ) == null )
- return;
- Iterator it = sel.iterator();
- boolean allEnabled = true;
- boolean allDisabled = true;
- while( it.hasNext() ) {
- IEnableDisableTarget target = getEnableDisableTarget( it.next() );
- if ( target != null && target.canEnableDisable() ) {
- if ( target.isEnabled() )
- allDisabled = false;
- else
- allEnabled = false;
- }
- }
- if ( isEnableAction() )
- action.setEnabled( !allEnabled );
- else
- action.setEnabled( !allDisabled );
- }
-
- private IStructuredSelection getSelection() {
- return (IStructuredSelection)getView().getViewSite().getSelectionProvider().getSelection();
- }
-
- protected void update() {
- getView().getViewSite().getSelectionProvider().setSelection( getView().getViewSite().getSelectionProvider().getSelection() );
- }
-
- protected IEnableDisableTarget getEnableDisableTarget( Object obj ) {
- IEnableDisableTarget target = null;
- if ( obj instanceof IAdaptable ) {
- target = ((IAdaptable)obj).getAdapter( IEnableDisableTarget.class );
- }
- return target;
- }
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/HexVariableFormatActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/HexVariableFormatActionDelegate.java
deleted file mode 100644
index 3268250b380..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/HexVariableFormatActionDelegate.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 QNX Software 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:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.actions;
-
-import org.eclipse.cdt.debug.core.model.CVariableFormat;
-
-/**
- * The delegate of the "Hexadecimal Format" action.
- */
-public class HexVariableFormatActionDelegate extends VariableFormatActionDelegate {
-
- /**
- * Constructor for HexVariableFormatActionDelegate.
- */
- public HexVariableFormatActionDelegate() {
- super( CVariableFormat.HEXADECIMAL );
- }
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/LoadSymbolsForAllActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/LoadSymbolsForAllActionDelegate.java
deleted file mode 100644
index a1f45d2e6ed..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/LoadSymbolsForAllActionDelegate.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2015 QNX Software 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:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.actions;
-
-import org.eclipse.cdt.debug.core.CDIDebugModel;
-import org.eclipse.cdt.debug.core.CDebugUtils;
-import org.eclipse.cdt.debug.core.model.ICDebugTarget;
-import org.eclipse.cdt.debug.core.model.IModuleRetrieval;
-import org.eclipse.cdt.debug.internal.core.ICDebugInternalConstants;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.DebugEvent;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.jface.action.IAction;
-
-/**
- * The delegate for the "Load Symbols For All" action of the Modules view.
- */
-public class LoadSymbolsForAllActionDelegate extends AbstractViewActionDelegate {
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.internal.ui.actions.AbstractViewActionDelegate#getErrorDialogTitle()
- */
- @Override
- protected String getErrorDialogTitle() {
- return ActionMessages.getString( "LoadSymbolsForAllActionDelegate.Error_1" ); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.internal.ui.actions.AbstractViewActionDelegate#getErrorDialogMessage()
- */
- @Override
- protected String getErrorDialogMessage() {
- return ActionMessages.getString( "LoadSymbolsForAllActionDelegate.Error(s)_occurred_loading_the_symbols_1" ); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.internal.ui.actions.AbstractViewActionDelegate#doAction()
- */
- @Override
- protected void doAction() throws DebugException {
- ICDebugTarget target = getDebugTarget( getView().getViewer().getInput() );
- if ( target != null ) {
- final IModuleRetrieval mr = target.getAdapter( IModuleRetrieval.class );
- if ( mr != null ) {
- DebugPlugin.getDefault().asyncExec(
- new Runnable() {
-
- @Override
- public void run() {
- try {
- mr.loadSymbolsForAllModules();
- }
- catch( DebugException e ) {
- failed( e );
- }
- }
- } );
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.internal.ui.actions.AbstractViewActionDelegate#update()
- */
- @Override
- protected void update() {
- IAction action = getAction();
- if ( getView() != null && getView().getViewer() != null && action != null ) {
- ICDebugTarget target = getDebugTarget( getView().getViewer().getInput() );
- action.setEnabled( ( target != null ) ? target.isSuspended() : false );
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.internal.ui.actions.AbstractViewActionDelegate#doHandleDebugEvent(org.eclipse.debug.core.DebugEvent)
- */
- @Override
- protected void doHandleDebugEvent( DebugEvent event ) {
- }
-
- private ICDebugTarget getDebugTarget( Object element ) {
- if ( element instanceof IAdaptable ) {
- return ((IAdaptable)element).getAdapter( ICDebugTarget.class );
- }
- return null;
- }
-
- protected void failed( Throwable e ) {
- MultiStatus ms = new MultiStatus( CDIDebugModel.getPluginIdentifier(), ICDebugInternalConstants.STATUS_CODE_ERROR, ActionMessages.getString( "LoadSymbolsForAllActionDelegate.0" ), null ); //$NON-NLS-1$
- ms.add( new Status( IStatus.ERROR, CDIDebugModel.getPluginIdentifier(), ICDebugInternalConstants.STATUS_CODE_ERROR, e.getMessage(), e ) );
- CDebugUtils.error( ms, this );
- }
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/MoveToLineAdapter.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/MoveToLineAdapter.java
index 39f29125097..1d4d6f63309 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/MoveToLineAdapter.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/MoveToLineAdapter.java
@@ -15,8 +15,6 @@ import org.eclipse.cdt.debug.core.CDIDebugModel;
import org.eclipse.cdt.debug.core.CDebugUtils;
import org.eclipse.cdt.debug.core.model.IMoveToLine;
import org.eclipse.cdt.debug.internal.core.ICDebugInternalConstants;
-import org.eclipse.cdt.debug.internal.core.model.CDebugElement;
-import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceLookupDirector;
import org.eclipse.cdt.debug.internal.ui.CDebugUIUtils;
import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
@@ -29,8 +27,6 @@ import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.model.IDebugTarget;
-import org.eclipse.debug.core.model.ISourceLocator;
import org.eclipse.debug.core.model.ISuspendResume;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.ITextSelection;
@@ -64,15 +60,10 @@ public class MoveToLineAdapter implements IMoveToLineTarget {
}
else {
final String fileName = getFileName( input );
- IDebugTarget debugTarget = null;
- if (target instanceof CDebugElement) {
- debugTarget = ((CDebugElement)target).getDebugTarget();
- }
-
ITextSelection textSelection = (ITextSelection)selection;
final int lineNumber = textSelection.getStartLine() + 1;
if ( target instanceof IAdaptable ) {
- final IPath path = convertPath( fileName, debugTarget );
+ final IPath path = new Path( fileName );
final IMoveToLine moveToLine = ((IAdaptable)target).getAdapter( IMoveToLine.class );
if ( moveToLine != null && moveToLine.canMoveToLine( path.toPortableString(), lineNumber ) ) {
Runnable r = new Runnable() {
@@ -131,13 +122,7 @@ public class MoveToLineAdapter implements IMoveToLineTarget {
if (fileName == null) {
return false;
}
-
- IDebugTarget debugTarget = null;
- if (target instanceof CDebugElement) {
- debugTarget = ((CDebugElement)target).getDebugTarget();
- }
-
- final IPath path = convertPath( fileName, debugTarget );
+ final IPath path = new Path( fileName );
ITextSelection textSelection = (ITextSelection)selection;
int lineNumber = textSelection.getStartLine() + 1;
return moveToLine.canMoveToLine(path.toPortableString(), lineNumber );
@@ -159,19 +144,4 @@ public class MoveToLineAdapter implements IMoveToLineTarget {
ms.add( new Status( IStatus.ERROR, CDIDebugModel.getPluginIdentifier(), ICDebugInternalConstants.STATUS_CODE_ERROR, e.getMessage(), e ) );
CDebugUtils.error( ms, this );
}
- private IPath convertPath( String sourceHandle, IDebugTarget debugTarget ) {
- IPath path = null;
- if ( Path.EMPTY.isValidPath( sourceHandle ) ) {
- if ( debugTarget != null ) {
- ISourceLocator sl = debugTarget.getLaunch().getSourceLocator();
- if ( sl instanceof CSourceLookupDirector ) {
- path = ((CSourceLookupDirector)sl).getCompilationPath( sourceHandle );
- }
- }
- if ( path == null ) {
- path = new Path( sourceHandle );
- }
- }
- return path;
- }
}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/NaturalVariableFormatActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/NaturalVariableFormatActionDelegate.java
deleted file mode 100644
index f7ec7f1548f..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/NaturalVariableFormatActionDelegate.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 QNX Software 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:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.actions;
-
-import org.eclipse.cdt.debug.core.model.CVariableFormat;
-
-/**
- * The delegate of the "Natural Format" action.
- */
-public class NaturalVariableFormatActionDelegate extends VariableFormatActionDelegate {
-
- /**
- * Constructor for NaturalVariableFormatActionDelegate.
- */
- public NaturalVariableFormatActionDelegate() {
- super( CVariableFormat.NATURAL );
- }
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/NumberFormatsContribution.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/NumberFormatsContribution.java
deleted file mode 100644
index 818a24e7d38..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/NumberFormatsContribution.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2015 QNX Software 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:
- * QNX Software Systems - Initial API and implementation
- * Marc Khouzam (Ericsson) - Support for octal number format (bug 370462)
- *******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.actions;
-
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.cdt.debug.core.model.CVariableFormat;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.ContributionItem;
-import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.ui.ISelectionService;
-import org.eclipse.ui.actions.CompoundContributionItem;
-import org.eclipse.ui.menus.IWorkbenchContribution;
-import org.eclipse.ui.services.IServiceLocator;
-
-/**
- * Dynamic menu contribution that shows available number formats
- * in the current view.
- *
- * @since 6.0
- */
-public class NumberFormatsContribution extends CompoundContributionItem implements IWorkbenchContribution {
- static final String CURRENT_FORMAT = "current_format";
-
- private static final Map<CVariableFormat, String> FORMATS = new LinkedHashMap<CVariableFormat, String>();
- static {
- FORMATS.put(CVariableFormat.NATURAL, "Default");
- FORMATS.put(CVariableFormat.DECIMAL, "Decimal");
- FORMATS.put(CVariableFormat.HEXADECIMAL, "Hexadecimal");
- FORMATS.put(CVariableFormat.OCTAL, "Octal");
- FORMATS.put(CVariableFormat.BINARY, "Binary");
- }
-
- private class SelectNumberFormatAction extends Action {
- private final CVariableFormat fFormat;
- private VariableFormatActionDelegate delegate;
-
- public VariableFormatActionDelegate getDelegate() {
- return delegate;
- }
-
- SelectNumberFormatAction(CVariableFormat format) {
- super(FORMATS.get(format), AS_RADIO_BUTTON);
-
- fFormat = format;
- delegate = new VariableFormatActionDelegate(fFormat);
- }
-
- void selectionChanged(ISelection sel) {
- delegate.selectionChanged(this, sel);
- }
-
- @Override
- public void run() {
- if (isChecked()) {
- delegate.run(this);
- }
- }
- }
-
- private IServiceLocator fServiceLocator;
-
- private static IContributionItem[] NO_ITEMS = new IContributionItem[] { new ContributionItem() {
- @Override
- public void fill(Menu menu, int index) {
- MenuItem item = new MenuItem(menu, SWT.NONE);
- item.setEnabled(false);
- item.setText("Empty");
- }
-
- @Override
- public boolean isEnabled() {
- return false;
- }
- } };
-
- @Override
- protected IContributionItem[] getContributionItems() {
- ISelectionService service = fServiceLocator.getService(ISelectionService.class);
- ISelection selection = service.getSelection();
-
-
- List<Action> actions = new ArrayList<Action>(FORMATS.size());
-
- for (CVariableFormat formatId : FORMATS.keySet()) {
- SelectNumberFormatAction action = new SelectNumberFormatAction(formatId);
- action.selectionChanged(selection);
- actions.add(action);
- }
-
- if (actions.isEmpty()) { return NO_ITEMS; }
-
- IContributionItem[] items = new IContributionItem[actions.size()];
- for (int i = 0; i < actions.size(); i++) {
- items[i] = new ActionContributionItem(actions.get(i));
- }
- return items;
- }
-
- @Override
- public void initialize(IServiceLocator serviceLocator) {
- fServiceLocator = serviceLocator;
- }
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RemoveAllGlobalsActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RemoveAllGlobalsActionDelegate.java
deleted file mode 100644
index fc947dfb7c0..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RemoveAllGlobalsActionDelegate.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2015 QNX Software 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:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.actions;
-
-import org.eclipse.cdt.debug.core.ICGlobalVariableManager;
-import org.eclipse.cdt.debug.core.model.IGlobalVariableDescriptor;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.debug.core.DebugEvent;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.IDebugEventSetListener;
-import org.eclipse.debug.core.model.IDebugTarget;
-import org.eclipse.debug.core.model.IDebugElement;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.actions.ActionDelegate;
-
-/**
- * A delegate for the "Remove All Globals" action.
- */
-public class RemoveAllGlobalsActionDelegate extends ActionDelegate implements IViewActionDelegate, IDebugEventSetListener {
-
- private IAction fAction;
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
- */
- @Override
- public void init( IViewPart view ) {
- DebugPlugin.getDefault().addDebugEventListener(this);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.actions.ActionDelegate#init(org.eclipse.jface.action.IAction)
- */
- @Override
- public void init( IAction action ) {
- DebugPlugin.getDefault().addDebugEventListener(this);
- fAction = action;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.actions.ActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
- */
- @Override
- public void selectionChanged(IAction action, ISelection selection) {
- update();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.actions.ActionDelegate#dispose()
- */
- @Override
- public void dispose() {
- DebugPlugin.getDefault().removeDebugEventListener(this);
- fAction = null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
- */
- @Override
- public void run( IAction action ) {
- IAdaptable context = DebugUITools.getDebugContext();
- if ( context instanceof IDebugElement ) {
- final ICGlobalVariableManager gvm = ((IDebugElement)context).getDebugTarget().getAdapter( ICGlobalVariableManager.class );
- if ( gvm != null ) {
- DebugPlugin.getDefault().asyncExec(
- new Runnable() {
- @Override
- public void run() {
- gvm.removeAllGlobals();
- }
- } );
- }
- }
- }
-
- /**
- * Enables/disables the action based on whether there are any globals in the
- * variables view.
- */
- private void update() {
- final IAction action = fAction;
- if (action != null) {
- final IAdaptable context = DebugUITools.getDebugContext();
- boolean enabled = false;
- if (context instanceof IDebugElement) {
- final ICGlobalVariableManager gvm = ((IDebugElement) context)
- .getDebugTarget().getAdapter(
- ICGlobalVariableManager.class);
- if (gvm != null) {
- final IGlobalVariableDescriptor[] globals = gvm
- .getDescriptors();
- enabled = globals != null && globals.length > 0;
- }
- }
- action.setEnabled(enabled);
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.debug.core.IDebugEventSetListener#handleDebugEvents(org.eclipse.debug.core.DebugEvent[])
- */
- @Override
- public void handleDebugEvents( DebugEvent[] events ) {
- // The ICGlobalVariableManager will fire a target content-changed
- // event when a global is added or removed. Update the enable/disable
- // state of this action accordingly
-
- if (fAction != null) {
- for (int i = 0; i < events.length; i++) {
- final DebugEvent event = events[i];
- if (event.getSource() instanceof IDebugTarget
- && event.getKind() == DebugEvent.CHANGE
- && event.getDetail() == DebugEvent.CONTENT ) {
- update();
- break;
- }
- }
- }
- }
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RemoveGlobalsActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RemoveGlobalsActionDelegate.java
deleted file mode 100644
index 8b9f1795f0a..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RemoveGlobalsActionDelegate.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2015 QNX Software 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:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.actions;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import org.eclipse.cdt.debug.core.ICGlobalVariableManager;
-import org.eclipse.cdt.debug.core.model.ICGlobalVariable;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.actions.ActionDelegate;
-
-/**
- * A delegate for the "Remove Globals" action.
- */
-public class RemoveGlobalsActionDelegate extends ActionDelegate implements IViewActionDelegate {
-
- private IAction fAction;
-
- private ISelection fSelection;
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
- */
- @Override
- public void init( IViewPart view ) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IActionDelegate2#init(org.eclipse.jface.action.IAction)
- */
- @Override
- public void init( IAction action ) {
- setAction( action );
- update();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
- */
- @Override
- public void run( IAction action ) {
- ISelection selection = getSelection();
- if ( !(selection instanceof IStructuredSelection) )
- return;
- IStructuredSelection ss = (IStructuredSelection)selection;
- final Iterator it = ss.iterator();
- ArrayList list = new ArrayList( ss.size() );
- while( it.hasNext() ) {
- Object obj = it.next();
- if ( obj instanceof ICGlobalVariable )
- list.add( obj );
- }
- if ( list.size() == 0 )
- return;
- final ICGlobalVariable[] globals = (ICGlobalVariable[])list.toArray( new ICGlobalVariable[list.size()] );
- final ICGlobalVariableManager gvm = globals[0].getDebugTarget().getAdapter( ICGlobalVariableManager.class );
- if ( gvm == null )
- return;
- Runnable r = new Runnable() {
- @Override
- public void run() {
- gvm.removeGlobals( globals );
- }
- };
- DebugPlugin.getDefault().asyncExec( r );
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
- */
- @Override
- public void selectionChanged( IAction action, ISelection selection ) {
- setSelection( selection );
- update();
- }
-
- protected IAction getAction() {
- return fAction;
- }
-
- protected ISelection getSelection() {
- return fSelection;
- }
-
- private void setAction( IAction action ) {
- fAction = action;
- }
-
- private void setSelection( ISelection selection ) {
- fSelection = selection;
- }
-
- private void update() {
- IAction action = getAction();
- if ( action != null ) {
- ISelection selection = getSelection();
- boolean enabled = false;
- if ( selection instanceof IStructuredSelection ) {
- Iterator it = ((IStructuredSelection)selection).iterator();
- while( it.hasNext() ) {
- if ( it.next() instanceof ICGlobalVariable ) {
- enabled = true;
- break;
- }
- }
- }
- action.setEnabled( enabled );
- }
- }
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ResumeAtLineAdapter.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ResumeAtLineAdapter.java
index 42aa56e3cf8..ddd6f686481 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ResumeAtLineAdapter.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ResumeAtLineAdapter.java
@@ -15,8 +15,6 @@ import org.eclipse.cdt.debug.core.CDIDebugModel;
import org.eclipse.cdt.debug.core.CDebugUtils;
import org.eclipse.cdt.debug.core.model.IResumeAtLine;
import org.eclipse.cdt.debug.internal.core.ICDebugInternalConstants;
-import org.eclipse.cdt.debug.internal.core.model.CDebugElement;
-import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceLookupDirector;
import org.eclipse.cdt.debug.internal.ui.CDebugUIUtils;
import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
@@ -29,8 +27,6 @@ import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.model.IDebugTarget;
-import org.eclipse.debug.core.model.ISourceLocator;
import org.eclipse.debug.core.model.ISuspendResume;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.ITextSelection;
@@ -64,11 +60,7 @@ public class ResumeAtLineAdapter implements IResumeAtLineTarget {
}
else {
final String fileName = getFileName( input ); // actually, absolute path, not just file name
- IDebugTarget debugTarget = null;
- if ( target instanceof CDebugElement ) {
- debugTarget = ((CDebugElement)target).getDebugTarget();
- }
- final IPath path = convertPath( fileName, debugTarget );
+ final IPath path = new Path(fileName);
ITextSelection textSelection = (ITextSelection)selection;
final int lineNumber = textSelection.getStartLine() + 1;
if ( target instanceof IAdaptable ) {
@@ -130,12 +122,8 @@ public class ResumeAtLineAdapter implements IResumeAtLineTarget {
if (fileName == null) {
return false;
}
- IDebugTarget debugTarget = null;
- if ( target instanceof CDebugElement ) {
- debugTarget = ((CDebugElement)target).getDebugTarget();
- }
- final IPath path = convertPath( fileName, debugTarget );
+ final IPath path = new Path( fileName );
ITextSelection textSelection = (ITextSelection)selection;
int lineNumber = textSelection.getStartLine() + 1;
return resumeAtLine.canResumeAtLine( path.toPortableString(), lineNumber );
@@ -157,20 +145,4 @@ public class ResumeAtLineAdapter implements IResumeAtLineTarget {
ms.add( new Status( IStatus.ERROR, CDIDebugModel.getPluginIdentifier(), ICDebugInternalConstants.STATUS_CODE_ERROR, e.getMessage(), e ) );
CDebugUtils.error( ms, this );
}
-
- private IPath convertPath( String sourceHandle, IDebugTarget debugTarget ) {
- IPath path = null;
- if ( Path.EMPTY.isValidPath( sourceHandle ) ) {
- if ( debugTarget != null ) {
- ISourceLocator sl = debugTarget.getLaunch().getSourceLocator();
- if ( sl instanceof CSourceLookupDirector ) {
- path = ((CSourceLookupDirector)sl).getCompilationPath( sourceHandle );
- }
- }
- if ( path == null ) {
- path = new Path( sourceHandle );
- }
- }
- return path;
- }
}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RunToLineAdapter.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RunToLineAdapter.java
index 9f287b31716..a5e77c0cf04 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RunToLineAdapter.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RunToLineAdapter.java
@@ -15,8 +15,6 @@ import org.eclipse.cdt.debug.core.CDIDebugModel;
import org.eclipse.cdt.debug.core.CDebugUtils;
import org.eclipse.cdt.debug.core.model.IRunToLine;
import org.eclipse.cdt.debug.internal.core.ICDebugInternalConstants;
-import org.eclipse.cdt.debug.internal.core.model.CDebugElement;
-import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceLookupDirector;
import org.eclipse.cdt.debug.internal.ui.CDebugUIUtils;
import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
@@ -29,8 +27,6 @@ import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.model.IDebugTarget;
-import org.eclipse.debug.core.model.ISourceLocator;
import org.eclipse.debug.core.model.ISuspendResume;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugUIConstants;
@@ -67,11 +63,7 @@ public class RunToLineAdapter implements IRunToLineTarget {
}
else {
final String fileName = getFileName( input ); // actually, absolute path, not just file name
- IDebugTarget debugTarget = null;
- if (target instanceof CDebugElement) { // should always be, but just in case
- debugTarget = ((CDebugElement)target).getDebugTarget();
- }
- final IPath path = convertPath( fileName, debugTarget );
+ final IPath path = new Path( fileName );
ITextSelection textSelection = (ITextSelection)selection;
final int lineNumber = textSelection.getStartLine() + 1;
if ( target instanceof IAdaptable ) {
@@ -134,11 +126,7 @@ public class RunToLineAdapter implements IRunToLineTarget {
if (fileName == null) {
return false;
}
- IDebugTarget debugTarget = null;
- if (target instanceof CDebugElement) { // should always be, but just in case
- debugTarget = ((CDebugElement)target).getDebugTarget();
- }
- final IPath path = convertPath( fileName, debugTarget );
+ final IPath path = new Path( fileName );
ITextSelection textSelection = (ITextSelection)selection;
int lineNumber = textSelection.getStartLine() + 1;
@@ -161,20 +149,4 @@ public class RunToLineAdapter implements IRunToLineTarget {
ms.add( new Status( IStatus.ERROR, CDIDebugModel.getPluginIdentifier(), ICDebugInternalConstants.STATUS_CODE_ERROR, e.getMessage(), e ) );
CDebugUtils.error( ms, this );
}
-
- private IPath convertPath( String sourceHandle, IDebugTarget debugTarget ) {
- IPath path = null;
- if ( Path.EMPTY.isValidPath( sourceHandle ) ) {
- if ( debugTarget != null ) {
- ISourceLocator sl = debugTarget.getLaunch().getSourceLocator();
- if ( sl instanceof CSourceLookupDirector ) {
- path = ((CSourceLookupDirector)sl).getCompilationPath( sourceHandle );
- }
- }
- if ( path == null ) {
- path = new Path( sourceHandle );
- }
- }
- return path;
- }
}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleInstructionStepModeActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleInstructionStepModeActionDelegate.java
index be1a2350e85..16411c980a0 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleInstructionStepModeActionDelegate.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleInstructionStepModeActionDelegate.java
@@ -11,11 +11,8 @@
*******************************************************************************/
package org.eclipse.cdt.debug.internal.ui.actions;
-import org.eclipse.cdt.debug.core.model.ICDebugTarget;
import org.eclipse.cdt.debug.core.model.ISteppingModeTarget;
import org.eclipse.cdt.debug.core.model.ITargetProperties;
-import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
-import org.eclipse.cdt.debug.ui.ICDebugUIConstants;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.Preferences.IPropertyChangeListener;
import org.eclipse.core.runtime.Preferences.PropertyChangeEvent;
@@ -32,10 +29,8 @@ import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Event;
import org.eclipse.ui.IViewActionDelegate;
import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-import org.eclipse.ui.PartInitException;
import org.eclipse.ui.actions.ActionDelegate;
/**
@@ -114,17 +109,6 @@ public class ToggleInstructionStepModeActionDelegate extends ActionDelegate
ISteppingModeTarget target = getTarget();
if ( target != null ) {
target.enableInstructionStepping( enabled );
- if ( enabled && target instanceof ICDebugTarget ) {
- try {
- IWorkbenchPage page = fWindow.getActivePage();
- if (page != null) {
- page.showView( ICDebugUIConstants.ID_DSF_DISASSEMBLY_VIEW );
- }
- }
- catch( PartInitException e ) {
- CDebugUIPlugin.log( e.getStatus() );
- }
- }
}
}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/VariableFormatActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/VariableFormatActionDelegate.java
deleted file mode 100644
index 857a946fdad..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/VariableFormatActionDelegate.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2012 QNX Software 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:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.actions;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.cdt.debug.core.model.CVariableFormat;
-import org.eclipse.cdt.debug.core.model.ICVariable;
-import org.eclipse.cdt.debug.internal.core.model.AbstractCValue;
-import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.model.IValue;
-import org.eclipse.debug.core.model.IWatchExpression;
-import org.eclipse.debug.internal.core.WatchExpression;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-
-/**
- * The superclass of the all format action delegates.
- */
-public class VariableFormatActionDelegate implements IObjectActionDelegate {
- private CVariableFormat fFormat = CVariableFormat.NATURAL;
- private ICVariable[] fVariables = null;
- private IStructuredSelection selection;
-
- /**
- * Constructor for VariableFormatActionDelegate.
- */
- public VariableFormatActionDelegate(CVariableFormat format) {
- fFormat = format;
- }
-
- /**
- * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart)
- */
- @Override
- public void setActivePart(IAction action, IWorkbenchPart targetPart) {
- }
-
- /**
- * @see org.eclipse.ui.IActionDelegate#run(IAction)
- */
- @Override
- public void run(IAction action) {
- ICVariable[] vars = getVariables();
- if (vars != null && vars.length > 0) {
- final MultiStatus ms = new MultiStatus(CDebugUIPlugin.getUniqueIdentifier(), DebugException.REQUEST_FAILED, "", null); //$NON-NLS-1$
- BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
- @Override
- public void run() {
- try {
- doAction(getVariables());
- } catch (DebugException e) {
- ms.merge(e.getStatus());
- }
- }
- });
- if (!ms.isOK()) {
- IWorkbenchWindow window = CDebugUIPlugin.getActiveWorkbenchWindow();
- if (window != null) {
- CDebugUIPlugin.errorDialog(ActionMessages.getString("VariableFormatActionDelegate.0"), ms); //$NON-NLS-1$
- } else {
- CDebugUIPlugin.log(ms);
- }
- }
- }
- }
-
- /**
- * @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection)
- */
- @Override
- public void selectionChanged(IAction action, ISelection selection) {
-
- if (selection instanceof IStructuredSelection) {
- this.selection = (IStructuredSelection) selection;
- List<ICVariable> list = new ArrayList<ICVariable>();
- IStructuredSelection ssel = (IStructuredSelection) selection;
- Iterator i = ssel.iterator();
- while (i.hasNext()) {
- Object o = i.next();
- if (o instanceof ICVariable) {
- ICVariable var = (ICVariable) o;
- list.add(var);
- } else if (o instanceof IWatchExpression) {
- IWatchExpression expr = (IWatchExpression) o;
- IValue value = expr.getValue();
- if (value instanceof AbstractCValue) {
- ICVariable parent = ((AbstractCValue) value).getParentVariable();
- if (parent != null) {
- list.add(parent);
- }
- }
- }
- }
- for (Iterator<ICVariable> iterator = list.iterator(); iterator.hasNext();) {
- ICVariable var = iterator.next();
- boolean enabled = var.supportsFormatting();
- action.setEnabled(enabled);
- if (enabled) {
- action.setChecked(var.getFormat() == fFormat);
- } else {
- iterator.remove();
- }
- }
- setVariables(list.toArray(new ICVariable[list.size()]));
- } else {
- action.setChecked(false);
- action.setEnabled(false);
- }
- }
-
-
- protected void doAction( ICVariable[] vars ) throws DebugException {
- for( int i = 0; i < vars.length; i++ ) {
- vars[i].changeFormat( fFormat );
- }
- for (Iterator iterator = selection.iterator(); iterator.hasNext();) {
- Object o = iterator.next();
- if (o instanceof WatchExpression){
- ((WatchExpression)o).evaluate();
- }
- }
- }
-
- protected ICVariable[] getVariables() {
- return fVariables;
- }
-
- private void setVariables(ICVariable[] variables) {
- fVariables = variables;
- }
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/ToggleBreakpointAdapter.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/ToggleBreakpointAdapter.java
index 51f9aaa3c6d..13ce246a0bc 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/ToggleBreakpointAdapter.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/ToggleBreakpointAdapter.java
@@ -18,10 +18,7 @@ import java.util.HashMap;
import java.util.Map;
import org.eclipse.cdt.debug.core.CDIDebugModel;
-import org.eclipse.cdt.debug.core.cdi.model.ICDIMemorySpaceManagement;
-import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.core.model.ICBreakpointType;
-import org.eclipse.cdt.debug.core.model.ICDebugTarget;
import org.eclipse.cdt.debug.core.model.ICEventBreakpoint;
import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
@@ -29,8 +26,6 @@ import org.eclipse.cdt.debug.core.model.ICWatchpoint;
import org.eclipse.cdt.debug.ui.breakpoints.AbstractToggleBreakpointAdapter;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.ui.IWorkbenchPart;
/**
@@ -112,23 +107,4 @@ public class ToggleBreakpointAdapter extends AbstractToggleBreakpointAdapter {
protected int getBreakpointType() {
return ICBreakpointType.REGULAR;
}
-
- public static ICDIMemorySpaceManagement getMemorySpaceManagement(){
- IAdaptable debugViewElement = DebugUITools.getDebugContext();
- ICDIMemorySpaceManagement memMgr = null;
-
- if ( debugViewElement != null ) {
- ICDebugTarget debugTarget = debugViewElement.getAdapter(ICDebugTarget.class);
-
- if ( debugTarget != null ){
- ICDITarget target = debugTarget.getAdapter(ICDITarget.class);
-
- if (target instanceof ICDIMemorySpaceManagement)
- memMgr = (ICDIMemorySpaceManagement)target;
- }
- }
-
- return memMgr;
- }
-
}

Back to the top