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.internal.ccvs.core.CVSTag; 17 import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation; 18 import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin; 19 import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants; 20 import org.eclipse.team.internal.ccvs.ui.repo.RepositoryRoot; 21 22 29 public class CVSRepositoryRootElement extends CVSModelElement { 30 public ImageDescriptor getImageDescriptor(Object object) { 31 if (object instanceof ICVSRepositoryLocation || object instanceof RepositoryRoot) { 32 return CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_REPOSITORY); 33 } 34 return null; 35 } 36 public String getLabel(Object o) { 37 if (o instanceof ICVSRepositoryLocation) { 38 ICVSRepositoryLocation root = (ICVSRepositoryLocation)o; 39 o = CVSUIPlugin.getPlugin().getRepositoryManager().getRepositoryRootFor(root); 40 if (o == null) { 41 return root.getLocation(true); 42 } 43 } 44 if (o instanceof RepositoryRoot) { 45 RepositoryRoot root = (RepositoryRoot)o; 46 String name = root.getName(); 47 if (name == null) 48 return root.getRoot().getLocation(true); 49 else 50 return name; 51 } 52 return null; 53 } 54 public Object getParent(Object o) { 55 return null; 56 } 57 public Object [] fetchChildren(Object o, IProgressMonitor monitor) { 58 ICVSRepositoryLocation location = null; 59 if (o instanceof ICVSRepositoryLocation) { 60 location = (ICVSRepositoryLocation)o; 61 } 62 if (o instanceof RepositoryRoot) { 63 RepositoryRoot root = (RepositoryRoot)o; 64 location = root.getRoot(); 65 } 66 if (location == null) return null; 67 return new Object [] { 68 new CVSTagElement(CVSTag.DEFAULT, location), 69 new BranchCategory(location), 70 new VersionCategory(location), 71 new DateTagCategory(location) 72 }; 73 } 74 } 75 | Popular Tags |