1 11 package org.eclipse.jdt.internal.ui.viewsupport; 12 13 import java.util.List ; 14 15 import org.eclipse.jface.viewers.IStructuredContentProvider; 16 import org.eclipse.jface.viewers.Viewer; 17 18 21 public class ListContentProvider implements IStructuredContentProvider { 22 List fContents; 23 24 public ListContentProvider() { 25 } 26 27 public Object [] getElements(Object input) { 28 if (fContents != null && fContents == input) 29 return fContents.toArray(); 30 return new Object [0]; 31 } 32 33 public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { 34 if (newInput instanceof List ) 35 fContents= (List )newInput; 36 else 37 fContents= null; 38 } 40 41 public void dispose() { 42 } 43 44 public boolean isDeleted(Object o) { 45 return fContents != null && !fContents.contains(o); 46 } 47 } 48 | Popular Tags |