use of org.eclipse.xtend.ide.editor.OverrideIndicatorAnnotation in project xtext-xtend by eclipse.
the class RenameStrategyTest method testOverrideIndicatorAnnotationAfterFileRename.
@Test
public void testOverrideIndicatorAnnotationAfterFileRename() throws Exception {
testHelper.createFile("test/SuperClass", "package test\nclass SuperClass { def foo() {}}");
final IFile subClassFile = testHelper.createFile("test/SubClass", "package test\nclass SubClass extends SuperClass { override foo () {}}");
IResourcesSetupUtil.waitForBuild();
XtextEditor openEditor = testHelper.openEditor(subClassFile);
final OverrideIndicatorAnnotation[] annotationBeforeFileRename = new OverrideIndicatorAnnotation[] { null };
final OverrideIndicatorAnnotation[] annotationAfterFileRename = new OverrideIndicatorAnnotation[] { null };
final ISourceViewer sourceViewer = openEditor.getInternalSourceViewer();
sleepWhile(Predicates.isNull(), new Provider<Object>() {
@Override
public OverrideIndicatorAnnotation get() {
annotationBeforeFileRename[0] = Iterators.getOnlyElement(Iterators.filter(sourceViewer.getAnnotationModel().getAnnotationIterator(), OverrideIndicatorAnnotation.class), null);
return annotationBeforeFileRename[0];
}
}, TimeUnit.SECONDS.toMillis(10));
assertNotNull(annotationBeforeFileRename[0]);
new WorkspaceModifyOperation() {
@Override
protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException {
subClassFile.move(subClassFile.getFullPath().removeLastSegments(1).append("Test.xtend"), true, monitor);
}
}.run(new NullProgressMonitor());
IResourcesSetupUtil.waitForBuild();
sleepWhile(Predicates.isNull(), new Provider<Object>() {
@Override
public OverrideIndicatorAnnotation get() {
OverrideIndicatorAnnotation ann = Iterators.getOnlyElement(Iterators.filter(sourceViewer.getAnnotationModel().getAnnotationIterator(), OverrideIndicatorAnnotation.class), null);
if (ann != annotationBeforeFileRename[0])
annotationAfterFileRename[0] = ann;
return annotationAfterFileRename[0];
}
}, TimeUnit.SECONDS.toMillis(10));
assertNotNull(annotationAfterFileRename[0]);
assertNotSame(annotationBeforeFileRename[0], annotationAfterFileRename[0]);
}
Aggregations