blob: 41bc0d194b8dc81600fb6dc66d1d929c4d04255b (
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
package org.eclipse.team.internal.ccvs.ui.model;
/*
* (c) Copyright IBM Corp. 2000, 2002.
* All Rights Reserved.
*/
import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.team.internal.ccvs.core.CVSTag;
import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
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.ui.model.IWorkbenchAdapter;
/**
* This class represents an IProject resource in a repository. The
* children of a RemoteModule are its versions. A RemoteModule is
* a child of the VersionsCategory.
*/
public class RemoteVersionModule extends CVSModelElement implements IAdaptable {
CVSTag tag;
List projects = new ArrayList();
GroupedByVersionCategory parent;
/**
* RemoteProject constructor.
*/
public RemoteVersionModule(CVSTag tag, GroupedByVersionCategory parent) {
this.tag = tag;
this.parent = parent;
}
/**
* Returns an object which is an instance of the given class
* associated with this object. Returns <code>null</code> if
* no such object can be found.
*/
public Object getAdapter(Class adapter) {
if (adapter == IWorkbenchAdapter.class) return this;
return null;
}
public void addProject(ICVSRemoteFolder project) {
projects.add(project);
}
/**
* Returns the children of this object. When this object
* is displayed in a tree, the returned objects will be this
* element's children. Returns an empty enumeration if this
* object has no children. The children of the RemoteModule
* are the versions for that module.
*/
public Object[] getChildren(Object o) {
return (ICVSRemoteFolder[]) projects.toArray(new ICVSRemoteFolder[projects.size()]);
}
/**
* Returns an image to be used for displaying an object in the desktop.
* @param object The object to get an image for.
* @param owner The viewer that the image will be used in. The image will
* be disposed when this viewer is closed. If the owner is null, a new
* image is returned, and the caller is responsible for disposing it.
*/
public ImageDescriptor getImageDescriptor(Object object) {
return CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_PROJECT_VERSION);
}
/**
* Returns the name of this element. This will typically
* be used to assign a label to this object when displayed
* in the UI.
*/
public String getLabel(Object o) {
return tag.getName();
}
/**
* Returns the logical parent of the given object in its tree.
*/
public Object getParent(Object o) {
return parent;
}
/** (Non-javadoc)
* For debugging purposes only.
*/
public String toString() {
return "RemoteVersionModule(" + tag.getName() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
}
}
|