Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 2e174d4ea9e8fe3e0cb4897119a18bff3900033f (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
/*******************************************************************************
 * Copyright (c) 2006 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 * IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.team.internal.ccvs.core.filehistory;

import org.eclipse.core.filesystem.URIUtil;
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.team.internal.ccvs.core.ICVSFile;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.core.history.LocalFileRevision;

/**
 * This subclass is used exclusively for displaying a LocalFileRevision
 * in a CVSHistoryPage. This class was required to link local file revisions
 * to the CVSHistoryPageSource through the use of the adapter mechanism.
 *
 * @since 3.2
 */
public class CVSLocalFileRevision extends LocalFileRevision implements IAdaptable {

	public CVSLocalFileRevision(IFile file) {
		super(file);
	}

	public CVSLocalFileRevision(IFileState fileState) {
		super(fileState);
	}

	public Object getAdapter(Class adapter) {
		if (adapter == ICVSFile.class)
			return CVSWorkspaceRoot.getCVSFileFor(ResourcesPlugin.getWorkspace().getRoot().getFile(URIUtil.toPath(getURI())));
		
		return null;
	}


}

Back to the top