Version 0.0.3  4-9-2003 by Christopher J. Demers

Code Context Lookup Tool for Dolphin Smalltalk (Version 5.0).

What's New:

I am finally posting a revised version of this tool.  Changes can be found in yellow.  I think I have added some pretty cool new features.  I have also improved compatibility with add-on tools by adding the short cuts to any sub classes of certain system classes if they exist.  Let me know if there are any additional places I should add the short cut.

Disclaimer:

This is Alpha code.  I have been using it myself for the past few months, however be careful with it. If I waited until I was done to post this code it might never get posted. ;)  Make sure you have working backups and use this code carefully.  Neither I nor any entity with which I may be associated will be responsible for the use or misuse of this code.  Use it at your own risk.

Background:

I found my self copying and pasting variable and method names quite a bit.  I did this to avoid misspelling them as well as to avoid retyping them.  It seemed to me that this information was readily available in Dolphin and so I set out to develop a tool that could help me lookup and insert variable and method names based on the code context.  I find this to be a rather powerful tool.  However I am also keenly aware of its limitations.  This is just the beginning, I intent to refine and improve this code.

Description:

This package will add context sensitive lookup tools to Dolphin workspaces.  It takes advantage of both the source availability of the Dolphin IDE and the reflective nature of Smalltalk.  The concept was inspired by the expression completion features in VB.  Due to the dynamically typed nature of Smalltalk my tool can not be as comprehensive as the VB expression completion feature.  It does however try to use some intelligence to enhance its usefulness.

Context Action
Cursor is after a double quote character ("). Insert the user name and the date, this is good for starting a comment. Tip:  I prefer a sort date string (6-12-2002) rather than the verbose Dolphin default, so in my image I ran: Date defaultLongPicture: false.
Cursor is after a complete class name. Provide a list of all class side methods available for the class.
Cursor is after self, or super. Provide a list of all instance side methods available for the class and all super classes excluding Object.
Cursor is after any place where a message cannot be sent, where a message receiver may be needed. Provide a list of all instance argument or temporary variables accessible from the current context.  This now uses the SmalltalkParser to try to determine the arguments and temporaries.  If it can not parse a method I have it stepping back before the first error.  This usually allows it to scan the arguments and temporaries even if the method is not complete.  It will now also include self and super in the list.  If there is an execution context then any variables in the context will also be available.
Cursor is after model. The code will attempt to determine the class type of model based on a class side defaultModel method if available and provide a list of all messages for that class.  If it can't determine the type it lists all methods in the system.  The defaultModel method is NOT evaluated, but rather the byte codes are scanned and the last class name is assumed to be the model.  There is a checkbox that can be used to prefix 'aspectValue: #' on the method.
A wild carded class name is selected, i.e. *Collection . Provide a list of all class names that match the wildcard, upon selection the selected text will be replaced with the selected class name.
In a workspace or debugger, when the cursor is after a variable. Provide a list of all instance side methods available for the class of the variable and all super classes excluding Object.  If it can't determine the type it lists all methods in the system.
Cursor is after a block. Provide a list of messages that can be sent to blocks.
Cursor is after a string. Provide a list of messages that can be sent to a String.
Cursor is after a Number. Provide a list of messages that can be sent to that type of number, Float, Fraction, Integer, etc...
Cursor is after self class Provide a list of all class side methods available for the class and all super classes.
Cursor is after a sub presenter variable. It will attempt to identify the class of the presenter based on parsing createComponents and present a list of methods based on that class.

Screen Shots:

Class selection.

Instance variable selection.

Method selection, it is dynamically filterable.

Limitations:

The code can not always figure out the class that a variable will contain due to the dynamically typed nature of Smalltalk.  If it can't determine the type it lists all methods in the system.  I have enhanced the filter to default to using beginsWith: unless a wild card is used.  This makes the filter much faster when no wild card is used.  This is only relevant when all methods in the system are displayed.  I would also like to add variable class resolution code that could examine ReStore database class specification methods.

Directions:

After the package is loaded you will want to have it add a  menu to the development UI.  This can be accomplished by evaluating the appropriate line in the package comment.

License:

This code is freeware, not public domain, I retain the copyright.  The code may be freely used and freely modified, but please don't redistributed modified versions.  I may make exceptions (ask me), and I may make this more lenient in the future.  For now I want to keep things simple.

Download:

By downloading the code bellow you are signifying your acceptance of my license (above) and disclaimer (at top).  This is a Dolphin 5 package only. Please give me feedback ( Christopher J. Demers ) about this code. I hope this will be useful to others, enjoy!

CJDWorkspaceLookUp.pac

Hit Counter visits since 4-9-2003


See my other Smalltalk tools