/**
  * This method is called, when the document is saved or when the document and the number of lines
  * are changed.
  *
  * <p>It removes all annotations and creates new.
  *
  * @param createNew true: builds new FSTModel false: only gets new FSTDirectives
  */
 private void updateAnnotations(boolean createNew) {
   if (!annotations.isEmpty()) {
     clear();
   }
   if (createNew) {
     annotatedPositions = new HashMap<Integer, Position>(docLines);
     if (project.getComposer().getGenerationMechanism()
         == Mechanism.FEATURE_ORIENTED_PROGRAMMING) {
       try {
         createFOPAnnotations();
       } catch (BadLocationException e) {
         CorePlugin.getDefault().logError(e);
       }
     } else {
       createDirectiveList();
       createAnnotations();
     }
   } else {
     if (project.getComposer().getGenerationMechanism()
         == Mechanism.FEATURE_ORIENTED_PROGRAMMING) {
       try {
         createFOPAnnotations();
       } catch (BadLocationException e) {
         CorePlugin.getDefault().logError(e);
       }
     }
     if (!directiveMap.isEmpty()) {
       annotatedPositions.clear();
       updateDirectives();
       createAnnotations();
     }
   }
 }
 /**
  * This method is called, when the document is saved or when the document and the number of lines
  * are changed.
  *
  * <p>It removes all annotations and creates new.
  *
  * @param createNew true: builds new FSTModel false: only gets new FSTDirectives
  */
 private void updateAnnotations(boolean createNew) {
   if (!annotations.isEmpty()) {
     clear();
   }
   if (createNew) {
     annotatedPositions = new HashMap<Integer, Position>(docLines);
     createDirectiveList();
     createAnnotations();
   } else if (!directiveMap.isEmpty()) {
     annotatedPositions.clear();
     updateDirectives();
     createAnnotations();
   }
 }