public void replaceAll(JTextComponent target,String replacement){
  SyntaxDocument sDoc=ActionUtils.getSyntaxDocument(target);
  if (pattern == null || sDoc == null) {
    return;
  }
  Matcher matcher=sDoc.getMatcher(pattern);
  String newText=matcher.replaceAll(replacement);
  target.setText(newText);
}

public void replaceAll ( JTextComponent target , String replacement ) { SyntaxDocument sDoc = ActionUtils . getSyntaxDocument ( target ) ; if ( pattern == null || sDoc == null ) { return ; } Matcher matcher = sDoc . getMatcher ( pattern ) ; String newText = matcher . replaceAll ( replacement ) ; target . setText ( newText ) ; }
perform a replace all operation on the given component . note that this create a new duplicate string big as the entire document and then assign it to the target text component
