本文整理汇总了Java中org.eclipse.jface.text.IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP属性的典型用法代码示例。如果您正苦于以下问题:Java IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP属性的具体用法?Java IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP怎么用?Java IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.jface.text.IDocumentExtension4
的用法示例。
在下文中一共展示了IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isValid
public RefactoringStatus isValid(boolean needsSaving, boolean resilientForDerived)
throws CoreException {
RefactoringStatus result = super.isValid(needsSaving, resilientForDerived);
if (result.hasFatalError()) return result;
ModificationStamp currentStamp = getModificationStamp();
// we don't need to check the kind here since the document stamp
// and file stamp are in sync for documents implementing
// IDocumentExtension4. If both are file stamps the file must
// not be dirty
if (fModificationStamp.getValue() != currentStamp.getValue()
// we know here that the stamp value are equal. However, if
// the stamp is a null stamp then the king must be equal as well.
|| (fModificationStamp.isFileStamp()
&& fModificationStamp.getValue() == IResource.NULL_STAMP
&& !currentStamp.isFileStamp())
|| (fModificationStamp.isDocumentStamp()
&& fModificationStamp.getValue() == IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP
&& !currentStamp.isDocumentStamp())
|| (fModificationStamp.isFileStamp() && currentStamp.isFileStamp() && isDirty(fFile))) {
result.addFatalError(
Messages.format(
RefactoringCoreMessages.TextChanges_error_content_changed,
BasicElementLabels.getPathLabel(fFile.getFullPath(), false)));
}
return result;
}
示例2: checkModificationStamp
public void checkModificationStamp(RefactoringStatus status, long stampToMatch) {
if (fKind == DOCUMENT) {
if (stampToMatch != IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP
&& fModificationStamp != stampToMatch) {
status.addFatalError(
Messages.format(
RefactoringCoreMessages.ResourceChange_error_has_been_modified,
BasicElementLabels.getPathLabel(fResource.getFullPath(), false)));
}
} else {
if (stampToMatch != IResource.NULL_STAMP && fModificationStamp != stampToMatch) {
status.addFatalError(
Messages.format(
RefactoringCoreMessages.ResourceChange_error_has_been_modified,
BasicElementLabels.getPathLabel(fResource.getFullPath(), false)));
}
}
}
示例3: performEdit
private void performEdit(IDocument document, long oldFileValue, LinkedList<UndoEdit> editCollector, long[] oldDocValue, boolean[] setContentStampSuccess) throws MalformedTreeException, BadLocationException, CoreException {
if (document instanceof IDocumentExtension4) {
oldDocValue[0]= ((IDocumentExtension4)document).getModificationStamp();
} else {
oldDocValue[0]= oldFileValue;
}
// perform the changes
for (int index= 0; index < fUndos.length; index++) {
UndoEdit edit= fUndos[index];
UndoEdit redo= edit.apply(document, TextEdit.CREATE_UNDO);
editCollector.addFirst(redo);
}
if (document instanceof IDocumentExtension4 && fDocumentStamp != IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP) {
try {
((IDocumentExtension4)document).replace(0, 0, "", fDocumentStamp); //$NON-NLS-1$
setContentStampSuccess[0]= true;
} catch (BadLocationException e) {
throw wrapBadLocationException(e);
}
}
}
示例4: removeOccurrenceAnnotations
void removeOccurrenceAnnotations() {
fMarkOccurrenceModificationStamp= IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP;
fMarkOccurrenceTargetRegion= null;
IDocumentProvider documentProvider= getDocumentProvider();
if (documentProvider == null)
return;
IAnnotationModel annotationModel= documentProvider.getAnnotationModel(getEditorInput());
if (annotationModel == null || fOccurrenceAnnotations == null)
return;
synchronized (getLockObject(annotationModel)) {
if (annotationModel instanceof IAnnotationModelExtension) {
((IAnnotationModelExtension)annotationModel).replaceAnnotations(fOccurrenceAnnotations, null);
} else {
for (int i= 0, length= fOccurrenceAnnotations.length; i < length; i++)
annotationModel.removeAnnotation(fOccurrenceAnnotations[i]);
}
fOccurrenceAnnotations= null;
}
}
示例5: UnchangedElementListener
public UnchangedElementListener(ElementInfo element) {
this.element = element;
if (element.fDocument instanceof IDocumentExtension4) {
modificationStamp = ((IDocumentExtension4) element.fDocument).getModificationStamp();
} else {
modificationStamp = IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP;
}
}
示例6: doSetInput
@Override
protected void doSetInput(IEditorInput input) throws CoreException
{
synchronized (modificationStampLock)
{
// Reset our cache when a new input is set.
lastModificationStamp = IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP;
lastAstForModificationStamp = null;
}
super.doSetInput(input);
}
示例7: getParseResult
public ParseResult getParseResult()
{
try
{
IDocument document = getDocument();
if (document == null)
{
return null;
}
long modificationStamp = IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP;
if (document instanceof IDocumentExtension4)
{
synchronized (modificationStampLock)
{
IDocumentExtension4 iDocumentExtension = (IDocumentExtension4) document;
modificationStamp = iDocumentExtension.getModificationStamp();
if (modificationStamp != IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP
&& modificationStamp == lastModificationStamp)
{
return lastAstForModificationStamp;
}
}
}
// Don't synchronize the actual parse!
ParseResult ast = doGetAST(document);
synchronized (modificationStampLock)
{
lastAstForModificationStamp = ast;
lastModificationStamp = modificationStamp;
return lastAstForModificationStamp;
}
}
catch (Throwable e)
{
IdeLog.logTrace(CommonEditorPlugin.getDefault(), e.getMessage(), e, IDebugScopes.AST);
}
return null;
}
示例8: checkModificationStamp
public void checkModificationStamp(RefactoringStatus status, long stampToMatch) {
if (fKind == DOCUMENT) {
if (stampToMatch != IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP
&& fModificationStamp != stampToMatch) {
status.addFatalError(StringUtils.format("Resource %s has modifications", fResource.getFullPath()));
}
} else {
if (stampToMatch != IResource.NULL_STAMP && fModificationStamp != stampToMatch) {
status.addFatalError(StringUtils.format("Resource %s has modifications", fResource.getFullPath()));
}
}
}
示例9: getModificationStamp
public long getModificationStamp() {
IFileInfo info = fFileStore.fetchInfo();
return info.exists() ? info.getLastModified() : IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP;
}