本文整理汇总了Java中org.eclipse.core.filebuffers.ITextFileBuffer.isDirty方法的典型用法代码示例。如果您正苦于以下问题:Java ITextFileBuffer.isDirty方法的具体用法?Java ITextFileBuffer.isDirty怎么用?Java ITextFileBuffer.isDirty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.core.filebuffers.ITextFileBuffer
的用法示例。
在下文中一共展示了ITextFileBuffer.isDirty方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: isValid
import org.eclipse.core.filebuffers.ITextFileBuffer; //导入方法依赖的package包/类
/** {@inheritDoc} */
public RefactoringStatus isValid(IProgressMonitor pm) throws CoreException {
if (pm == null) pm = new NullProgressMonitor();
pm.beginTask("", 1); // $NON-NLS-1$
try {
if (fValidationState == null)
throw new CoreException(
new Status(
IStatus.ERROR,
RefactoringCorePlugin.getPluginId(),
"MultiStateUndoChange has not been initialialized")); // $NON-NLS-1$
ITextFileBuffer buffer =
FileBuffers.getTextFileBufferManager()
.getTextFileBuffer(fFile.getFullPath(), LocationKind.IFILE);
fDirty = buffer != null && buffer.isDirty();
return fValidationState.isValid(needsSaving(), true);
} finally {
pm.done();
}
}
示例3: create
import org.eclipse.core.filebuffers.ITextFileBuffer; //导入方法依赖的package包/类
public static BufferValidationState create(IFile file) {
ITextFileBuffer buffer = getBuffer(file);
if (buffer == null) {
return new ModificationStampValidationState(file);
} else {
IDocument document = buffer.getDocument();
if (document instanceof IDocumentExtension4) {
return new ModificationStampValidationState(file);
} else {
if (buffer.isDirty()) {
return new NoStampValidationState(file);
} else {
return new ModificationStampValidationState(file);
}
}
}
}
示例4: 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();
}
}
示例5: isValid
import org.eclipse.core.filebuffers.ITextFileBuffer; //导入方法依赖的package包/类
/** {@inheritDoc} */
public RefactoringStatus isValid(IProgressMonitor pm) throws CoreException {
if (pm == null) pm = new NullProgressMonitor();
pm.beginTask("", 1); // $NON-NLS-1$
try {
if (fValidationState == null)
throw new CoreException(
new Status(
IStatus.ERROR,
RefactoringCorePlugin.getPluginId(),
"UndoTextFileChange has not been initialialized")); // $NON-NLS-1$
ITextFileBuffer buffer =
FileBuffers.getTextFileBufferManager()
.getTextFileBuffer(fFile.getFullPath(), LocationKind.IFILE);
fDirty = buffer != null && buffer.isDirty();
return fValidationState.isValid(needsSaving(), true);
} finally {
pm.done();
}
}
示例6: 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)));
}
}
}
示例7: 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();
}
示例8: isValid
import org.eclipse.core.filebuffers.ITextFileBuffer; //导入方法依赖的package包/类
public final RefactoringStatus isValid(IProgressMonitor monitor)
throws CoreException, OperationCanceledException {
if (monitor == null) monitor = new NullProgressMonitor();
monitor.beginTask("", 1); // $NON-NLS-1$
try {
if (fValidationState == null)
throw new CoreException(
new Status(
IStatus.ERROR,
RefactoringCorePlugin.getPluginId(),
"MultiStateTextFileChange has not been initialialized")); // $NON-NLS-1$
final ITextFileBuffer buffer =
FileBuffers.getTextFileBufferManager()
.getTextFileBuffer(fFile.getFullPath(), LocationKind.IFILE);
fDirty = buffer != null && buffer.isDirty();
final RefactoringStatus status = fValidationState.isValid(needsSaving());
if (needsSaving()) {
status.merge(Changes.validateModifiesFiles(new IFile[] {fFile}));
} else {
// we are reading the file. So it should be at least in sync
status.merge(Changes.checkInSync(new IFile[] {fFile}));
}
return status;
} finally {
monitor.done();
}
}
示例9: 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();
}
示例10: isContainerDirty
import org.eclipse.core.filebuffers.ITextFileBuffer; //导入方法依赖的package包/类
public boolean isContainerDirty(TypeNameMatch match) {
ICompilationUnit cu= match.getType().getCompilationUnit();
if (cu == null) {
return false;
}
IResource resource= cu.getResource();
ITextFileBufferManager manager= FileBuffers.getTextFileBufferManager();
ITextFileBuffer textFileBuffer= manager.getTextFileBuffer(resource.getFullPath(), LocationKind.IFILE);
if (textFileBuffer != null) {
return textFileBuffer.isDirty();
}
return false;
}
示例11: isDirty
import org.eclipse.core.filebuffers.ITextFileBuffer; //导入方法依赖的package包/类
protected static boolean isDirty(IFile file) {
ITextFileBuffer buffer = getBuffer(file);
if (buffer == null) return false;
return buffer.isDirty();
}