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

UiModelTreeContentProvider

public class UiModelTreeContentProvider extends Object implements org.eclipse.jface.viewers.ITreeContentProvider
UiModelTreeContentProvider is a trivial implementation of {@link ITreeContentProvider} where elements are expected to be instances of {@link UiElementNode}.

Fields Summary
private com.android.ide.eclipse.editors.descriptors.ElementDescriptor[]
mDescriptorFilters
The descriptor of the elements to be displayed as root in this tree view. All elements of the same type in the root will be displayed.
private final com.android.ide.eclipse.editors.uimodel.UiElementNode
mUiRootNode
The uiRootNode of the model.
Constructors Summary
public UiModelTreeContentProvider(com.android.ide.eclipse.editors.uimodel.UiElementNode uiRootNode, com.android.ide.eclipse.editors.descriptors.ElementDescriptor[] descriptorFilters)

        mUiRootNode = uiRootNode;
        mDescriptorFilters = descriptorFilters;
    
Methods Summary
public voiddispose()

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

        if (parentElement instanceof UiElementNode) {
            UiElementNode node = (UiElementNode) parentElement;
            return node.getUiChildren().toArray();
        }
        return null;
    
public java.lang.Object[]getElements(java.lang.Object inputElement)

        ArrayList<UiElementNode> roots = new ArrayList<UiElementNode>();
        if (mUiRootNode != null) {
            for (UiElementNode ui_node : mUiRootNode.getUiChildren()) {
                if (mDescriptorFilters == null || mDescriptorFilters.length == 0) {
                    roots.add(ui_node);
                } else {
                    for (ElementDescriptor filter : mDescriptorFilters) {
                        if (ui_node.getDescriptor() == filter) {
                            roots.add(ui_node);
                        }
                    }
                }
            }
        }
        
        return roots.toArray();
    
public java.lang.ObjectgetParent(java.lang.Object element)

        if (element instanceof UiElementNode) {
            UiElementNode node = (UiElementNode) element;
            return node.getUiParent();
        }
        return null;
    
public booleanhasChildren(java.lang.Object element)

        if (element instanceof UiElementNode) {
            UiElementNode node = (UiElementNode) element;
            return node.getUiChildren().size() > 0;
        }
        return false;
    
public voidinputChanged(org.eclipse.jface.viewers.Viewer viewer, java.lang.Object oldInput, java.lang.Object newInput)

        // pass