Package Browser

 


Dolphin Smalltalk uses the notion of a package to encapsulated changes that you make to your development image. Packages can be used to group together the components of systems or subsystems that you wish to be able to install and uninstall as units. For example, the basic Dolphin image includes the OLE COM package pre-installed. If you decide that you don't require any of the facilities that this provides then it is a simple matter to uninstall from your image all of the classes that it contains.

The Package Browser is the development tool that is provided to do this. Its purpose is to manage the network of multiple packages you may have installed into your image.

The Package pane at top left displays the packages that are currently loaded. The Dolphin package is always present and represents the base development system. At top right are a number of tabbed panes that show the contents of the currently selected package. The Classes pane lists the owned classes. The Methods pane lists the owned methods (but note here that it only it lists methods that are in addition to those inherently owned by the package's classes). The Globals pane lists the globals from the Smalltalk dictionary that are owned by the selected package and the Resources pane lists all owned resources. The Scripts pane lists four Smalltalk scripts that can be set up for execution during the installation or un-installation process.

As you click in the items in the Classes, Methods or Scripts panes, the Source tab below will be selected and a pane displaying editable source for the appropriate object will be displayed. If you choose to edit this source then you must use Workspace/Accept to save the changes. You may also edit a comment for the package by clicking on the Package comment tab. The Package properties tab simply displays the name and file location of the selected package.

Creating a new package

If you are creating a new application then you will, most likely, use Package/New to create a new package that will hold the additions you'll make to the base image. As you create new classes, globals (in the Smalltalk dictionary) or resources, these can be added directly into the new package. Individual methods can also be moved from existing classes into the package.

Adding classes to a package

When you create a new class using the Class Hierarchy Browser it will not initially belong to any package. You can move it to a particular package using one of the following means:

Adding methods to a package

When you create a new method in the Class Hierarchy Browser, by default it belongs to be package of its owning class. You can move a method to any particular package using one of the following means:

Tip: when you drag a method to the same package as the one it's owning class belongs to, it will disappear from the Methods pane in the Package Browser. We do not display methods in this pane if they already belong to the package by wont of the class they are in.

Adding globals to a package

Globals that you have defined in the Smalltalk dictionary can be associated with a particular package by choosing the Package/Add uncommitted global menu command. Using the Add command from the context menu of the Globals pane can also perform this operation.

Adding resources to a package

Resources displayed in the Resource Browser can also be added to a package. Since resources are always associated with particular classes they are, by default, already owned by the package of their owning class. If, however, you wish a resource to be moved to a different package you can drag it from the Resource Browser and drop it over the chosen package in the Package Browser.

Tip: the Resources pane displays all of the resources held by a package not just the ones that have been moved from their default location.

Saving a package

Choose the Package/Save command to export the entire contents of a selected package to disk. The package will be stored in a file with PAC extension. Exported packages can be distributed for installation into other Dolphin images. You should note that a PAC file is essentially a source distribution mechanism. Although it does contain some binary elements (resources, globals etc.) it is mainly composed of the source for the classes and methods that it contains. Beware of this if you intend to distribute your products using the packaging mechanism.

Tip: the PAC file format is proprietary to Dolphin and is not intended to be used for exporting code that may be imported into any other Smalltalk development environments

Before being saved, a package will first be checked to ensure that it contains no cyclic dependencies. If you are working with multiple packages it is possible to get into the situation where one package depends on the contents of another and vice versa. In this case you will be prevented from saving either of the troubled packages. In order to track down such a cyclic dependency problem we have provided a tool to show the prerequisites of a package; with the package in question selected choose Package/Show prerequisites to bring up the Prerequisites Browser.

Installing a package

Use Package/Install to choose a package file that you want to install into your image. If the package refers to other packages as prerequisites then these will be automatically installed first. If the prerequisite packages are not in the same directory you may first be prompted to locate them on disk.

Errors

It is possible that, when installing a package, it may be incompatible with the state of the existing image. This might happen, for example, if you try to install packages designed for older versions of Dolphin into a newer image. In these cases there will most likely be compilation errors as the source in the package is compiled. These errors will be reported to the Transcript and you should then attempt to find the appropriate methods and fix the problems using the Class Hierarchy Browser.

Tip: you can easily browse all methods in the system that have failed to compile by choosing Method/Browser/Compilation failures in the Class Hierarchy Browser.

Note, though, that some errors when installing a package are serious enough to prevent the package installation from completing at all.

Uninstalling a package

You can remove a package from your image using the Package Browser's, Package/Uninstall command. You will not be allowed to remove a package if it is required as a prerequisite by any other installed packages; these must be removed first.

If the package contains classes that have instances then those classes will not be successfully removed. Such errors will be reported to the Transcript and the classes in question will remain in the image although they will no longer belong to any package. Following the uninstall, you should manually attempt to remove these classes by first freeing up the unwanted instances and then removing the classes using the Class Hierarchy Browser.