Search in sources :

Example 6 with AnnotatedToolModel

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

the class CeylonTool method getTool.

public Tool getTool(ToolModel<?> model) {
    Tool tool = null;
    if (model == null) {
        ArgumentModel<?> argumentModel = getToolModel("").getArguments().get(0);
        // XXX Very evil hack to work around the fact that the CeyonTool does
        // not use subtools yet, and so the model used to generate help doc
        // doesn't quite work right.
        argumentModel.setName("command");
        throw new NoSuchToolException(argumentModel, getToolName());
    }
    if (!(model instanceof AnnotatedToolModel))
        return null;
    boolean useCache = false;
    if (toolName != null && toolName.equals(model.getName()))
        useCache = true;
    if (useCache && toolCache != null)
        return toolCache;
    tool = getPluginFactory().bindArguments(model, this, toolArgs);
    if (useCache)
        toolCache = tool;
    return tool;
}
Also used : AnnotatedToolModel(org.eclipse.ceylon.common.tool.AnnotatedToolModel) NoSuchToolException(org.eclipse.ceylon.common.tool.NoSuchToolException) Tool(org.eclipse.ceylon.common.tool.Tool) CeylonBaseTool(org.eclipse.ceylon.common.tool.CeylonBaseTool)

Aggregations

AnnotatedToolModel (org.eclipse.ceylon.common.tool.AnnotatedToolModel)6 ResourceBundle (java.util.ResourceBundle)3 ScriptToolModel (org.eclipse.ceylon.common.tool.ScriptToolModel)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 MissingResourceException (java.util.MissingResourceException)1 CeylonBaseTool (org.eclipse.ceylon.common.tool.CeylonBaseTool)1 Description (org.eclipse.ceylon.common.tool.Description)1 NoSuchToolException (org.eclipse.ceylon.common.tool.NoSuchToolException)1 OptionModel (org.eclipse.ceylon.common.tool.OptionModel)1 PluginToolModel (org.eclipse.ceylon.common.tool.PluginToolModel)1 RemainingSections (org.eclipse.ceylon.common.tool.RemainingSections)1 Tool (org.eclipse.ceylon.common.tool.Tool)1 ToolModel (org.eclipse.ceylon.common.tool.ToolModel)1 CeylonTool (org.eclipse.ceylon.common.tools.CeylonTool)1 Doc (org.eclipse.ceylon.common.tools.help.model.Doc)1 Option (org.eclipse.ceylon.common.tools.help.model.Option)1 OptionsSection (org.eclipse.ceylon.common.tools.help.model.OptionsSection)1 SubtoolVisitor (org.eclipse.ceylon.common.tools.help.model.SubtoolVisitor)1