private TextEdit changeVisibility(ListRewrite listRewrite,
      CompilationUnitEditor targetCompilationUnitEditor, ASTRewrite astRewrite) {

    // Swap modifiers
    List<?>/* either <Modifier> or <MarkerAnnotation> */ originalModifiers = 
      listRewrite.getOriginalList();
    ModifierKeyword foundModifier = null;
    int lastIndexOfMarker = -1;
    int indexOfOriginalModifier = -1;
    int countRemovedSoFar = 0;
    for (int i = 0; i < originalModifiers.size(); i++) {
      Object temp = originalModifiers.get(i);
      if (temp instanceof MarkerAnnotation) {
        lastIndexOfMarker = i - countRemovedSoFar;
        continue;
      }
      if (!(temp instanceof Modifier)) {
        continue;
      }
      Modifier originalModifier = (Modifier)temp;
      ModifierKeyword originalModifierKeyword = originalModifier.getKeyword();
      if (VISIBILITY_MODS.contains(originalModifierKeyword)) {
        listRewrite.remove(originalModifier, null);
        foundModifier = originalModifierKeyword;
        indexOfOriginalModifier = i;
        countRemovedSoFar++;
      }
    }
    ModifierKeyword newModifierKeyWord = modifierFor(foundModifier);

    if (newModifierKeyWord != null) {
      ASTNode newModifier = astRewrite.getAST().newModifier(newModifierKeyWord);
      listRewrite.insertAt(newModifier,
          (indexOfOriginalModifier != -1) ? indexOfOriginalModifier : lastIndexOfMarker + 1, null);
    } // else we're making it package protected

    IDocument document =
        JavaUI.getDocumentProvider().getDocument(
            targetCompilationUnitEditor.getEditorInput());
    TextEdit edit = astRewrite.rewriteAST(document, null);
    // try {
    // document.replace(0,1,"+");
    // } catch (BadLocationException e) {
    // throw new RuntimeException(e);
    // }
    return edit;
  }