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.ICVSResource; 19 import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo; 20 import org.eclipse.ui.PlatformUI; 21 22 public class CVSFileElement extends CVSResourceElement { 23 24 private ICVSFile file; 25 26 public CVSFileElement(ICVSFile file) { 27 this.file = file; 28 } 29 30 33 public Object [] fetchChildren(Object o, IProgressMonitor monitor) { 34 return new Object [0]; 35 } 36 39 public ImageDescriptor getImageDescriptor(Object object) { 40 return PlatformUI.getWorkbench().getEditorRegistry().getImageDescriptor(file.getName()); 41 } 42 45 public String getLabel(Object o) { 46 try { 47 ResourceSyncInfo info = file.getSyncInfo(); 48 if(info!=null) { 49 return file.getName() + " " + info.getRevision(); } else { 51 return file.getName(); 52 } 53 } catch (TeamException e) { 54 handle(e); 55 return null; 56 } 57 } 58 61 public Object getParent(Object o) { 62 return null; 63 } 64 65 public ICVSFile getCVSFile() { 66 return file; 67 } 68 71 public ICVSResource getCVSResource() { 72 return file; 73 } 74 } 75 | Popular Tags |