protected final ReplaceEdit createReplaceEdit(SearchMatch searchResult, ICompilationUnit cu) { if (searchResult.isImplicit()) { // handle Annotation Element references, see bug 94062 StringBuffer sb = new StringBuffer(getNewElementName()); if (JavaCore.INSERT.equals( cu.getJavaProject() .getOption( DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_ASSIGNMENT_OPERATOR, true))) sb.append(' '); sb.append('='); if (JavaCore.INSERT.equals( cu.getJavaProject() .getOption( DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_ASSIGNMENT_OPERATOR, true))) sb.append(' '); return new ReplaceEdit(searchResult.getOffset(), 0, sb.toString()); } else { return new ReplaceEdit( searchResult.getOffset(), searchResult.getLength(), getNewElementName()); } }
protected final boolean getCoreOption(IJavaProject project, String key, boolean def) { String option = getCoreOption(project, key); if (JavaCore.INSERT.equals(option)) return true; if (JavaCore.DO_NOT_INSERT.equals(option)) return false; return def; }