blob: 26c854d75899bcc76050cd8fef6a1b2e1c7c5289 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
/*******************************************************************************
* Copyright (c) 2000, 2003 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.team.internal.ccvs.ui.model;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.team.internal.ccvs.core.CVSTag;
import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
import org.eclipse.team.internal.ccvs.ui.repo.RepositoryRoot;
/**
* RemoteRootElement is the model element for a repository that
* appears in the repositories view. Its children are:
* a) HEAD
* b) Branch tags category
* c) Version tags category
*/
public class CVSRepositoryRootElement extends CVSModelElement {
public ImageDescriptor getImageDescriptor(Object object) {
if (object instanceof ICVSRepositoryLocation || object instanceof RepositoryRoot) {
return CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_REPOSITORY);
}
return null;
}
public String getLabel(Object o) {
if (o instanceof ICVSRepositoryLocation) {
ICVSRepositoryLocation root = (ICVSRepositoryLocation)o;
o = CVSUIPlugin.getPlugin().getRepositoryManager().getRepositoryRootFor(root);
if (o == null) {
return root.getLocation();
}
}
if (o instanceof RepositoryRoot) {
RepositoryRoot root = (RepositoryRoot)o;
String name = root.getName();
if (name == null)
return root.getRoot().getLocation();
else
return name;
}
return null;
}
public Object getParent(Object o) {
return null;
}
public Object[] fetchChildren(Object o, IProgressMonitor monitor) {
ICVSRepositoryLocation location = null;
if (o instanceof ICVSRepositoryLocation) {
location = (ICVSRepositoryLocation)o;
}
if (o instanceof RepositoryRoot) {
RepositoryRoot root = (RepositoryRoot)o;
location = root.getRoot();
}
if (location == null) return null;
return new Object[] {
new CVSTagElement(CVSTag.DEFAULT, location),
new BranchCategory(location),
new VersionCategory(location),
new DateTagCategory(location)
};
}
}
|