Search in sources :

Example 1 with Description

use of org.eclipse.ceylon.common.tool.Description in project ceylon by eclipse.

the class DocBuilder method getOptionDescription.

public static String getOptionDescription(ToolModel<?> model, OptionModel<?> opt) {
    ResourceBundle toolBundle = getToolBundle(model);
    String msg = msg(toolBundle, "option." + opt.getLongName());
    if (msg.isEmpty()) {
        Description description = opt.getArgument().getSetter().getAnnotation(Description.class);
        if (description != null) {
            msg = description.value();
        }
    }
    return msg;
}
Also used : Description(org.eclipse.ceylon.common.tool.Description) ResourceBundle(java.util.ResourceBundle)

Example 2 with Description

use of org.eclipse.ceylon.common.tool.Description in project ceylon by eclipse.

the class DocBuilder method getDescription.

public static String getDescription(ToolModel<?> model) {
    if (model instanceof ScriptToolModel) {
        return invokeScript((ScriptToolModel<?>) model, "--_print-description");
    }
    AnnotatedToolModel<?> amodel = (AnnotatedToolModel<?>) model;
    ResourceBundle toolBundle = getToolBundle(model);
    String msg = msg(toolBundle, "description");
    if (msg.isEmpty()) {
        Description description = amodel.getToolClass().getAnnotation(Description.class);
        if (description != null) {
            msg = description.value();
        }
    }
    return msg;
}
Also used : Description(org.eclipse.ceylon.common.tool.Description) AnnotatedToolModel(org.eclipse.ceylon.common.tool.AnnotatedToolModel) ResourceBundle(java.util.ResourceBundle) ScriptToolModel(org.eclipse.ceylon.common.tool.ScriptToolModel)

Aggregations

ResourceBundle (java.util.ResourceBundle)2 Description (org.eclipse.ceylon.common.tool.Description)2 AnnotatedToolModel (org.eclipse.ceylon.common.tool.AnnotatedToolModel)1 ScriptToolModel (org.eclipse.ceylon.common.tool.ScriptToolModel)1