blob: 814c256a818de0e36e4c6bb9256e74f99215e07b (
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
|
/*******************************************************************************
* Copyright (c) 2000, 2006 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.team.internal.ccvs.ui.tags;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ccvs.core.ICVSFile;
import org.eclipse.team.internal.ccvs.core.ICVSResource;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
import org.eclipse.team.internal.ccvs.ui.model.CVSResourceElement;
import org.eclipse.ui.PlatformUI;
public class CVSFileElement extends CVSResourceElement {
private ICVSFile file;
public CVSFileElement(ICVSFile file) {
this.file = file;
}
/**
* Initial implementation: return null;
*/
public Object[] fetchChildren(Object o, IProgressMonitor monitor) {
return new Object[0];
}
/**
* Initial implementation: return null.
*/
public ImageDescriptor getImageDescriptor(Object object) {
return PlatformUI.getWorkbench().getEditorRegistry().getImageDescriptor(file.getName());
}
/**
* Initial implementation: return the file's name and version
*/
public String getLabel(Object o) {
try {
ResourceSyncInfo info = file.getSyncInfo();
if(info!=null) {
return file.getName() + " " + info.getRevision(); //$NON-NLS-1$
} else {
return file.getName();
}
} catch (TeamException e) {
handle(null, null, e);
return null;
}
}
/**
* @see IWorkbenchAdapter#getParent(Object)
*/
public Object getParent(Object o) {
return null;
}
public ICVSFile getCVSFile() {
return file;
}
/**
* @see CVSResourceElement#getCVSResource()
*/
public ICVSResource getCVSResource() {
return file;
}
}
|