KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > team > internal > ccvs > ui > model > RemoteFileElement


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

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.osgi.util.NLS;
17 import org.eclipse.team.core.TeamException;
18 import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
19 import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
20 import org.eclipse.ui.PlatformUI;
21
22 public class RemoteFileElement extends RemoteResourceElement {
23     /**
24      * Initial implementation: return null;
25      */

26     public Object JavaDoc[] fetchChildren(Object JavaDoc o, IProgressMonitor monitor) {
27         return new Object JavaDoc[0];
28     }
29     /**
30      * Initial implementation: return null.
31      */

32     public ImageDescriptor getImageDescriptor(Object JavaDoc object) {
33         if (!(object instanceof ICVSRemoteFile)) return null;
34         return PlatformUI.getWorkbench().getEditorRegistry().getImageDescriptor(((ICVSRemoteFile)object).getName());
35     }
36     /**
37      * Initial implementation: return the file's name and version
38      */

39     public String JavaDoc getLabel(Object JavaDoc o) {
40         if (!(o instanceof ICVSRemoteFile)) return null;
41         ICVSRemoteFile file = (ICVSRemoteFile)o;
42         try {
43             return NLS.bind(CVSUIMessages.nameAndRevision, new String JavaDoc[] { file.getName(), file.getRevision() });
44         } catch (TeamException e) {
45             handle(null, null, e);
46             return null;
47         }
48     }
49 }
50
Popular Tags