本文整理汇总了Java中org.eclipse.core.filebuffers.ITextFileBuffer.isStateValidated方法的典型用法代码示例。如果您正苦于以下问题:Java ITextFileBuffer.isStateValidated方法的具体用法?Java ITextFileBuffer.isStateValidated怎么用?Java ITextFileBuffer.isStateValidated使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.core.filebuffers.ITextFileBuffer
的用法示例。
在下文中一共展示了ITextFileBuffer.isStateValidated方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkDirtyFile
import org.eclipse.core.filebuffers.ITextFileBuffer; //导入方法依赖的package包/类
private void checkDirtyFile(RefactoringStatus result, IFile file) {
if (!file.exists()) return;
ITextFileBuffer buffer =
FileBuffers.getTextFileBufferManager()
.getTextFileBuffer(file.getFullPath(), LocationKind.IFILE);
if (buffer != null && buffer.isDirty()) {
String message = RefactoringCoreMessages.DeleteResourcesProcessor_warning_unsaved_file;
if (buffer.isStateValidated() && buffer.isSynchronized()) {
result.addWarning(
Messages.format(message, BasicElementLabels.getPathLabel(file.getFullPath(), false)));
} else {
result.addFatalError(
Messages.format(message, BasicElementLabels.getPathLabel(file.getFullPath(), false)));
}
}
}
示例2: saveFileIfNeeded
import org.eclipse.core.filebuffers.ITextFileBuffer; //导入方法依赖的package包/类
private static void saveFileIfNeeded(IFile file, IProgressMonitor pm) throws CoreException {
ITextFileBuffer buffer =
FileBuffers.getTextFileBufferManager()
.getTextFileBuffer(file.getFullPath(), LocationKind.IFILE);
if (buffer != null
&& buffer.isDirty()
&& buffer.isStateValidated()
&& buffer.isSynchronized()) {
pm.beginTask("", 2); // $NON-NLS-1$
buffer.commit(new SubProgressMonitor(pm, 1), false);
file.refreshLocal(IResource.DEPTH_ONE, new SubProgressMonitor(pm, 1));
pm.done();
} else {
pm.beginTask("", 1); // $NON-NLS-1$
pm.worked(1);
pm.done();
}
}
示例3: checkDirtyFile
import org.eclipse.core.filebuffers.ITextFileBuffer; //导入方法依赖的package包/类
private void checkDirtyFile(RefactoringStatus result, IFile file) {
if (file == null || !file.exists())
return;
ITextFileBuffer buffer= FileBuffers.getTextFileBufferManager().getTextFileBuffer(file.getFullPath(), LocationKind.IFILE);
if (buffer != null && buffer.isDirty()) {
if (buffer.isStateValidated() && buffer.isSynchronized()) {
result.addWarning(Messages.format(
RefactoringCoreMessages.JavaDeleteProcessor_unsaved_changes,
BasicElementLabels.getPathLabel(file.getFullPath(), false)));
} else {
result.addFatalError(Messages.format(
RefactoringCoreMessages.JavaDeleteProcessor_unsaved_changes,
BasicElementLabels.getPathLabel(file.getFullPath(), false)));
}
}
}
示例4: saveFileIfNeeded
import org.eclipse.core.filebuffers.ITextFileBuffer; //导入方法依赖的package包/类
protected static void saveFileIfNeeded(IFile file, IProgressMonitor pm) throws CoreException {
ITextFileBuffer buffer =
FileBuffers.getTextFileBufferManager()
.getTextFileBuffer(file.getFullPath(), LocationKind.IFILE);
if (buffer != null
&& buffer.isDirty()
&& buffer.isStateValidated()
&& buffer.isSynchronized()) {
pm.beginTask("", 2); // $NON-NLS-1$
buffer.commit(new SubProgressMonitor(pm, 1), false);
file.refreshLocal(IResource.DEPTH_ONE, new SubProgressMonitor(pm, 1));
}
pm.done();
}
示例5: saveFileIfNeeded
import org.eclipse.core.filebuffers.ITextFileBuffer; //导入方法依赖的package包/类
protected static void saveFileIfNeeded(IFile file, IProgressMonitor pm) throws CoreException {
ITextFileBuffer buffer= FileBuffers.getTextFileBufferManager().getTextFileBuffer(file.getFullPath(), LocationKind.IFILE);
if (buffer != null && buffer.isDirty() && buffer.isStateValidated() && buffer.isSynchronized()) {
pm.beginTask("", 2); //$NON-NLS-1$
buffer.commit(new SubProgressMonitor(pm, 1), false);
file.refreshLocal(IResource.DEPTH_ONE, new SubProgressMonitor(pm, 1));
}
pm.done();
}