Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jdt-debug-dev] extending JDIModelPresentation


Your plug-in does not work in 3.2 because you are subclassing an internal class and the implementation has changed. The variable view introduced columns in 3.2, which has changed the way variable labels are displayed. If you turn columns off, your plug-in may still work.

As well, the "model presentation" extension point is specified to have only one model presentation per debugger. You are contributing a second presentation for the Java debugger, which has no specified behavior.

Generally, the way to customize the details area for a Java object is to use a "Detail Formatter". Since we don't support detail formatters for primitive values, this will not work for you. I would suggest to enter a feature request for this.

Darin Wright



"David Uebelacker" <david@xxxxxxxxxxxxx>
Sent by: jdt-debug-dev-bounces@xxxxxxxxxxx

11/16/2006 04:51 AM

Please respond to
"Eclipse JDT Debug developers list." <jdt-debug-dev@xxxxxxxxxxx>

To
jdt-debug-dev@xxxxxxxxxxx
cc
Subject
[jdt-debug-dev] extending JDIModelPresentation





Hi everyone,

in my current project we work with a lot of date variables as long unix
timestamp values.
This makes debugging very difficult, cause we are not taff enough to
interpret this dates in the variables view or the inspect popup.

Therefore i implemented a very small plugin to display long values
formatted as Date. I have done this by extending JDIModelPresentation:

------------
public class JDILongAsDateModelPresentation extends JDIModelPresentation
{
 public static final long MIN_DATE = -62135773200000L; //1.1.0000
 public static final long MAX_DATE = 253402210800000L; //31.12.9999
 public static final String LONG_NAME = "long";
 public static final String PREFIX = " (as date=";
 public static final String SUFIX = ")";


 /* (non-Javadoc)
  * @see
org.eclipse.jdt.internal.debug.ui.JDIModelPresentation#getValueText(org.eclipse.jdt.debug.core.IJavaValue)
  */
 protected String getValueText( IJavaValue pIJavaValue ) throws
DebugException
 {
   StringBuffer rText = new StringBuffer( super.getValueText( pIJavaValue
) );
   try
   {
     if ( pIJavaValue != null
         && pIJavaValue instanceof JDIPrimitiveValue )
     {
       JDIPrimitiveValue tJDIPrimitiveValue =
(JDIPrimitiveValue)pIJavaValue;
       if ( LONG_NAME.equals( tJDIPrimitiveValue.getJavaType().getName() ) )
       {
         long tTime = tJDIPrimitiveValue.getLongValue();

         if ( tTime >= MIN_DATE && tTime <= MAX_DATE )
         {
           Date tDate = new Date( tTime );
           rText.append( PREFIX );
           rText.append( getDateFormat().format( tDate ) );
           rText.append( SUFIX );
         }
       }
     }
   }
   catch ( Throwable t )
   {
     //not that important!
   }

   return rText.toString();
 }

 private SimpleDateFormat getDateFormat()
 {
   return new SimpleDateFormat(
WVKEclipseUtilsPlugin.getDefault().getPreferenceStore().getString(
PreferenceConstants.DATE_FORMAT_PREF ) );
 }
}

------------
<extension point="org.eclipse.debug.ui.debugModelPresentations">
        <debugModelPresentation
            class="somepackage.eclipse.JDILongAsDateModelPresentation"
            id="org.eclipse.jdt.debug"
            detailsViewerConfiguration="org.eclipse.jdt.internal.debug.ui.display.DetailsViewerConfiguration">
                    </debugModelPresentation>
                </extension>
------------

This worked very well with eclipse 3.1.0. Now i wanted to upgrade to
3.2.1, but my plugin does not work any more. I get a lot of discouraged
access warnings and my class is never used/called. Is there a way to get
it to work in 3.2.1 or a better/right way to extend the variables view ?

thanks a lot

David
_______________________________________________
jdt-debug-dev mailing list
jdt-debug-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jdt-debug-dev

Attachment: debug.PNG
Description: Binary data


Back to the top