FileDocCategorySizeDatePackage
ResourceLabelProvider.javaAPI DocAndroid 1.5 API4968Wed May 06 22:41:10 BST 2009com.android.ide.eclipse.adt.ui

ResourceLabelProvider

public class ResourceLabelProvider extends Object implements org.eclipse.jface.viewers.ITableLabelProvider, org.eclipse.jface.viewers.ILabelProvider
Label provider for the Resource Explorer TreeView. Each level of the tree is represented by a different class.
  • {@link ResourceType}. This represents the list of existing Resource Type present in the resources. This can be matched to the subclasses inside the class R
    • {@link ResourceItem}. This represents one resource. The actual type can be {@link ConfigurableResourceItem} (which can exist in various alternate versions), or {@link IdResourceItem}. This is similar to the resource Ids defined as R.sometype.id.
      • {@link ResourceFile}. This represents a particular version of the {@link ResourceItem}. It is displayed as a list of resource qualifier.
see
ResourceContentProvider

Fields Summary
private org.eclipse.swt.graphics.Image
mWarningImage
Constructors Summary
public ResourceLabelProvider()

        mWarningImage = PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(
                ISharedImages.IMG_OBJS_WARN_TSK).createImage();
    
Methods Summary
public voidaddListener(org.eclipse.jface.viewers.ILabelProviderListener listener)

        // pass
    
public voiddispose()

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

        if (columnIndex == 1) {
            if (element instanceof ConfigurableResourceItem) {
                ConfigurableResourceItem item = (ConfigurableResourceItem)element;
                if (item.hasDefault() == false) {
                    return mWarningImage;
                }
            }
        }
        return null;
    
public java.lang.StringgetColumnText(java.lang.Object element, int columnIndex)

        switch (columnIndex) {
            case 0:
                if (element instanceof ResourceType) {
                    return ((ResourceType)element).getDisplayName();
                } else if (element instanceof ResourceItem) {
                    return ((ResourceItem)element).getName();
                } else if (element instanceof ResourceFile) {
                    return ((ResourceFile)element).getFolder().getConfiguration().toDisplayString();
                }
                break;
            case 1:
                if (element instanceof ConfigurableResourceItem) {
                    ConfigurableResourceItem item = (ConfigurableResourceItem)element;
                    int count = item.getAlternateCount();
                    if (count > 0) {
                        if (item.hasDefault()) {
                            count++;
                        }
                        return String.format("%1$d version(s)", count);
                    }
                } else if (element instanceof IIdResourceItem) {
                    IIdResourceItem idResource = (IIdResourceItem)element;
                    if (idResource.isDeclaredInline()) {
                        return "Declared inline";
                    }
                }
                return null;
        }
        return null;
    
public org.eclipse.swt.graphics.ImagegetImage(java.lang.Object element)

see
#getColumnImage(Object, int)

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

see
#getColumnText(Object, int)

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

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

        // pass