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

ResourceContentProvider

public class ResourceContentProvider extends Object implements org.eclipse.jface.viewers.ITreeContentProvider
Content 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 (which can existing in various alternate versions). This is similar to the resource Ids defined as R.sometype.id.
      • {@link ResourceFile}. (optional) This represents a particular version of the {@link ResourceItem}. It is displayed as a list of resource qualifier.
see
ResourceLabelProvider

Fields Summary
private com.android.ide.eclipse.common.resources.IResourceRepository
mResources
The current ProjectResources being displayed.
private boolean
mFullLevels
Constructors Summary
public ResourceContentProvider(boolean fullLevels)
Constructs a new content providers for resource display.

param
fullLevels if true the content provider will suppport all 3 levels. If false, only two levels are provided.

        mFullLevels = fullLevels;
    
Methods Summary
public voiddispose()

        // pass
    
public java.lang.Object[]getChildren(java.lang.Object parentElement)

        if (parentElement instanceof ResourceType) {
            return mResources.getResources((ResourceType)parentElement);
        } else if (mFullLevels && parentElement instanceof ConfigurableResourceItem) {
            return ((ConfigurableResourceItem)parentElement).getSourceFileArray();
        }
        return null;
    
public java.lang.Object[]getElements(java.lang.Object inputElement)

        if (inputElement instanceof IResourceRepository) {
            if ((IResourceRepository)inputElement == mResources) {
                // get the top level resources.
                return mResources.getAvailableResourceTypes();
            }
        }

        return new Object[0];
    
public java.lang.ObjectgetParent(java.lang.Object element)

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

        if (element instanceof ResourceType) {
            return mResources.hasResources((ResourceType)element);
        } else if (mFullLevels && element instanceof ConfigurableResourceItem) {
            return ((ConfigurableResourceItem)element).hasAlternates();
        }
        return false;
    
public voidinputChanged(org.eclipse.jface.viewers.Viewer viewer, java.lang.Object oldInput, java.lang.Object newInput)

        if (newInput instanceof IResourceRepository) {
             mResources = (IResourceRepository)newInput;
        }