Skip to content

Commit

Permalink
save Java source files using the JavaSourceFacet as directed by Lincoln
Browse files Browse the repository at this point in the history
  • Loading branch information
mbenson committed Jan 23, 2013
1 parent bff0ae2 commit c510cc9
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ public void newBean(
@Option(required = false, name = "overwrite") final boolean overwrite
) throws FileNotFoundException
{
if (!resource.createNewFile() && !overwrite)
if (resource.exists() && !overwrite)
{
throw new RuntimeException("Type already exists [" + resource.getFullyQualifiedName()
+ "] Re-run with '--overwrite' to continue.");
Expand All @@ -266,8 +266,8 @@ else if (BeanScope.DEPENDENT != scope)
{
javaClass.addAnnotation(scope.getAnnotation());
}
resource.setContents(javaClass);
pickup.fire(new PickupResource(resource));
java.saveJavaSource(javaClass);
pickup.fire(new PickupResource(java.getJavaResource(javaClass)));
}

@Command("new-qualifier")
Expand All @@ -278,7 +278,7 @@ public void newQualifier(
@Option(required = false, name = "inherited") final boolean inherited
) throws FileNotFoundException
{
if (!resource.createNewFile() && !overwrite)
if (resource.exists() && !overwrite)
{
throw new RuntimeException("Type already exists [" + resource.getFullyQualifiedName()
+ "] Re-run with '--overwrite' to continue.");
Expand All @@ -297,8 +297,8 @@ public void newQualifier(
qualifier.addAnnotation(Target.class).setEnumValue(METHOD, FIELD, PARAMETER, TYPE);
qualifier.addAnnotation(Documented.class);

resource.setContents(qualifier);
pickup.fire(new PickupResource(resource));
java.saveJavaSource(qualifier);
pickup.fire(new PickupResource(java.getJavaResource(qualifier)));
}

@Command("new-stereotype")
Expand All @@ -313,9 +313,9 @@ public void newStereotype(
help = "allow this stereotype to be used on any valid @Target element type (TYPE, METHOD, FIELD)",
description = "all @Target element types",
name = "all-targets") final boolean allTargets
)
) throws FileNotFoundException
{
if (!resource.createNewFile() && !overwrite)
if (resource.exists() && !overwrite)
{
throw new RuntimeException("Type already exists [" + resource.getFullyQualifiedName()
+ "] Re-run with '--overwrite' to continue.");
Expand Down Expand Up @@ -368,7 +368,7 @@ public void newStereotype(
stereotype.addAnnotation(Target.class).setEnumValue(targetTypes.toArray(new ElementType[targetTypes.size()]));
stereotype.addAnnotation(Documented.class);

resource.setContents(stereotype);
pickup.fire(new PickupResource(resource));
java.saveJavaSource(stereotype);
pickup.fire(new PickupResource(java.getJavaResource(stereotype)));
}
}

0 comments on commit c510cc9

Please sign in to comment.