KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > team > internal > ccvs > core > filehistory > CVSLocalFileRevision


1 /*******************************************************************************
2  * Copyright (c) 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.core.filehistory;
12
13 import org.eclipse.core.filesystem.URIUtil;
14 import org.eclipse.core.resources.*;
15 import org.eclipse.core.runtime.IAdaptable;
16 import org.eclipse.team.internal.ccvs.core.ICVSFile;
17 import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
18 import org.eclipse.team.internal.core.history.LocalFileRevision;
19
20 /**
21  * This subclass is used exclusively for displaying a LocalFileRevision
22  * in a CVSHistoryPage. This class was required to link local file revisions
23  * to the CVSHistoryPageSource through the use of the adapter mechanism.
24  *
25  * @since 3.2
26  */

27 public class CVSLocalFileRevision extends LocalFileRevision implements IAdaptable {
28
29     public CVSLocalFileRevision(IFile file) {
30         super(file);
31     }
32
33     public CVSLocalFileRevision(IFileState fileState) {
34         super(fileState);
35     }
36
37     public Object JavaDoc getAdapter(Class JavaDoc adapter) {
38         if (adapter == ICVSFile.class)
39             return CVSWorkspaceRoot.getCVSFileFor(ResourcesPlugin.getWorkspace().getRoot().getFile(URIUtil.toPath(getURI())));
40         
41         return null;
42     }
43
44
45 }
46
Popular Tags