1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 10:16:03 +02:00

Removed the "ISwitchToThread" and "ISwitchToFrame" interfaces.

This commit is contained in:
Mikhail Khodjaiants 2004-09-15 15:08:47 +00:00
parent 2aad3cda65
commit df267e58fa
9 changed files with 16 additions and 203 deletions

View file

@ -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

View file

@ -25,7 +25,6 @@ public interface ICDebugTarget extends IDebugTarget,
IJumpToLine,
IJumpToAddress,
IResumeWithoutSignal,
ISwitchToThread,
ICDebugElement,
IBreakpointTarget,
ISteppingModeTarget,

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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() )

View file

@ -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() );

View file

@ -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, <code>null</code> 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();

View file

@ -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

View file

@ -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 <code>"org.eclipse.cdt.debug.ui"</code>).
@ -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 );
}
}