Search in sources :

Example 1 with FindReplace

use of com.google.gwtexpui.safehtml.client.FindReplace in project gerrit by GerritCodeReview.

the class ConfigInfo method commentlinks.

final List<FindReplace> commentlinks() {
    JsArray<CommentLinkInfo> cls = commentlinks0().values();
    List<FindReplace> commentLinks = new ArrayList<>(cls.length());
    for (int i = 0; i < cls.length(); i++) {
        CommentLinkInfo cl = cls.get(i);
        if (!cl.enabled()) {
            continue;
        }
        if (cl.link() != null) {
            commentLinks.add(new LinkFindReplace(cl.match(), cl.link()));
        } else {
            try {
                FindReplace fr = new RawFindReplace(cl.match(), cl.html());
                commentLinks.add(fr);
            } catch (RuntimeException e) {
                int index = e.getMessage().indexOf("at Object");
                new ErrorDialog("Invalid commentlink configuration: " + (index == -1 ? e.getMessage() : e.getMessage().substring(0, index))).center();
            }
        }
    }
    return commentLinks;
}
Also used : FindReplace(com.google.gwtexpui.safehtml.client.FindReplace) LinkFindReplace(com.google.gwtexpui.safehtml.client.LinkFindReplace) RawFindReplace(com.google.gwtexpui.safehtml.client.RawFindReplace) LinkFindReplace(com.google.gwtexpui.safehtml.client.LinkFindReplace) ArrayList(java.util.ArrayList) ErrorDialog(com.google.gerrit.client.ErrorDialog) RawFindReplace(com.google.gwtexpui.safehtml.client.RawFindReplace)

Aggregations

ErrorDialog (com.google.gerrit.client.ErrorDialog)1 FindReplace (com.google.gwtexpui.safehtml.client.FindReplace)1 LinkFindReplace (com.google.gwtexpui.safehtml.client.LinkFindReplace)1 RawFindReplace (com.google.gwtexpui.safehtml.client.RawFindReplace)1 ArrayList (java.util.ArrayList)1