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


Java ITextFileBuffer.isDirty方法代码示例

本文整理汇总了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)));
    }
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:17,代码来源:DeleteResourcesProcessor.java

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

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

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

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

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

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

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

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

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

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


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