1 11 package org.eclipse.team.internal.ccvs.ui.model; 12 13 14 import org.eclipse.core.runtime.IProgressMonitor; 15 import org.eclipse.jface.resource.ImageDescriptor; 16 import org.eclipse.team.core.TeamException; 17 import org.eclipse.team.internal.ccvs.core.ICVSFile; 18 import org.eclipse.team.internal.ccvs.core.ICVSFolder; 19 import org.eclipse.team.internal.ccvs.core.ICVSResource; 20 import org.eclipse.ui.ISharedImages; 21 import org.eclipse.ui.PlatformUI; 22 23 public class CVSFolderElement extends CVSResourceElement { 24 25 private ICVSFolder folder; 26 private boolean includeUnmanaged; 27 28 public CVSFolderElement(ICVSFolder folder, boolean includeUnmanaged) { 29 this.folder = folder; 30 this.includeUnmanaged = includeUnmanaged; 31 } 32 33 36 public Object [] fetchChildren(Object o, IProgressMonitor monitor) throws TeamException { 37 ICVSResource[] children = folder.fetchChildren(monitor); 38 CVSResourceElement[] elements = new CVSResourceElement[children.length]; 39 for (int i = 0; i < children.length; i++) { 40 ICVSResource resource = children[i]; 41 if(resource.isFolder()) { 42 elements[i] = new CVSFolderElement((ICVSFolder)resource, includeUnmanaged); 43 } else { 44 elements[i] = new CVSFileElement((ICVSFile)resource); 45 } 46 } 47 return elements; 48 } 49 50 53 public boolean isRemoteElement() { 54 return true; 55 } 56 57 61 public String getLabel(Object o) { 62 return folder.getName(); 63 } 64 65 public ImageDescriptor getImageDescriptor(Object object) { 66 return PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJ_FOLDER); 67 } 68 69 72 public Object getParent(Object o) { 73 return new CVSFolderElement(folder.getParent(), includeUnmanaged); 74 } 75 76 79 public ICVSResource getCVSResource() { 80 return folder ; 81 } 82 } 83 | Popular Tags |