FileDocCategorySizeDatePackage
FileLabelProvider.javaAPI DocAndroid 1.5 API4878Wed May 06 22:41:08 BST 2009com.android.ddmuilib.explorer

FileLabelProvider

public class FileLabelProvider extends Object implements org.eclipse.jface.viewers.ITableLabelProvider, org.eclipse.jface.viewers.ILabelProvider
Label provider for the FileEntry.

Fields Summary
private org.eclipse.swt.graphics.Image
mFileImage
private org.eclipse.swt.graphics.Image
mFolderImage
private org.eclipse.swt.graphics.Image
mPackageImage
private org.eclipse.swt.graphics.Image
mOtherImage
Constructors Summary
public FileLabelProvider(org.eclipse.swt.graphics.Image fileImage, org.eclipse.swt.graphics.Image folderImage, org.eclipse.swt.graphics.Image packageImage, org.eclipse.swt.graphics.Image otherImage)
Creates Label provider with custom images.

param
fileImage the Image to represent a file
param
folderImage the Image to represent a folder
param
packageImage the Image to represent a .apk file. If null, fileImage is used instead.
param
otherImage the Image to represent all other entry type.

        mFileImage = fileImage;
        mFolderImage = folderImage;
        mOtherImage = otherImage;
        if (packageImage != null) {
            mPackageImage = packageImage;
        } else {
            mPackageImage = fileImage;
        }
    
public FileLabelProvider()
Creates a label provider with default images.


    
Methods Summary
public voidaddListener(org.eclipse.jface.viewers.ILabelProviderListener listener)

        // we don't need listeners.
    
public voiddispose()

    
public org.eclipse.swt.graphics.ImagegetColumnImage(java.lang.Object element, int columnIndex)

        if (columnIndex == 0) {
            if (element instanceof FileEntry) {
                FileEntry entry = (FileEntry)element;
                switch (entry.getType()) {
                    case FileListingService.TYPE_FILE:
                    case FileListingService.TYPE_LINK:
                        // get the name and extension
                        if (entry.isApplicationPackage()) {
                            return mPackageImage;
                        }
                        return mFileImage;
                    case FileListingService.TYPE_DIRECTORY:
                    case FileListingService.TYPE_DIRECTORY_LINK:
                        return mFolderImage;
                }
            }

            // default case return a different image.
            return mOtherImage;
        }
        return null;
    
public java.lang.StringgetColumnText(java.lang.Object element, int columnIndex)

        if (element instanceof FileEntry) {
            FileEntry entry = (FileEntry)element;

            switch (columnIndex) {
                case 0:
                    return entry.getName();
                case 1:
                    return entry.getSize();
                case 2:
                    return entry.getDate();
                case 3:
                    return entry.getTime();
                case 4:
                    return entry.getPermissions();
                case 5:
                    return entry.getInfo();
            }
        }
        return null;
    
public org.eclipse.swt.graphics.ImagegetImage(java.lang.Object element)

        return null;
    
public java.lang.StringgetText(java.lang.Object element)

        return null;
    
public booleanisLabelProperty(java.lang.Object element, java.lang.String property)

        return false;
    
public voidremoveListener(org.eclipse.jface.viewers.ILabelProviderListener listener)

        // we don't need listeners