Index: ParagraphSelectDialog.java =================================================================== --- ParagraphSelectDialog.java (revision 28369) +++ ParagraphSelectDialog.java (working copy) @@ -110,31 +110,8 @@ String[] pars = paragraph.split(","); //$NON-NLS-1$ for (int i = 0; i < pars.length; i++) { try { - Paragraph paragraphInfo = ParagraphManager.getInstance().getParagraphDefinition(pars[i]); - - // prevent NPEs - if (paragraphInfo == null) { - log.error("Unable to load paragraph {}", pars[i]); - continue; - } - Button button = new Button(c1.getName(), paragraphInfo.getName()); - StringBuffer label = new StringBuffer(); - - Messages msgs = MessagesManager.getMessages(paragraphInfo.getI18nBasename()); - - label.append("" //$NON-NLS-1$ - + msgs.getWithDefault(paragraphInfo.getTitle(), paragraphInfo.getTitle()) - + "
"); //$NON-NLS-1$ - - String description = paragraphInfo.getDescription(); - if (StringUtils.isNotEmpty(description)) { - label.append(msgs.getWithDefault(description, description)); - } - label.append("

"); //$NON-NLS-1$ - button.setLabel(label.toString()); - button.setOnclick("document.getElementById('mgnlFormMain').submit();"); //$NON-NLS-1$ - c1.addOption(button); - } + createParagraph(c1, pars[i]); + } catch (Exception e) { // paragraph definition does not exist log.warn("Exception caught: " + e.getMessage(), e); //$NON-NLS-1$ @@ -146,6 +123,33 @@ return dialog; } + protected void createParagraph(DialogButtonSet c1, String paragraph) { + Paragraph paragraphInfo = ParagraphManager.getInstance().getParagraphDefinition(paragraph); + + // prevent NPEs + if (paragraphInfo == null) { + log.error("Unable to load paragraph {}", paragraph); + return; + } + Button button = new Button(c1.getName(), paragraphInfo.getName()); + StringBuffer label = new StringBuffer(); + + Messages msgs = MessagesManager.getMessages(paragraphInfo.getI18nBasename()); + + label.append("" //$NON-NLS-1$ + + msgs.getWithDefault(paragraphInfo.getTitle(), paragraphInfo.getTitle()) + + "
"); //$NON-NLS-1$ + + String description = paragraphInfo.getDescription(); + if (StringUtils.isNotEmpty(description)) { + label.append(msgs.getWithDefault(description, description)); + } + label.append("

"); //$NON-NLS-1$ + button.setLabel(label.toString()); + button.setOnclick("document.getElementById('mgnlFormMain').submit();"); //$NON-NLS-1$ + c1.addOption(button); + } + public Content getStorageNode() { return null; }