description = "class definition") final String... def) throws FileNotFoundException
{
JavaSourceFacet java = project.getFacet(JavaSourceFacet.class);
JavaEnum je = null;
if (def != null)
{
String classDef = Strings.join(Arrays.asList(def), " ");
je = JavaParser.parse(JavaEnum.class, classDef);
}
else if (in != null)
{
je = JavaParser.parse(JavaEnum.class, in);
}
else if (enumName != null)
{
je = JavaParser.create(JavaEnum.class).setName(enumName);
}
else
{
throw new RuntimeException("arguments required");
}
if (pckg != null)
{
je.setPackage(pckg);
}
if (!je.hasSyntaxErrors())
{
java.saveJavaSource(je);
}
else
{
writer.println(ShellColor.RED, "Syntax Errors:");
for (SyntaxError error : je.getSyntaxErrors())
{
writer.println(error.toString());
}
writer.println();