1 /* 2 * Copyright (C) 2011 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.ddmuilib.heap; 18 19 import org.eclipse.jface.viewers.ITreeContentProvider; 20 import org.eclipse.jface.viewers.Viewer; 21 22 import java.util.List; 23 24 public class NativeStackContentProvider implements ITreeContentProvider { 25 @Override 26 public Object[] getElements(Object arg0) { 27 return getChildren(arg0); 28 } 29 30 @Override 31 public void dispose() { 32 } 33 34 @Override 35 public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { 36 } 37 38 @Override 39 public Object[] getChildren(Object parentElement) { 40 if (parentElement instanceof List<?>) { 41 return ((List<?>) parentElement).toArray(); 42 } 43 44 return null; 45 } 46 47 @Override 48 public Object getParent(Object element) { 49 return null; 50 } 51 52 @Override 53 public boolean hasChildren(Object element) { 54 return false; 55 } 56 } 57