本文整理汇总了Java中org.eclipse.core.resources.IFileState.getContents方法的典型用法代码示例。如果您正苦于以下问题:Java IFileState.getContents方法的具体用法?Java IFileState.getContents怎么用?Java IFileState.getContents使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.core.resources.IFileState
的用法示例。
在下文中一共展示了IFileState.getContents方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getOldEdk2Module
import org.eclipse.core.resources.IFileState; //导入方法依赖的package包/类
private static Edk2Module getOldEdk2Module(IResource resource, String workspacePath)
throws CoreException, FileNotFoundException, IOException {
Edk2Module oldModule = null;
IFile infFile = (IFile) resource;
IFileState[] states = infFile.getHistory(null);
if(states != null && states.length > 0) {
IFileState lastState = states[0];
oldModule = new Edk2Module(resource.getLocation().toString(), workspacePath, lastState.getContents());
}
return oldModule;
}
示例2: recordStateFromHistory
import org.eclipse.core.resources.IFileState; //导入方法依赖的package包/类
public void recordStateFromHistory(IResource resource, IProgressMonitor monitor)
throws CoreException {
Assert.isLegal(resource.getType() == IResource.FILE);
if (location != null) {
// file is linked, no need to record any history
return;
}
IFileState[] states = ((IFile) resource).getHistory(monitor);
if (states.length > 0) {
final IFileState state = getMatchingFileState(states);
this.fileContentDescription =
new IFileContentDescription() {
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.internal.ide.undo.IFileContentDescription#exists()
*/
public boolean exists() {
return state.exists();
}
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.internal.ide.undo.IFileContentDescription#getContents()
*/
public InputStream getContents() throws CoreException {
return state.getContents();
}
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.internal.ide.undo.IFileContentDescription#getCharset()
*/
public String getCharset() throws CoreException {
return state.getCharset();
}
};
}
}