Categories
jurupa-valley escort

The tree audience makes utilization of the ILabelProvider software to offer these types of services. Let’s have a look at the interface’s two practices.

The tree audience makes utilization of the ILabelProvider software to offer these types of services. Let’s have a look at the interface’s two practices.

general public Image getImage(Object element)

This technique answers an SWT Image to be utilized when showing the domain item, element. In the event that domain item doesn’t have a corresponding image, it is possible to respond to null. Because images use OS resources you have to be careful to get rid of them when you’re not with them. This is achieved by caching the pictures into the label provider or the plug-in course and losing them if the audience is disposed.

Another point that is important bear in mind is that the tree viewer will measure your pictures if they’re various sizes. The image that is first using this technique could be the “standard” tree audience image size. All the pictures would be scaled up or down seriously to match how big this very first image. These plus and minus images found in the tree audience to demonstrate expanded and collapsed products will also be scaled towards the “standard” size.

A size that is safe utilize for the pictures is 16×16.

general public String getText( element that is object

The getText method answers a string that represents the label for the domain item, element. When there is no label when it comes to element, solution null.

public void dispose()

The dispose technique is named once the tree audience which contains the label provider is disposed. This process is frequently utilized to get rid of the cached pictures handled by the receiver.

Into the code in the above list, the tree viewer’s label provider ended up being set to an example of MovingBoxLabelProvider . Let’s take a good look at this course in more detail.