# HG changeset patch # User wpaul # Date 1268679262 18000 # Node ID 3d38ba45873173c5de8aabcdd1a1aea2744d1086 # Parent 1ca0a29d6c858b45b648c47c7574f5714d298055 removed hardware breakpoint actions. diff -r 1ca0a29d6c85 -r 3d38ba458731 debuggercdi/com.nokia.cdt.debug.cw.symbian/plugin.properties --- a/debuggercdi/com.nokia.cdt.debug.cw.symbian/plugin.properties Fri Mar 12 13:12:46 2010 -0800 +++ b/debuggercdi/com.nokia.cdt.debug.cw.symbian/plugin.properties Mon Mar 15 13:54:22 2010 -0500 @@ -1,5 +1,4 @@ -HwBreakpoint.label=Toggle HW Breakpoint SkipAction.name=Skip Action #Keywords for Carbide preferences diff -r 1ca0a29d6c85 -r 3d38ba458731 debuggercdi/com.nokia.cdt.debug.cw.symbian/plugin.xml --- a/debuggercdi/com.nokia.cdt.debug.cw.symbian/plugin.xml Fri Mar 12 13:12:46 2010 -0800 +++ b/debuggercdi/com.nokia.cdt.debug.cw.symbian/plugin.xml Mon Mar 15 13:54:22 2010 -0500 @@ -130,64 +130,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff -r 1ca0a29d6c85 -r 3d38ba458731 debuggercdi/com.nokia.cdt.debug.cw.symbian/src/com/nokia/cdt/debug/cw/symbian/breakpoint/actions/ManageHwBreakpointRulerActionDelegate.java --- a/debuggercdi/com.nokia.cdt.debug.cw.symbian/src/com/nokia/cdt/debug/cw/symbian/breakpoint/actions/ManageHwBreakpointRulerActionDelegate.java Fri Mar 12 13:12:46 2010 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of the License "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ -package com.nokia.cdt.debug.cw.symbian.breakpoint.actions; - -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.text.source.IVerticalRulerInfo; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IViewActionDelegate; -import org.eclipse.ui.IViewPart; -import org.eclipse.ui.texteditor.AbstractRulerActionDelegate; -import org.eclipse.ui.texteditor.ITextEditor; - -public class ManageHwBreakpointRulerActionDelegate extends - AbstractRulerActionDelegate { - - private ToggleHwBreakpointRulerAction fTargetAction; - private IEditorPart fActiveEditor; - private IAction fAction; - - /* (non-Javadoc) - * @see org.eclipse.ui.texteditor.AbstractRulerActionDelegate#createAction(ITextEditor, IVerticalRulerInfo) - */ - public IAction createAction( ITextEditor editor, IVerticalRulerInfo rulerInfo ) { - fTargetAction = new ToggleHwBreakpointRulerAction( editor, rulerInfo ); - return fTargetAction; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IEditorActionDelegate#setActiveEditor(org.eclipse.jface.action.IAction, org.eclipse.ui.IEditorPart) - */ - public void setActiveEditor( IAction callerAction, IEditorPart targetEditor ) { - if ( fActiveEditor != null ) { - if ( fTargetAction != null ) { - fTargetAction.dispose(); - fTargetAction = null; - } - } - fActiveEditor = targetEditor; - super.setActiveEditor( callerAction, targetEditor ); - } - - public void selectionChanged(IAction action, ISelection selection) { - this.fAction = action; - super.selectionChanged(action, selection); - } -} diff -r 1ca0a29d6c85 -r 3d38ba458731 debuggercdi/com.nokia.cdt.debug.cw.symbian/src/com/nokia/cdt/debug/cw/symbian/breakpoint/actions/Messages.java --- a/debuggercdi/com.nokia.cdt.debug.cw.symbian/src/com/nokia/cdt/debug/cw/symbian/breakpoint/actions/Messages.java Fri Mar 12 13:12:46 2010 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of the License "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ -package com.nokia.cdt.debug.cw.symbian.breakpoint.actions; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -public class Messages { - private static final String BUNDLE_NAME = "com.nokia.cdt.debug.cw.symbian.breakpoint.actions.messages"; //$NON-NLS-1$ - - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle - .getBundle(BUNDLE_NAME); - - private Messages() { - } - - public static String getString(String key) { - try { - return RESOURCE_BUNDLE.getString(key); - } catch (MissingResourceException e) { - return '!' + key + '!'; - } - } -} diff -r 1ca0a29d6c85 -r 3d38ba458731 debuggercdi/com.nokia.cdt.debug.cw.symbian/src/com/nokia/cdt/debug/cw/symbian/breakpoint/actions/ToggleHwBreakpointAdapter.java --- a/debuggercdi/com.nokia.cdt.debug.cw.symbian/src/com/nokia/cdt/debug/cw/symbian/breakpoint/actions/ToggleHwBreakpointAdapter.java Fri Mar 12 13:12:46 2010 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,190 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of the License "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ -package com.nokia.cdt.debug.cw.symbian.breakpoint.actions; - -import org.eclipse.cdt.core.IAddress; -import org.eclipse.cdt.debug.core.CDIDebugModel; -import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint; -import org.eclipse.cdt.debug.core.model.ICBreakpointType; -import org.eclipse.cdt.debug.core.model.ICLineBreakpoint; -import org.eclipse.cdt.debug.internal.ui.CDebugUIUtils; -import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants; -import org.eclipse.cdt.debug.internal.ui.actions.BreakpointLocationVerifier; -import org.eclipse.cdt.debug.internal.ui.actions.ToggleBreakpointAdapter; -import org.eclipse.cdt.debug.internal.ui.views.disassembly.DisassemblyEditorInput; -import org.eclipse.cdt.debug.internal.ui.views.disassembly.DisassemblyView; -import org.eclipse.cdt.debug.ui.CDebugUIPlugin; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IMarker; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Status; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.model.IBreakpoint; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.ITextSelection; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.texteditor.ITextEditor; - -import com.freescale.cdt.debug.cw.core.cdi.BreakpointManager; - -public class ToggleHwBreakpointAdapter extends ToggleBreakpointAdapter { - - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#toggleLineBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection) - * This function is overridden only for the purpose of setting a breakpoint attribute to hardware. - * - * TODO: there's a hardware breakpoint type, but we're setting the type as regular and then another attribute - * as hardware. I don't know the history around this so for now I'm just going to make it work as it did - * before, but fix the fact that the wrong CDIDebugModel.create... methods are being called with CDT 5.0 - * changes. But it looks like perhaps we don't need this class anymore? - */ - public void toggleLineBreakpoints( IWorkbenchPart part, ISelection selection ) throws CoreException { - String errorMessage = null; - if ( part instanceof ITextEditor ) { - ITextEditor textEditor = (ITextEditor)part; - IEditorInput input = textEditor.getEditorInput(); - - if ( input == null ) { - errorMessage = Messages.getString( "ToggleHwBreakpointAdapter.Empty_editor_1" ); //$NON-NLS-1$ - } - else { - IDocument document = textEditor.getDocumentProvider().getDocument( input ); - if ( document == null ) { - errorMessage = Messages.getString( "ToggleHwBreakpointAdapter.Missing_document_1" ); //$NON-NLS-1$ - } - else { - IResource resource = getResource( textEditor ); - if ( resource == null ) { - errorMessage = Messages.getString( "ToggleHwBreakpointAdapter.Missing_resource_1" ); //$NON-NLS-1$ - } - else { - BreakpointLocationVerifier bv = new BreakpointLocationVerifier(); - int lineNumber = bv.getValidLineBreakpointLocation( document, ((ITextSelection)selection).getStartLine() ); - if ( lineNumber == -1 ) { - errorMessage = Messages.getString( "ToggleHwBreakpointAdapter.Invalid_line_1" ); //$NON-NLS-1$ - } - else { - String sourceHandle = getSourceHandle( input ); - ICLineBreakpoint breakpoint = CDIDebugModel.lineBreakpointExists( sourceHandle, resource, lineNumber ); - if ( breakpoint != null ) { - DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint( breakpoint, true ); - } - else { - ICLineBreakpoint lineBreakpoint = CDIDebugModel.createLineBreakpoint( sourceHandle, - resource, - ICBreakpointType.REGULAR, - lineNumber, - true, - 0, - "", //$NON-NLS-1$ - true ); - if (lineBreakpoint != null) { - setHwBreakAttribute(lineBreakpoint); - } - } - return; - } - } - } - } - } - else if ( part instanceof DisassemblyView ) { - IEditorInput input = ((DisassemblyView)part).getInput(); - if ( !(input instanceof DisassemblyEditorInput) ) { - errorMessage = Messages.getString( "ToggleHwBreakpointAdapter.Empty_editor_1" ); //$NON-NLS-1$ - } - else { - BreakpointLocationVerifier bv = new BreakpointLocationVerifier(); - int lineNumber = bv.getValidAddressBreakpointLocation( null, ((ITextSelection)selection).getStartLine() ); - if ( lineNumber == -1 ) { - errorMessage = Messages.getString( "ToggleHwBreakpointAdapter.Invalid_line_1" ); //$NON-NLS-1$ - } - else { - IAddress address = ((DisassemblyEditorInput)input).getAddress( lineNumber ); - if ( address == null ) { - errorMessage = Messages.getString( "ToggleHwBreakpointAdapter.Invalid_line_1" ); //$NON-NLS-1$ - } - else { - ICLineBreakpoint breakpoint = ((DisassemblyEditorInput)input).breakpointExists( address ); - if ( breakpoint != null ) { - DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint( breakpoint, true ); - } - else { - String module = ((DisassemblyEditorInput)input).getModuleFile(); - IResource resource = getAddressBreakpointResource( ((DisassemblyEditorInput)input).getSourceFile() ); - String sourceHandle = getSourceHandle( input ); - ICAddressBreakpoint addressBreakpoint = CDIDebugModel.createAddressBreakpoint( module, - sourceHandle, - resource, - ICBreakpointType.REGULAR, - ((DisassemblyEditorInput)input).getSourceLine( lineNumber ), - address, - true, - 0, - "", //$NON-NLS-1$ - true ); - if (addressBreakpoint != null) { - setHwBreakAttribute(addressBreakpoint); - } - } - return; - } - } - } - } - else { - errorMessage = Messages.getString( "ToggleHwBreakpointAdapter.Operation_is_not_supported_1" ); //$NON-NLS-1$ - } - throw new CoreException( new Status( IStatus.ERROR, CDebugUIPlugin.getUniqueIdentifier(), IInternalCDebugUIConstants.INTERNAL_ERROR, errorMessage, null ) ); - } - - private String getSourceHandle( IEditorInput input ) throws CoreException { - return CDebugUIUtils.getEditorFilePath(input); - } - - private IResource getAddressBreakpointResource( String fileName ) { - if ( fileName != null ) { - IPath path = new Path( fileName ); - if ( path.isValidPath( fileName ) ) { - IFile[] files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation( path ); - if ( files.length > 0 ) - return files[0]; - } - } - return ResourcesPlugin.getWorkspace().getRoot(); - } - - private void setHwBreakAttribute(IBreakpoint bkpt) { - - try { - IMarker bkptMarker = bkpt.getMarker(); - bkptMarker.setAttribute(BreakpointManager.IS_BREAK_TYPE_HARDWARE, true); - - } catch (CoreException ce) { - // Should never happen, just incase. - ce.printStackTrace(); - } - } -} diff -r 1ca0a29d6c85 -r 3d38ba458731 debuggercdi/com.nokia.cdt.debug.cw.symbian/src/com/nokia/cdt/debug/cw/symbian/breakpoint/actions/ToggleHwBreakpointRulerAction.java --- a/debuggercdi/com.nokia.cdt.debug.cw.symbian/src/com/nokia/cdt/debug/cw/symbian/breakpoint/actions/ToggleHwBreakpointRulerAction.java Fri Mar 12 13:12:46 2010 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,170 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of the License "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ -package com.nokia.cdt.debug.cw.symbian.breakpoint.actions; - -import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds; -import org.eclipse.cdt.debug.internal.ui.views.disassembly.DisassemblyView; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.IRegion; -import org.eclipse.jface.text.TextSelection; -import org.eclipse.jface.text.source.IVerticalRulerInfo; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.texteditor.IDocumentProvider; -import org.eclipse.ui.texteditor.ITextEditor; - -import com.nokia.cdt.debug.cw.symbian.SymbianPlugin; - -public class ToggleHwBreakpointRulerAction extends Action { - - static class EmptySelection implements ISelection { - - public boolean isEmpty() { - return true; - } - } - - private IVerticalRulerInfo fRuler; - private IWorkbenchPart fTargetPart; - private IToggleBreakpointsTarget fTargetAdapter; - private static final ISelection EMPTY_SELECTION = new EmptySelection(); - - public static final String PLUGIN_ID = SymbianPlugin.getUniqueIdentifier(); - - public static final String PREFIX = PLUGIN_ID + "."; //$NON-NLS-1$ - - public static final String ACTION_TOGGLE_HW_BREAKPOINT = PREFIX + "toggleHwBreakpoint"; //$NON-NLS-1$ - - /** - * Constructor for ToggleBreakpointRulerAction. - * - * @param ruler - * @param editor - */ - public ToggleHwBreakpointRulerAction( IWorkbenchPart part, IVerticalRulerInfo ruler ) { - super( "Toggle HW Breakpoint" ); //$NON-NLS-1$ - fRuler = ruler; - setTargetPart( part ); - part.getSite().getWorkbenchWindow().getWorkbench().getHelpSystem().setHelp( this, ICDebugHelpContextIds.TOGGLE_BREAKPOINT_ACTION ); - setId( ACTION_TOGGLE_HW_BREAKPOINT ); - } - - /** - * Disposes this action - */ - public void dispose() { - setTargetPart( null ); - fRuler = null; - } - - /** - * @see Action#run() - */ - public void run() { - try { - fTargetAdapter.toggleLineBreakpoints( getTargetPart(), getTargetSelection() ); - } - catch( CoreException e ) { - ErrorDialog.openError( getTargetPart().getSite().getShell(), - "Error", //$NON-NLS-1$ - "Operation failed", //$NON-NLS-1$ - e.getStatus() ); - } - } - - /** - * Returns this action's vertical ruler info. - * - * @return this action's vertical ruler - */ - protected IVerticalRulerInfo getVerticalRulerInfo() { - return fRuler; - } - - private IWorkbenchPart getTargetPart() { - return this.fTargetPart; - } - - private void setTargetPart( IWorkbenchPart targetPart ) { - this.fTargetPart = targetPart; - // - // TODO: - // Ideally we should have an adaptor factory extension and let the runtime create - // the adapter. For now, we will just create it directly here and use it. - // - /*if (fTargetPart != null) { - IResource resource = (IResource) fTargetPart.getAdapter(IResource.class); - if (resource == null && fTargetPart instanceof IEditorPart) { - resource = (IResource) ((IEditorPart)fTargetPart).getEditorInput().getAdapter(IResource.class); - } - if (resource != null) { - fTargetAdapter = getAdapter(resource); - } - if (fTargetAdapter == null) { - fTargetAdapter = getAdapter(fTargetPart); - } - }*/ - if (fTargetAdapter == null) { - fTargetAdapter = new ToggleHwBreakpointAdapter(); - } - } - - - /** - * Returns the current selection in the active part, possibly - * and empty selection, but never null. - * - * @return the selection in the active part, possibly empty - */ - private ISelection getTargetSelection() { - IDocument doc = getDocument(); - if ( doc != null ) { - int line = getVerticalRulerInfo().getLineOfLastMouseButtonActivity(); - try { - IRegion region = doc.getLineInformation( line ); - return new TextSelection( doc, region.getOffset(), region.getLength() ); - } - catch( BadLocationException e ) { - DebugPlugin.log( e ); - } - } - return EMPTY_SELECTION; - } - - private IDocument getDocument() { - IWorkbenchPart targetPart = getTargetPart(); - if ( targetPart instanceof ITextEditor ) { - ITextEditor textEditor = (ITextEditor)targetPart; - IDocumentProvider provider = textEditor.getDocumentProvider(); - if ( provider != null ) - return provider.getDocument( textEditor.getEditorInput() ); - } - else if ( targetPart instanceof DisassemblyView ) { - DisassemblyView dv = (DisassemblyView)targetPart; - IDocumentProvider provider = dv.getDocumentProvider(); - if ( provider != null ) - return provider.getDocument( dv.getInput() ); - } - return null; - } -} diff -r 1ca0a29d6c85 -r 3d38ba458731 debuggercdi/com.nokia.cdt.debug.cw.symbian/src/com/nokia/cdt/debug/cw/symbian/breakpoint/actions/messages.properties --- a/debuggercdi/com.nokia.cdt.debug.cw.symbian/src/com/nokia/cdt/debug/cw/symbian/breakpoint/actions/messages.properties Fri Mar 12 13:12:46 2010 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -ToggleHwBreakpointAdapter.Empty_editor_1=Empty editor -ToggleHwBreakpointAdapter.Missing_document_1=Missing document -ToggleHwBreakpointAdapter.Missing_resource_1=Missing resource -ToggleHwBreakpointAdapter.Invalid_line_1=Invalid line -ToggleHwBreakpointAdapter.Empty_editor_2=Empty editor - -ToggleHwBreakpointAdapter.Operation_is_not_supported_1=Operation is not supported. -