blob: 9939ebb47b868b8d8d0586bc566da2de3cd3fdfd (
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
|
/*******************************************************************************
* Copyright (c) 2006, 2018 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.examples.filesystem.history;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import org.eclipse.core.resources.IStorage;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.team.core.history.IFileRevision;
import org.eclipse.team.core.history.provider.FileRevision;
public class FileSystemFileRevision extends FileRevision {
java.io.File remoteFile;
public FileSystemFileRevision(java.io.File file) {
this.remoteFile = file;
}
public String getName() {
return remoteFile.getName();
}
public long getTimestamp() {
return remoteFile.lastModified();
}
public IStorage getStorage(IProgressMonitor monitor) {
return new IStorage() {
public InputStream getContents() {
try {
return new FileInputStream(remoteFile);
} catch (FileNotFoundException e) {
// ignore
}
return null;
}
public IPath getFullPath() {
return new Path(remoteFile.getAbsolutePath());
}
public String getName() {
return remoteFile.getName();
}
public boolean isReadOnly() {
return true;
}
public <T> T getAdapter(Class<T> adapter) {
return null;
}
};
}
public boolean isPropertyMissing() {
return false;
}
public IFileRevision withAllProperties(IProgressMonitor monitor) {
return null;
}
public String getContentIdentifier() {
return "[File System Revision]"; //$NON-NLS-1$
}
}
|