当前位置: 首页>>代码示例>>Java>>正文


Java ITextFileBuffer.isSynchronized方法代码示例

本文整理汇总了Java中org.eclipse.core.filebuffers.ITextFileBuffer.isSynchronized方法的典型用法代码示例。如果您正苦于以下问题:Java ITextFileBuffer.isSynchronized方法的具体用法?Java ITextFileBuffer.isSynchronized怎么用?Java ITextFileBuffer.isSynchronized使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.core.filebuffers.ITextFileBuffer的用法示例。


在下文中一共展示了ITextFileBuffer.isSynchronized方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)));
    }
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:17,代码来源:DeleteResourcesProcessor.java

示例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();
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:19,代码来源:DeleteResourceChange.java

示例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)));
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:17,代码来源:JavaDeleteProcessor.java

示例4: getContents

import org.eclipse.core.filebuffers.ITextFileBuffer; //导入方法依赖的package包/类
/**
 * Returns the content of the given buffer.
 * 
 * @param buffer
 * @return the content of the given buffer.
 * @throws CoreException
 */
private static InputStream getContents(ITextFileBuffer buffer) throws CoreException {
	IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
	IFile file = workspaceRoot.getFile(buffer.getLocation());
	if (file.exists() && buffer.isSynchronized()) {
		return file.getContents();
	}
	return buffer.getFileStore().openInputStream(EFS.NONE, null);
}
 
开发者ID:eclipse,项目名称:tm4e,代码行数:16,代码来源:ContentTypeHelper.java

示例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();
}
 
开发者ID:eclipse,项目名称:che,代码行数:15,代码来源:AbstractDeleteChange.java

示例6: 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();
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:10,代码来源:AbstractDeleteChange.java


注:本文中的org.eclipse.core.filebuffers.ITextFileBuffer.isSynchronized方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。