Example #1
0
 @Override
 public void setUp() throws Exception {
   super.setUp();
   modelAsText =
       "stuff mystuff\nstuff yourstuff refs _mystuff stuff hisstuff refs _yourstuff// Comment";
   IFile file = IResourcesSetupUtil.createFile("test/test.testlanguage", modelAsText);
   editor = openEditor(file);
   document = editor.getDocument();
   hover =
       Activator.getInstance()
           .getInjector(getEditorId())
           .getInstance(ProblemAnnotationHover.class);
   hover.setSourceViewer(editor.getInternalSourceViewer());
   List<Issue> issues =
       document.readOnly(
           new IUnitOfWork<List<Issue>, XtextResource>() {
             public List<Issue> exec(XtextResource state) throws Exception {
               return state
                   .getResourceServiceProvider()
                   .getResourceValidator()
                   .validate(state, CheckMode.ALL, null);
             }
           });
   MarkerCreator markerCreator =
       Activator.getInstance().getInjector(getEditorId()).getInstance(MarkerCreator.class);
   for (Issue issue : issues) {
     markerCreator.createMarker(issue, file, MarkerTypes.forCheckType(issue.getType()));
   }
 }
 private void removeExpensiveXtextAnnotations(IProgressMonitor monitor) {
   List<Annotation> issues = Lists.newArrayList();
   Iterator<XtextAnnotation> xtext =
       Iterators.filter(fAnnotationModel.getAnnotationIterator(), XtextAnnotation.class);
   while (xtext.hasNext() && !monitor.isCanceled()) {
     final XtextAnnotation annotation = xtext.next();
     Issue issue = annotation.getIssue();
     if (!annotation.isMarkedDeleted()
         && isRelevantAnnotationType(annotation.getType())
         && issue.getType() == CheckType.EXPENSIVE) {
       issues.add(annotation);
     }
   }
   updateAnnotations(monitor, issues, Maps.<Annotation, Position>newHashMap());
 }