1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-28 11:25:35 +02:00

More implementation.

This commit is contained in:
Mikhail Khodjaiants 2002-08-13 22:47:32 +00:00
parent 3b0a7b4fa3
commit 34c403336b

View file

@ -6,8 +6,13 @@
package org.eclipse.cdt.debug.internal.ui;
import java.util.HashMap;
import org.eclipse.cdt.debug.core.IState;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IDebugTarget;
import org.eclipse.debug.core.model.IDisconnect;
import org.eclipse.debug.core.model.ITerminate;
import org.eclipse.debug.core.model.IThread;
import org.eclipse.debug.core.model.IValue;
import org.eclipse.debug.ui.IDebugModelPresentation;
@ -26,6 +31,18 @@ import org.eclipse.ui.IEditorInput;
public class CDTDebugModelPresentation extends LabelProvider
implements IDebugModelPresentation
{
/**
* Qualified names presentation property (value <code>"org.eclipse.debug.ui.displayQualifiedNames"</code>).
* When <code>DISPLAY_QUALIFIED_NAMES</code> is set to <code>True</code>,
* this label provider should use fully qualified type names when rendering elements.
* When set to <code>False</code>,this label provider should use simple names
* when rendering elements.
* @see #setAttribute(String, Object)
*/
public final static String DISPLAY_QUALIFIED_NAMES = "DISPLAY_QUALIFIED_NAMES"; //$NON-NLS-1$
protected HashMap fAttributes = new HashMap(3);
private static CDTDebugModelPresentation fInstance = null;
/**
@ -34,7 +51,7 @@ public class CDTDebugModelPresentation extends LabelProvider
public CDTDebugModelPresentation()
{
super();
fInstance = new CDTDebugModelPresentation();
fInstance = this;
}
public static CDTDebugModelPresentation getDefault()
@ -47,6 +64,10 @@ public class CDTDebugModelPresentation extends LabelProvider
*/
public void setAttribute( String attribute, Object value )
{
if ( value != null )
{
fAttributes.put( attribute, value );
}
}
/* (non-Javadoc)
@ -84,67 +105,67 @@ public class CDTDebugModelPresentation extends LabelProvider
* @see org.eclipse.debug.ui.ILabelProvider#getText(Object)
*/
public String getText( Object element )
{
boolean showQualified= isShowQualifiedNames();
StringBuffer label = new StringBuffer();
try
{
if ( element instanceof IDebugTarget )
return getTargetText( (IDebugTarget)element );
if ( element instanceof IThread )
return getThreadText( (IThread)element );
return super.getText( element );
label.append( getTargetText( (IDebugTarget)element, showQualified ) );
else if ( element instanceof IThread )
label.append( getThreadText( (IThread)element, showQualified ) );
if ( element instanceof ITerminate )
{
if ( ((ITerminate)element).isTerminated() )
{
label.insert( 0, "<terminated>" );
return label.toString();
}
}
if ( element instanceof IDisconnect )
{
if ( ((IDisconnect)element).isDisconnected() )
{
label.insert( 0, "<disconnected>" );
return label.toString();
}
}
protected String getTargetText( IDebugTarget target )
if ( label.length() > 0 )
{
if ( target instanceof IState )
{
IState state = (IState)target.getAdapter( IState.class );
if ( state != null )
{
switch( state.getCurrentStateId() )
{
case IState.ATTACHING:
break;
case IState.CORE_DUMP_FILE:
break;
case IState.DISCONNECTING:
break;
case IState.DISCONNECTED:
break;
case IState.RUNNING:
break;
case IState.STARTING:
break;
case IState.STEPPING:
break;
case IState.SUSPENDED:
break;
case IState.TERMINATED:
break;
return label.toString();
}
}
}
return super.getText( target );
catch ( DebugException e )
{
return "<not_responding>";
}
protected String getThreadText( IThread thread )
{
if ( thread instanceof IState )
{
IState state = (IState)thread.getAdapter( IState.class );
if ( state != null )
{
switch( state.getCurrentStateId() )
{
case IState.CORE_DUMP_FILE:
break;
case IState.RUNNING:
break;
case IState.STEPPING:
break;
case IState.SUSPENDED:
break;
return null;
}
protected boolean isShowQualifiedNames()
{
Boolean showQualified = (Boolean)fAttributes.get( DISPLAY_QUALIFIED_NAMES );
showQualified = showQualified == null ? Boolean.FALSE : showQualified;
return showQualified.booleanValue();
}
protected boolean isShowVariableTypeNames()
{
Boolean show = (Boolean)fAttributes.get( DISPLAY_VARIABLE_TYPE_NAMES );
show = show == null ? Boolean.FALSE : show;
return show.booleanValue();
}
return super.getText( thread );
protected String getTargetText( IDebugTarget target, boolean qualified ) throws DebugException
{
return target.getName();
}
protected String getThreadText( IThread thread, boolean qualified ) throws DebugException
{
return thread.getName();
}
}