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


Java ContentStamp类代码示例

本文整理汇总了Java中org.eclipse.ltk.core.refactoring.ContentStamp的典型用法代码示例。如果您正苦于以下问题:Java ContentStamp类的具体用法?Java ContentStamp怎么用?Java ContentStamp使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ContentStamp类属于org.eclipse.ltk.core.refactoring包,在下文中一共展示了ContentStamp类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createUndoChange

import org.eclipse.ltk.core.refactoring.ContentStamp; //导入依赖的package包/类
/** {@inheritDoc} */
protected Change createUndoChange(UndoEdit edit, ContentStamp stampToRestore) {
  try {
    return new UndoCompilationUnitChange(getName(), fCUnit, edit, stampToRestore, getSaveMode());
  } catch (CoreException e) {
    JavaManipulationPlugin.log(e);
    return null;
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:10,代码来源:CompilationUnitChange.java

示例2: perform

import org.eclipse.ltk.core.refactoring.ContentStamp; //导入依赖的package包/类
/** {@inheritDoc} */
public Change perform(IProgressMonitor pm) throws CoreException {
  if (fValidationState == null || fValidationState.isValid(needsSaving(), false).hasFatalError())
    return new NullChange();
  if (pm == null) pm = new NullProgressMonitor();
  ITextFileBufferManager manager = FileBuffers.getTextFileBufferManager();
  pm.beginTask("", 2); // $NON-NLS-1$
  ITextFileBuffer buffer = null;
  try {
    manager.connect(fFile.getFullPath(), LocationKind.IFILE, new SubProgressMonitor(pm, 1));
    buffer = manager.getTextFileBuffer(fFile.getFullPath(), LocationKind.IFILE);
    IDocument document = buffer.getDocument();
    ContentStamp currentStamp = ContentStamps.get(fFile, document);
    // perform the changes
    LinkedList list = new LinkedList();
    for (int index = 0; index < fUndos.length; index++) {
      UndoEdit edit = fUndos[index];
      UndoEdit redo = edit.apply(document, TextEdit.CREATE_UNDO);
      list.addFirst(redo);
    }

    // try to restore the document content stamp
    boolean success = ContentStamps.set(document, fContentStampToRestore);
    if (needsSaving()) {
      buffer.commit(pm, false);
      if (!success) {
        // We weren't able to restore document stamp.
        // Since we save restore the file stamp instead
        ContentStamps.set(fFile, fContentStampToRestore);
      }
    }
    return createUndoChange((UndoEdit[]) list.toArray(new UndoEdit[list.size()]), currentStamp);
  } catch (BadLocationException e) {
    throw Changes.asCoreException(e);
  } finally {
    if (buffer != null)
      manager.disconnect(fFile.getFullPath(), LocationKind.IFILE, new SubProgressMonitor(pm, 1));
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:40,代码来源:MultiStateUndoChange.java

示例3: set

import org.eclipse.ltk.core.refactoring.ContentStamp; //导入依赖的package包/类
public static void set(IFile file, ContentStamp s) throws CoreException {
  if (!(s instanceof ContentStampImpl)) return;
  ContentStampImpl stamp = (ContentStampImpl) s;
  long value = stamp.getFileValue();
  Assert.isTrue(value != IResource.NULL_STAMP);
  file.revertModificationStamp(value);
}
 
开发者ID:eclipse,项目名称:che,代码行数:8,代码来源:ContentStamps.java

示例4: UndoCompilationUnitChange

import org.eclipse.ltk.core.refactoring.ContentStamp; //导入依赖的package包/类
public UndoCompilationUnitChange(
    String name, ICompilationUnit unit, UndoEdit undo, ContentStamp stampToRestore, int saveMode)
    throws CoreException {
  super(name, getFile(unit), undo, stampToRestore, saveMode);
  fCUnit = unit;
}
 
开发者ID:eclipse,项目名称:che,代码行数:7,代码来源:UndoCompilationUnitChange.java

示例5: createUndoChange

import org.eclipse.ltk.core.refactoring.ContentStamp; //导入依赖的package包/类
/** {@inheritDoc} */
protected Change createUndoChange(UndoEdit edit, ContentStamp stampToRestore)
    throws CoreException {
  return new UndoCompilationUnitChange(getName(), fCUnit, edit, stampToRestore, getSaveMode());
}
 
开发者ID:eclipse,项目名称:che,代码行数:6,代码来源:UndoCompilationUnitChange.java

示例6: createFileStamp

import org.eclipse.ltk.core.refactoring.ContentStamp; //导入依赖的package包/类
private static ContentStamp createFileStamp(long value) {
  return new ContentStampImpl(FILE, value, value);
}
 
开发者ID:eclipse,项目名称:che,代码行数:4,代码来源:ContentStamps.java

示例7: createDocumentStamp

import org.eclipse.ltk.core.refactoring.ContentStamp; //导入依赖的package包/类
private static ContentStamp createDocumentStamp(long value, long fileValue) {
  return new ContentStampImpl(DOCUMENT, value, fileValue);
}
 
开发者ID:eclipse,项目名称:che,代码行数:4,代码来源:ContentStamps.java

示例8: createUndoChange

import org.eclipse.ltk.core.refactoring.ContentStamp; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected Change createUndoChange(UndoEdit edit, ContentStamp stampToRestore) {
    fUndoEdit= edit;
	return super.createUndoChange(edit, stampToRestore);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:9,代码来源:CleanUpRefactoring.java

示例9: MultiStateUndoChange

import org.eclipse.ltk.core.refactoring.ContentStamp; //导入依赖的package包/类
/**
 * Create a new multi state undo change object.
 *
 * @param name the human readable name of the change
 * @param file the file the change is working on
 * @param stamp the content stamp to restore when the undo is executed
 * @param undos the edit representing the undo modifications
 * @param saveMode the save mode as specified by {@link TextFileChange}
 * @see TextFileChange#KEEP_SAVE_STATE
 * @see TextFileChange#FORCE_SAVE
 * @see TextFileChange#LEAVE_DIRTY
 */
public MultiStateUndoChange(
    String name, IFile file, UndoEdit[] undos, ContentStamp stamp, int saveMode) {
  Assert.isNotNull(name);
  Assert.isNotNull(file);
  Assert.isNotNull(undos);
  fName = name;
  fFile = file;
  fUndos = undos;
  fContentStampToRestore = stamp;
  fSaveMode = saveMode;
}
 
开发者ID:eclipse,项目名称:che,代码行数:24,代码来源:MultiStateUndoChange.java

示例10: createUndoChange

import org.eclipse.ltk.core.refactoring.ContentStamp; //导入依赖的package包/类
/**
 * Hook to create an undo change for the given undo edit. This hook gets called while performing
 * the change to construct the corresponding undo change object.
 *
 * <p>Subclasses may override it to create a different undo change.
 *
 * @param edits the {@link UndoEdit undo edit} to create a undo change for
 * @param stampToRestore the content stamp to restore when the undo edit is executed.
 * @return the undo change
 * @throws CoreException if an undo change can't be created
 */
protected Change createUndoChange(UndoEdit[] edits, ContentStamp stampToRestore)
    throws CoreException {
  return new MultiStateUndoChange(getName(), fFile, edits, stampToRestore, fSaveMode);
}
 
开发者ID:eclipse,项目名称:che,代码行数:16,代码来源:MultiStateUndoChange.java


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