FileDocCategorySizeDatePackage
UiModelTreeLabelProvider.javaAPI DocAndroid 1.5 API3294Wed May 06 22:41:10 BST 2009com.android.ide.eclipse.editors.ui.tree

UiModelTreeLabelProvider

public class UiModelTreeLabelProvider extends Object implements org.eclipse.jface.viewers.ILabelProvider
UiModelTreeLabelProvider is a trivial implementation of {@link ILabelProvider} where elements are expected to derive from {@link UiElementNode} or from {@link ElementDescriptor}. It is used by both the master tree viewer and by the list in the Add... selection dialog.

Fields Summary
Constructors Summary
public UiModelTreeLabelProvider()

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

        // pass
    
public voiddispose()

        // pass
    
public org.eclipse.swt.graphics.ImagegetImage(java.lang.Object element)
Returns the element's logo with a fallback on the android logo.

        ElementDescriptor desc = null;
        if (element instanceof ElementDescriptor) {
            Image img = ((ElementDescriptor) element).getIcon();
            if (img != null) {
                return img;
            }
        } else if (element instanceof UiElementNode) {
            UiElementNode node = (UiElementNode) element;
            desc = node.getDescriptor();
            if (desc != null) {
                Image img = desc.getIcon();
                if (img != null) {
                    if (node.hasError()) {
                        //TODO: cache image
                        return new ErrorImageComposite(img).createImage();
                    } else {
                        return img;
                    }
                }
            }
        }
        return AdtPlugin.getAndroidLogo();
    
public java.lang.StringgetText(java.lang.Object element)
Uses UiElementNode.shortDescription for the label for this tree item.

        if (element instanceof ElementDescriptor) {
            ElementDescriptor desc = (ElementDescriptor) element;
            return desc.getUiName();
        } else if (element instanceof UiElementNode) {
            UiElementNode node = (UiElementNode) element;
            return node.getShortDescription();
        }
        return element.toString();
    
public booleanisLabelProperty(java.lang.Object element, java.lang.String property)

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

        // pass