1 11 package org.eclipse.compare.internal; 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 } 27 28 public Object [] getElements(Object input) { 29 if (fContents != null && fContents == input) 30 return fContents.toArray(); 31 return new Object [0]; 32 } 33 34 public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { 35 if (newInput instanceof List ) 36 fContents= (List )newInput; 37 else 38 fContents= null; 39 } 41 42 public void dispose() { 43 } 45 46 public boolean isDeleted(Object o) { 47 return fContents != null && !fContents.contains(o); 48 } 49 } 50 | Popular Tags |