diff --git a/debug/org.eclipse.cdt.debug.core/ChangeLog b/debug/org.eclipse.cdt.debug.core/ChangeLog
index 1fc26cb988b..b7a4b58c16f 100644
--- a/debug/org.eclipse.cdt.debug.core/ChangeLog
+++ b/debug/org.eclipse.cdt.debug.core/ChangeLog
@@ -1,3 +1,9 @@
+2004-04-08 Mikhail Khodjaiants
+ Implementing retargettable actions.
+ * IRunToAddress.java
+ * IRunToLine.java
+ * IDisassemblyStorage.java
+
2004-04-07 Mikhail Khodjaiants
Removed the support of debugger process.
* ICDebugTarget.java
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IRunToAddress.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IRunToAddress.java
index 04d1af7ba19..d58753c998e 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IRunToAddress.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IRunToAddress.java
@@ -1,31 +1,33 @@
-/*
- *(c) Copyright QNX Software Systems Ltd. 2002.
- * All Rights Reserved.
+/**********************************************************************
+ * Copyright (c) 2004 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
*
- */
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ ***********************************************************************/
package org.eclipse.cdt.debug.core.model;
import org.eclipse.debug.core.DebugException;
/**
- *
* Provides the ability to run a debug target to the given address.
- *
- * @since Jan 13, 2003
*/
-public interface IRunToAddress
-{
+public interface IRunToAddress {
+
/**
* Returns whether this operation is currently available for this element.
- *
+ *
* @return whether this operation is currently available
*/
public boolean canRunToAddress( long address );
/**
* Causes this element to run to specified address.
- *
+ *
* @exception DebugException on failure. Reasons include:
*/
public void runToAddress( long address ) throws DebugException;
-}
+}
\ No newline at end of file
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IRunToLine.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IRunToLine.java
index 3a90a066170..b50e12182be 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IRunToLine.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IRunToLine.java
@@ -1,46 +1,48 @@
-/*
- *(c) Copyright QNX Software Systems Ltd. 2002.
- * All Rights Reserved.
+/**********************************************************************
+ * Copyright (c) 2004 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
*
- */
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ ***********************************************************************/
package org.eclipse.cdt.debug.core.model;
import org.eclipse.core.resources.IFile;
import org.eclipse.debug.core.DebugException;
/**
- *
* Provides the ability to run a debug target to the given line.
- *
- * @since Sep 19, 2002
*/
-public interface IRunToLine
-{
+public interface IRunToLine {
+
/**
* Returns whether this operation is currently available for this file and line number.
- *
+ *
* @return whether this operation is currently available
*/
public boolean canRunToLine( IFile file, int lineNumber );
/**
* Causes this element to run to specified location.
- *
+ *
* @exception DebugException on failure. Reasons include:
*/
public void runToLine( IFile file, int lineNumber ) throws DebugException;
/**
* Returns whether this operation is currently available for this file and line number.
- *
+ *
* @return whether this operation is currently available
*/
public boolean canRunToLine( String fileName, int lineNumber );
/**
* Causes this element to run to specified location.
- *
+ *
* @exception DebugException on failure. Reasons include:
*/
public void runToLine( String fileName, int lineNumber ) throws DebugException;
-}
+}
\ No newline at end of file
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/sourcelookup/IDisassemblyStorage.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/sourcelookup/IDisassemblyStorage.java
index 809c7fd6c61..b44ff02df33 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/sourcelookup/IDisassemblyStorage.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/sourcelookup/IDisassemblyStorage.java
@@ -1,9 +1,13 @@
-/*
- *(c) Copyright QNX Software Systems Ltd. 2002.
- * All Rights Reserved.
+/**********************************************************************
+ * Copyright (c) 2004 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
*
- */
-
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ ***********************************************************************/
package org.eclipse.cdt.debug.core.sourcelookup;
import org.eclipse.core.resources.IStorage;
@@ -11,11 +15,9 @@ import org.eclipse.debug.core.model.IDebugTarget;
/**
* Defines methods specific to disassembly.
- *
- * @since: Oct 8, 2002
*/
-public interface IDisassemblyStorage extends IStorage
-{
+public interface IDisassemblyStorage extends IStorage {
+
/**
* Returns the debug target of this disassembly.
*
@@ -33,15 +35,17 @@ public interface IDisassemblyStorage extends IStorage
/**
* Returns the line number for given address.
- * @param address - an address
+ *
+ * @param address - an address
* @return the line number for given address
*/
- int getLineNumber( long address ) ;
+ int getLineNumber( long address );
/**
* Returns the address of instruction at given line.
- * @param lineNumber - a line number
+ *
+ * @param lineNumber - a line number
* @return the address of instruction at given line
*/
- long getAddress( int lineNumber ) ;
-}
+ long getAddress( int lineNumber );
+}
\ No newline at end of file
diff --git a/debug/org.eclipse.cdt.debug.ui/ChangeLog b/debug/org.eclipse.cdt.debug.ui/ChangeLog
index 95f88a2e9c0..b45964bbcad 100644
--- a/debug/org.eclipse.cdt.debug.ui/ChangeLog
+++ b/debug/org.eclipse.cdt.debug.ui/ChangeLog
@@ -1,3 +1,10 @@
+2004-04-08 Mikhail Khodjaiants
+ Implementing retargettable actions.
+ * plugin.xml
+ * RetargettableActionAdapterFactory.java
+ * RunToLineAdapter.java
+ * ToggleBreakpointAdapter.java
+
2004-04-08 Mikhail Khodjaiants
Added breakpoint images and implemented the extension points for breakpoint
marker annotations.
diff --git a/debug/org.eclipse.cdt.debug.ui/plugin.xml b/debug/org.eclipse.cdt.debug.ui/plugin.xml
index 570d8bf2a02..dd95cab4e64 100644
--- a/debug/org.eclipse.cdt.debug.ui/plugin.xml
+++ b/debug/org.eclipse.cdt.debug.ui/plugin.xml
@@ -1228,5 +1228,28 @@
annotationType="org.eclipse.cdt.debug.core.breakpoint">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RetargettableActionAdapterFactory.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RetargettableActionAdapterFactory.java
new file mode 100644
index 00000000000..d331d6471fb
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RetargettableActionAdapterFactory.java
@@ -0,0 +1,43 @@
+/**********************************************************************
+ * Copyright (c) 2004 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+***********************************************************************/
+package org.eclipse.cdt.debug.internal.ui.actions;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.debug.ui.actions.IRunToLineTarget;
+import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
+
+/**
+ * Creates adapters for retargettable actions in debug platform.
+ * Contributed via org.eclipse.core.runtime.adapters
+ * extension point.
+ */
+public class RetargettableActionAdapterFactory implements IAdapterFactory {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
+ */
+ public Object getAdapter( Object adaptableObject, Class adapterType ) {
+ if ( adapterType == IToggleBreakpointsTarget.class ) {
+ return new ToggleBreakpointAdapter();
+ }
+ if ( adapterType == IRunToLineTarget.class ) {
+ return new RunToLineAdapter();
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
+ */
+ public Class[] getAdapterList() {
+ return new Class[]{ IRunToLineTarget.class, IToggleBreakpointsTarget.class };
+ }
+}
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
new file mode 100644
index 00000000000..413c31e025d
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RunToLineAdapter.java
@@ -0,0 +1,81 @@
+/**********************************************************************
+ * Copyright (c) 2004 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-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.ui.CDebugUIPlugin;
+import org.eclipse.cdt.debug.ui.ICDebugUIConstants;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.model.IDebugElement;
+import org.eclipse.debug.core.model.ISuspendResume;
+import org.eclipse.debug.ui.actions.IRunToLineTarget;
+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.IEditorPart;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.texteditor.ITextEditor;
+
+/**
+ * Run to line target adapter for the CDI debugger
+ */
+public class RunToLineAdapter implements IRunToLineTarget {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.debug.ui.actions.IRunToLineTarget#runToLine(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection,
+ * org.eclipse.debug.core.model.ISuspendResume)
+ */
+ public void runToLine( IWorkbenchPart part, ISelection selection, ISuspendResume target ) throws CoreException {
+ IEditorPart editorPart = (IEditorPart)part;
+ IEditorInput input = editorPart.getEditorInput();
+ String errorMessage = null;
+ if ( input == null ) {
+ errorMessage = "Empty editor";
+ }
+ else {
+ final ITextEditor textEditor = (ITextEditor)editorPart;
+ final IDocument document = textEditor.getDocumentProvider().getDocument( input );
+ if ( document == null ) {
+ errorMessage = "Missing document";
+ }
+ else {
+ IFile file = getFile( input );
+ ITextSelection textSelection = (ITextSelection)selection;
+ int lineNumber = textSelection.getStartLine() + 1;
+ }
+ }
+ throw new CoreException( new Status( IStatus.ERROR, CDebugUIPlugin.getUniqueIdentifier(), ICDebugUIConstants.INTERNAL_ERROR, errorMessage, null ) );
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.debug.ui.actions.IRunToLineTarget#canRunToLine(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection,
+ * org.eclipse.debug.core.model.ISuspendResume)
+ */
+ public boolean canRunToLine( IWorkbenchPart part, ISelection selection, ISuspendResume target ) {
+ return target instanceof IDebugElement && ((IDebugElement)target).getModelIdentifier().equals( CDIDebugModel.getPluginIdentifier() );
+ }
+
+ private IFile getFile( IEditorInput input ) {
+ if ( input instanceof IFileEditorInput ) {
+ return ((IFileEditorInput)input).getFile();
+ }
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleBreakpointAdapter.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleBreakpointAdapter.java
new file mode 100644
index 00000000000..c67f5798de9
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleBreakpointAdapter.java
@@ -0,0 +1,85 @@
+/**********************************************************************
+ * Copyright (c) 2004 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+***********************************************************************/
+package org.eclipse.cdt.debug.internal.ui.actions;
+
+import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.texteditor.IEditorStatusLine;
+
+
+/**
+ * Toggles a line breakpoint in a C/C++ editor.
+ */
+public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#toggleLineBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
+ */
+ public void toggleLineBreakpoints( IWorkbenchPart part, ISelection selection ) throws CoreException {
+ // TODO Auto-generated method stub
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#canToggleLineBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
+ */
+ public boolean canToggleLineBreakpoints( IWorkbenchPart part, ISelection selection ) {
+ return ( selection instanceof ITextSelection );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#toggleMethodBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
+ */
+ public void toggleMethodBreakpoints( IWorkbenchPart part, ISelection selection ) throws CoreException {
+ // TODO Auto-generated method stub
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#canToggleMethodBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
+ */
+ public boolean canToggleMethodBreakpoints( IWorkbenchPart part, ISelection selection ) {
+ // TODO for now
+ return ( selection instanceof ITextSelection );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#toggleWatchpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
+ */
+ public void toggleWatchpoints( IWorkbenchPart part, ISelection selection ) throws CoreException {
+ // TODO Auto-generated method stub
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#canToggleWatchpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
+ */
+ public boolean canToggleWatchpoints( IWorkbenchPart part, ISelection selection ) {
+ // TODO for now
+ return ( selection instanceof ITextSelection );
+ }
+
+ protected void report( String message, IWorkbenchPart part ) {
+ IEditorStatusLine statusLine = (IEditorStatusLine)part.getAdapter( IEditorStatusLine.class );
+ if ( statusLine != null ) {
+ if ( message != null ) {
+ statusLine.setMessage( true, message, null );
+ }
+ else {
+ statusLine.setMessage( true, null, null );
+ }
+ }
+ if ( message != null && CDebugUIPlugin.getActiveWorkbenchShell() != null ) {
+ CDebugUIPlugin.getActiveWorkbenchShell().getDisplay().beep();
+ }
+ }
+}