本文整理汇总了Java中org.eclipse.core.resources.IFileState类的典型用法代码示例。如果您正苦于以下问题:Java IFileState类的具体用法?Java IFileState怎么用?Java IFileState使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IFileState类属于org.eclipse.core.resources包,在下文中一共展示了IFileState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getLocalHistory
import org.eclipse.core.resources.IFileState; //导入依赖的package包/类
protected IFileState[] getLocalHistory() {
final IFile file = ResourceManager.getFile(getSelection().getFirstElement());
IFileState states[] = null;
try {
if (file != null)
states = file.getHistory(null);
} catch (final CoreException ex) {
MessageDialog.openError(WorkbenchHelper.getShell(), getPromptTitle(), ex.getMessage());
return null;
}
if (states == null || states.length <= 0) {
MessageDialog.openInformation(WorkbenchHelper.getShell(), getPromptTitle(),
TeamUIMessages.ShowLocalHistory_0);
return states;
}
return states;
}
示例2: buildEditions
import org.eclipse.core.resources.IFileState; //导入依赖的package包/类
static final ITypedElement[] buildEditions(ITypedElement target, IFile file) {
// setup array of editions
IFileState[] states= null;
// add available editions
try {
states= file.getHistory(null);
} catch (CoreException ex) {
JavaPlugin.log(ex);
}
int count= 1;
if (states != null)
count+= states.length;
ITypedElement[] editions= new ITypedElement[count];
editions[0]= new ResourceNode(file);
if (states != null)
for (int i= 0; i < states.length; i++)
editions[i+1]= new HistoryItem(target, states[i]);
return editions;
}
示例3: buildEditions
import org.eclipse.core.resources.IFileState; //导入依赖的package包/类
final ITypedElement[] buildEditions(ITypedElement target, IFile file) {
// setup array of editions
IFileState[] states= null;
// add available editions
try {
states= file.getHistory(null);
} catch (CoreException ex) {
JavaPlugin.log(ex);
}
int count= 1;
if (states != null)
count+= states.length;
ITypedElement[] editions= new ITypedElement[count];
editions[0]= new ResourceNode(file);
if (states != null)
for (int i= 0; i < states.length; i++)
editions[i+1]= new HistoryItem(target, states[i]);
return editions;
}
示例4: isCurrentEdition
import org.eclipse.core.resources.IFileState; //导入依赖的package包/类
protected boolean isCurrentEdition(Object element) {
if (element instanceof IFile) {
return true;
}
if (element instanceof IFileState) {
return false;
}
if (element instanceof LocalFileRevision) {
LocalFileRevision revision = (LocalFileRevision) element;
// only current revision has a "real" current file
if (revision.getFile() != null)
return true;
}
return false;
}
示例5: 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;
}
示例6: handleChangedResource
import org.eclipse.core.resources.IFileState; //导入依赖的package包/类
/**
* Creates patch for changed resource.
*
* @param res
* changed resource
* @param delta
* resource delta
*/
private void handleChangedResource(IResource res, IResourceDelta delta) {
if (res.getType() == IResource.FILE
&& (delta.getFlags() & IResourceDelta.CONTENT) != 0) {
IFile file = (IFile) res;
IFileState[] states = null;
try {
states = file.getHistory(null);
if (states.length > 0) {
long t = states[0].getModificationTime();
Date d = new Date(t);
LogOperations.logInfo(DateFormat.getDateTimeInstance(
DateFormat.SHORT, DateFormat.SHORT).format(d)
+ "");
deltaOperations.createPatch(res);
update();
}
} catch (CoreException e) {
LogOperations
.logError("File states could not be retrieved.", e);
}
VariantSyncPlugin.getDefault().logMessage(
RESOURCE + res.getFullPath() + " has changed "
+ getFlagTxt(delta.getFlags()));
update();
}
}
示例7: setContents
import org.eclipse.core.resources.IFileState; //导入依赖的package包/类
@Override
public void setContents(
IFileState source, boolean force, boolean keepHistory, IProgressMonitor monitor)
throws CoreException {
// funnel all operations to central method
int updateFlags = force ? IResource.FORCE : IResource.NONE;
updateFlags |= keepHistory ? IResource.KEEP_HISTORY : IResource.NONE;
setContents(source.getContents(), updateFlags, monitor);
}
示例8: getMatchingFileState
import org.eclipse.core.resources.IFileState; //导入依赖的package包/类
private IFileState getMatchingFileState(IFileState[] states) {
for (int i = 0; i < states.length; i++) {
if (localTimeStamp == states[i].getModificationTime()) {
return states[i];
}
}
return states[0];
}
示例9: getMatchingFileState
import org.eclipse.core.resources.IFileState; //导入依赖的package包/类
/**
* Get the file state that matches this file description. The local time stamp is used to try to
* find a matching file state. If none can be found, the most recent copy of the file state is
* used.
*
* @param states file states
* @return best guess state
*/
private IFileState getMatchingFileState(IFileState[] states) {
for (int i = 0; i < states.length; i++) {
if (localTimeStamp == states[i].getModificationTime()) {
return states[i];
}
}
return states[0];
}
示例10: getModificationDate
import org.eclipse.core.resources.IFileState; //导入依赖的package包/类
protected long getModificationDate(Object element) {
IModificationDate md = (IModificationDate)Utils.getAdapter(element, IModificationDate.class);
if (md != null)
return md.getModificationDate();
if (element instanceof IFileState) {
IFileState fs = (IFileState) element;
return fs.getModificationTime();
}
if (element instanceof IFile) {
IFile f = (IFile) element;
return f.getLocalTimeStamp();
}
return -1;
}
示例11: getHistory
import org.eclipse.core.resources.IFileState; //导入依赖的package包/类
@Override
public IFileState[] getHistory(IProgressMonitor iProgressMonitor) throws CoreException {
throw new UnsupportedOperationException();
}
示例12: 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();
}
};
}
}
示例13: getHistory
import org.eclipse.core.resources.IFileState; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public IFileState[] getHistory(final IProgressMonitor monitor) throws CoreException {
return resource().getHistory(monitor);
}
示例14: setContents
import org.eclipse.core.resources.IFileState; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void setContents(final IFileState source, final boolean force, final boolean keepHistory, final IProgressMonitor monitor) throws CoreException {
resource().setContents(source, force, keepHistory, monitor);
}
示例15: getHistory
import org.eclipse.core.resources.IFileState; //导入依赖的package包/类
public IFileState[] getHistory(IProgressMonitor arg0) throws CoreException {
throw new RuntimeException("not implemented"); //$NON-NLS-1$
// return null;
}