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

DeviceContentProvider

public class DeviceContentProvider extends Object implements org.eclipse.jface.viewers.ITreeContentProvider
Content provider class for device Explorer.

Fields Summary
private org.eclipse.jface.viewers.TreeViewer
mViewer
private com.android.ddmlib.FileListingService
mFileListingService
private com.android.ddmlib.FileListingService.FileEntry
mRootEntry
private com.android.ddmlib.FileListingService.IListingReceiver
sListingReceiver
Constructors Summary
public DeviceContentProvider()


         
      
    
Methods Summary
public voiddispose()

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

        if (parentElement instanceof FileEntry) {
            FileEntry parentEntry = (FileEntry)parentElement;

            Object[] oldEntries = parentEntry.getCachedChildren();
            Object[] newEntries = mFileListingService.getChildren(parentEntry,
                    true, sListingReceiver);

            if (newEntries != null) {
                return newEntries;
            } else {
                // if null was returned, this means the cache was not valid,
                // and a thread was launched for ls. sListingReceiver will be
                // notified with the new entries.
                return oldEntries;
            }
        }
        return new Object[0];
    
public java.lang.Object[]getElements(java.lang.Object inputElement)

        if (inputElement instanceof FileEntry) {
            FileEntry entry = (FileEntry)inputElement;
            if (entry.isRoot()) {
                return getChildren(mRootEntry);
            }
        }

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

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

            return entry.getParent();
        }
        return null;
    
public booleanhasChildren(java.lang.Object element)

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

            return entry.getType() == FileListingService.TYPE_DIRECTORY;
        }
        return false;
    
public voidinputChanged(org.eclipse.jface.viewers.Viewer viewer, java.lang.Object oldInput, java.lang.Object newInput)

        if (viewer instanceof TreeViewer) {
            mViewer = (TreeViewer)viewer;
        }
        if (newInput instanceof FileEntry) {
            mRootEntry = (FileEntry)newInput;
        }
    
public voidsetListingService(com.android.ddmlib.FileListingService fls)

        mFileListingService = fls;