diff --git a/debug/org.eclipse.cdt.debug.core/ChangeLog b/debug/org.eclipse.cdt.debug.core/ChangeLog index 905a42b4f8c..6cb6c20fa76 100644 --- a/debug/org.eclipse.cdt.debug.core/ChangeLog +++ b/debug/org.eclipse.cdt.debug.core/ChangeLog @@ -1,3 +1,12 @@ +2004-09-15 Mikhail Khodjaiants + Removed the "ISwitchToThread" and "ISwitchToFrame" interfaces. + * ICDebugTarget.java + * ISwitchToThread.java: removed + * ISwitchToFrame.java: removed + * CDebugTarget.java + * CStackFrame.java + * CThread.java + 2004-09-13 Mikhail Khodjaiants Moved to the new CDI interfaces. * CDebugTarget.java diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICDebugTarget.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICDebugTarget.java index 10ffe0a07a6..7dbc0b19840 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICDebugTarget.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICDebugTarget.java @@ -25,7 +25,6 @@ public interface ICDebugTarget extends IDebugTarget, IJumpToLine, IJumpToAddress, IResumeWithoutSignal, - ISwitchToThread, ICDebugElement, IBreakpointTarget, ISteppingModeTarget, diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ISwitchToFrame.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ISwitchToFrame.java deleted file mode 100644 index ff8744bc245..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ISwitchToFrame.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 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; -import org.eclipse.debug.core.model.IStackFrame; - -/** - * - * Enter type comment. - * - * @since Sep 20, 2002 - */ -public interface ISwitchToFrame -{ - void switchToFrame( IStackFrame frame ) throws DebugException; -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ISwitchToThread.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ISwitchToThread.java deleted file mode 100644 index 43e5897910b..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ISwitchToThread.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 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; -import org.eclipse.debug.core.model.IThread; - -/** - * - * Enter type comment. - * - * @since Sep 20, 2002 - */ -public interface ISwitchToThread -{ - IThread getCurrentThread() throws DebugException; - void setCurrentThread( IThread thread ) throws DebugException; -} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java index c96e36aade6..d75c3f90ab4 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java @@ -1377,30 +1377,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv runToLine( file.getLocation().lastSegment(), lineNumber, skipBreakpoints ); } - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ISwitchToThread#setCurrentThread(org.eclipse.debug.core.model.IThread) - */ - public void setCurrentThread( IThread thread ) throws DebugException { - if ( !isSuspended() || !isAvailable() || !(thread instanceof CThread) ) - return; - try { - CThread oldThread = (CThread)getCurrentThread(); - if ( !thread.equals( oldThread ) ) { - getCDITarget().setCurrentThread( ((CThread)thread).getCDIThread() ); - if ( oldThread != null ) - oldThread.setCurrent( false ); - ((CThread)thread).setCurrent( true ); - } - } - catch( CDIException e ) { - targetRequestFailed( e.getMessage(), null ); - } - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ISwitchToThread#getCurrentThread() - */ - public IThread getCurrentThread() throws DebugException { + protected IThread getCurrentThread() throws DebugException { IThread[] threads = getThreads(); for( int i = 0; i < threads.length; ++i ) { if ( ((CThread)threads[i]).isCurrent() ) diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CStackFrame.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CStackFrame.java index fec2b540c44..90760df6335 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CStackFrame.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CStackFrame.java @@ -102,7 +102,6 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart protected synchronized List getVariables0() throws DebugException { CThread thread = (CThread)getThread(); if ( thread.isSuspended() ) { - thread.switchToFrame( this ); if ( fVariables == null ) { List vars = getAllCDIVariableObjects(); fVariables = new ArrayList( vars.size() ); diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CThread.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CThread.java index 6627f84c5e8..4c87ad10470 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CThread.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CThread.java @@ -42,7 +42,6 @@ import org.eclipse.cdt.debug.core.model.IDummyStackFrame; import org.eclipse.cdt.debug.core.model.IRestart; import org.eclipse.cdt.debug.core.model.IResumeWithoutSignal; import org.eclipse.cdt.debug.core.model.IRunToLine; -import org.eclipse.cdt.debug.core.model.ISwitchToFrame; import org.eclipse.cdt.debug.internal.core.ICDebugInternalConstants; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IStatus; @@ -57,7 +56,7 @@ import org.eclipse.debug.core.model.IStackFrame; /** * A thread in a C/C++ debug model. */ -public class CThread extends CDebugElement implements ICThread, IRestart, IResumeWithoutSignal, ISwitchToFrame, ICDIEventListener { +public class CThread extends CDebugElement implements ICThread, IRestart, IResumeWithoutSignal, ICDIEventListener { private final static int MAX_STACK_DEPTH = 100; @@ -86,11 +85,6 @@ public class CThread extends CDebugElement implements ICThread, IRestart, IResum */ private boolean fIsCurrent = false; - /** - * The last selected frame in this thread, null if thread is not suspended. - */ - private CStackFrame fLastStackFrame = null; - /** * The depth of the current stack. */ @@ -224,7 +218,6 @@ public class CThread extends CDebugElement implements ICThread, IRestart, IResum */ protected ICDIStackFrame[] getCDIStackFrames( int lowFrame, int highFrame ) throws DebugException { try { - ((CDebugTarget)getDebugTarget()).setCurrentThread( this ); return getCDIThread().getStackFrames( lowFrame, highFrame ); } catch( CDIException e ) { @@ -710,7 +703,6 @@ public class CThread extends CDebugElement implements ICThread, IRestart, IResum } private void handleResumedEvent( ICDIResumedEvent event ) { - setLastStackFrame( null ); CDebugElementState state = CDebugElementState.RESUMED; int detail = DebugEvent.RESUME; if ( isCurrent() && event.getType() != ICDIResumedEvent.CONTINUE ) { @@ -807,34 +799,6 @@ public class CThread extends CDebugElement implements ICThread, IRestart, IResum fIsCurrent = current; } - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ISwitchToFrame#switchToFrame(org.eclipse.debug.core.model.IStackFrame) - */ - public void switchToFrame( IStackFrame frame ) throws DebugException { - if ( frame == null || !(frame instanceof CStackFrame) /* || frame.equals( getLastStackFrame() ) */) { - return; - } - try { - ((CDebugTarget)getDebugTarget()).setCurrentThread( this ); - if ( getLastStackFrame() != null ) { - ((CDebugTarget)getDebugTarget()).resetRegisters(); - getCDIThread().setCurrentStackFrame( ((CStackFrame)frame).getCDIStackFrame() ); - } - setLastStackFrame( (CStackFrame)frame ); - } - catch( CDIException e ) { - targetRequestFailed( e.getMessage(), null ); - } - } - - private void setLastStackFrame( CStackFrame frame ) { - fLastStackFrame = frame; - } - - private CStackFrame getLastStackFrame() { - return fLastStackFrame; - } - protected int getStackDepth() throws DebugException { int depth = 0; try { @@ -908,7 +872,6 @@ public class CThread extends CDebugElement implements ICThread, IRestart, IResum } protected void resumedByTarget( int detail, List events ) { - setLastStackFrame( null ); if ( isCurrent() && detail != DebugEvent.CLIENT_REQUEST && detail != DebugEvent.UNSPECIFIED ) { setState( CDebugElementState.STEPPED ); preserveStackFrames(); diff --git a/debug/org.eclipse.cdt.debug.ui/ChangeLog b/debug/org.eclipse.cdt.debug.ui/ChangeLog index 55949803bf6..e2e62c2ab4d 100644 --- a/debug/org.eclipse.cdt.debug.ui/ChangeLog +++ b/debug/org.eclipse.cdt.debug.ui/ChangeLog @@ -1,3 +1,7 @@ +2004-09-15 Mikhail Khodjaiants + Removed the "ISwitchToThread" and "ISwitchToFrame" interfaces. + * CDebugUIPlugin.java + 2004-09-13 Mikhail Khodjaiants Fix for bug 72555: "Toggle breakpoint" action doesn't remove function breakpoints from editor. * DisassemblyEditorInput.java diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java index a98a4abcc03..f7a02518f21 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java @@ -13,8 +13,6 @@ package org.eclipse.cdt.debug.ui; import java.util.HashMap; import java.util.Map; import org.eclipse.cdt.debug.core.CDebugCorePlugin; -import org.eclipse.cdt.debug.core.model.ISwitchToFrame; -import org.eclipse.cdt.debug.core.model.ISwitchToThread; import org.eclipse.cdt.debug.internal.ui.CBreakpointUpdater; import org.eclipse.cdt.debug.internal.ui.CDTDebugModelPresentation; import org.eclipse.cdt.debug.internal.ui.CDebugImageDescriptorRegistry; @@ -28,24 +26,14 @@ import org.eclipse.core.runtime.IExtensionPoint; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Status; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.model.IDebugElement; import org.eclipse.debug.core.model.IPersistableSourceLocator; -import org.eclipse.debug.core.model.IStackFrame; -import org.eclipse.debug.core.model.IThread; -import org.eclipse.debug.ui.IDebugUIConstants; import org.eclipse.debug.ui.ILaunchConfigurationTab; import org.eclipse.jface.dialogs.ErrorDialog; import org.eclipse.jface.preference.PreferenceConverter; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.swt.SWTException; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.ISelectionListener; import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.plugin.AbstractUIPlugin; import org.osgi.framework.BundleContext; @@ -53,7 +41,7 @@ import org.osgi.framework.BundleContext; /** * The main plugin class to be used in the desktop. */ -public class CDebugUIPlugin extends AbstractUIPlugin implements ISelectionListener { +public class CDebugUIPlugin extends AbstractUIPlugin { /** * The plug-in identifier (value "org.eclipse.cdt.debug.ui"). @@ -235,56 +223,6 @@ public class CDebugUIPlugin extends AbstractUIPlugin implements ISelectionListen return getDefault().fImageDescriptorRegistry; } - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.ISelectionListener#selectionChanged(IWorkbenchPart, ISelection) - */ - public void selectionChanged( IWorkbenchPart part, ISelection selection ) { - if ( selection != null && selection instanceof IStructuredSelection ) { - if ( ((IStructuredSelection)selection).size() == 1 ) { - Object element = ((IStructuredSelection)selection).getFirstElement(); - if ( element != null && element instanceof IThread ) { - if ( ((IThread)element).getDebugTarget() instanceof ISwitchToThread ) { - try { - if ( !sameThread( (IDebugElement)element ) ) { - ((ISwitchToThread)((IThread)element).getDebugTarget()).setCurrentThread( (IThread)element ); - } - } - catch( DebugException e ) { - errorDialog( e.getMessage(), e ); - } - } - } - else if ( element != null && element instanceof IStackFrame ) { - if ( ((IStackFrame)element).getThread() instanceof ISwitchToFrame ) { - try { - if ( !sameThread( (IDebugElement)element ) ) { - ((ISwitchToThread)((IStackFrame)element).getDebugTarget()).setCurrentThread( ((IStackFrame)element).getThread() ); - } - ((ISwitchToFrame)((IStackFrame)element).getThread()).switchToFrame( (IStackFrame)element ); - } - catch( DebugException e ) { - // errorDialog( "Switch to stack frame failed.", e ); - } - } - } - } - } - } - - private boolean sameThread( IDebugElement element ) throws DebugException { - if ( element.getDebugTarget() instanceof ISwitchToThread ) { - if ( element instanceof IThread ) { - return ((IThread)element).equals( ((ISwitchToThread)element.getDebugTarget()).getCurrentThread() ); - } - if ( element instanceof IStackFrame ) { - return ((IStackFrame)element).getThread().equals( ((ISwitchToThread)element.getDebugTarget()).getCurrentThread() ); - } - } - return false; - } - public static IPersistableSourceLocator createDefaultSourceLocator() { return new DefaultSourceLocator(); } @@ -307,7 +245,6 @@ public class CDebugUIPlugin extends AbstractUIPlugin implements ISelectionListen */ public void start( BundleContext context ) throws Exception { super.start( context ); - listenSelection( true, this ); CDebugCorePlugin.getDefault().addCBreakpointListener( CBreakpointUpdater.getInstance() ); } @@ -318,33 +255,9 @@ public class CDebugUIPlugin extends AbstractUIPlugin implements ISelectionListen */ public void stop( BundleContext context ) throws Exception { CDebugCorePlugin.getDefault().removeCBreakpointListener( CBreakpointUpdater.getInstance() ); - try { - listenSelection( false, this ); - } - catch (SWTException e) { - } if ( fImageDescriptorRegistry != null ) { fImageDescriptorRegistry.dispose(); } super.stop( context ); } - - void listenSelection( final boolean enable, final ISelectionListener listener ) { - Display display = getWorkbench().getDisplay(); - if ( display == null || display.isDisposed() ) - return; - Runnable r = new Runnable() { - - public void run() { - IWorkbenchWindow ww = getActiveWorkbenchWindow(); - if ( ww != null ) { - if ( enable ) - ww.getSelectionService().addSelectionListener( IDebugUIConstants.ID_DEBUG_VIEW, listener ); - else - ww.getSelectionService().removeSelectionListener( IDebugUIConstants.ID_DEBUG_VIEW, listener ); - } - } - }; - display.asyncExec( r ); - } } \ No newline at end of file