New chooser plugin, handles Templates.
| 28 | * New chooser plugin, handles Templates. |
| 29 | */ |
| 30 | public class TemplateToken extends AbstractQualifiedChooseToken<PCTemplate> |
| 31 | { |
| 32 | |
| 33 | private static final Class<PCTemplate> PCTEMPLATE_CLASS = PCTemplate.class; |
| 34 | |
| 35 | @Override |
| 36 | public String getTokenName() |
| 37 | { |
| 38 | return "TEMPLATE"; |
| 39 | } |
| 40 | |
| 41 | @Override |
| 42 | protected String getDefaultTitle() |
| 43 | { |
| 44 | return "Template choice"; |
| 45 | } |
| 46 | |
| 47 | @Override |
| 48 | public PCTemplate decodeChoice(LoadContext context, String s) |
| 49 | { |
| 50 | return context.getReferenceContext().silentlyGetConstructedCDOMObject(PCTEMPLATE_CLASS, s); |
| 51 | } |
| 52 | |
| 53 | @Override |
| 54 | public String encodeChoice(PCTemplate choice) |
| 55 | { |
| 56 | return choice.getKeyName(); |
| 57 | } |
| 58 | |
| 59 | @Override |
| 60 | protected AssociationListKey<PCTemplate> getListKey() |
| 61 | { |
| 62 | return AssociationListKey.getKeyFor(PCTEMPLATE_CLASS, "CHOOSE*TEMPLATE"); |
| 63 | } |
| 64 | |
| 65 | @Override |
| 66 | protected ParseResult parseTokenWithSeparator(LoadContext context, CDOMObject obj, String value) |
| 67 | { |
| 68 | return super.parseTokenWithSeparator(context, context.getReferenceContext().getManufacturer(PCTEMPLATE_CLASS), |
| 69 | obj, value); |
| 70 | } |
| 71 | |
| 72 | @Override |
| 73 | protected String getPersistentFormat() |
| 74 | { |
| 75 | return "PCTEMPLATE"; |
| 76 | } |
| 77 | } |
nothing calls this directly
no outgoing calls
no test coverage detected