private ScopeType promptForScope(Dependency dep) { boolean answer = prompt.promptBoolean("Should the dependency be packaged with your application (not provided by the server)?", false); return answer ? ScopeType.COMPILE : ScopeType.PROVIDED; } }
private void installMetaModelGenerator() { if (!project.hasFacet(PersistenceMetaModelFacet.class) && prompt.promptBoolean("Do you want to install a JPA 2 metamodel generator?", false)) { request.fire(new InstallFacets(PersistenceMetaModelFacet.class)); } }
public static Resource<?> createOrOverwrite(final ShellPrompt prompt, final FileResource<?> resource, final String contents, final boolean overwrite) { if (!resource.exists() || overwrite || prompt.promptBoolean("[" + resource.getFullyQualifiedName() + "] File exists, overwrite?")) { resource.createNewFile(); resource.setContents(contents); return resource; } return null; }
((FileResource<?>) target).setContents(output.toString()); else if (prompt.promptBoolean("File exists. Overwrite with blank view?"))
/** * Registers the nested DTO created for a JPA entity * * @param entity The JPA entity * @param nestedDTO The nested DTO created for the JPA entity */ public void addNestedDTO(JavaClass entity, JavaClass nestedDTO) { JavaSourceFacet java = this.project.getFacet(JavaSourceFacet.class); DTOPair dtoPair = dtos.containsKey(entity) ? dtos.get(entity) : new DTOPair(); if (nestedDTO != null) { try { if (!java.getJavaResource(nestedDTO).exists() || prompt.promptBoolean("DTO [" + nestedDTO.getQualifiedName() + "] already, exists. Overwrite?")) { dtoPair.nestedDTO = java.saveJavaSource(nestedDTO); } } catch (FileNotFoundException fileEx) { throw new RuntimeException(fileEx); } } dtos.put(entity, dtoPair); }
public static Resource<?> createOrOverwrite(final ShellPrompt prompt, final FileResource<?> resource, final InputStream contents, final boolean overwrite) { if (!resource.exists() || overwrite || prompt.promptBoolean("[" + resource.getFullyQualifiedName() + "] File exists, overwrite?")) { resource.createNewFile(); resource.setContents(contents); return resource; } return null; }
/** * Registers the root DTO created for a JPA entity * * @param entity The JPA entity * @param rootDTO The root DTO created for the JPA entity */ public void addRootDTO(JavaClass entity, JavaClass rootDTO) { JavaSourceFacet java = this.project.getFacet(JavaSourceFacet.class); DTOPair dtoPair = dtos.containsKey(entity) ? dtos.get(entity) : new DTOPair(); if (rootDTO != null) { try { if (!java.getJavaResource(rootDTO).exists() || prompt.promptBoolean("DTO [" + rootDTO.getQualifiedName() + "] already, exists. Overwrite?")) { dtoPair.rootDTO = java.saveJavaSource(rootDTO); } } catch (FileNotFoundException fileEx) { throw new RuntimeException(fileEx); } } dtos.put(entity, dtoPair); }
public static Resource<?> createOrOverwrite(final ShellPrompt prompt, final FileResource<?> resource, final InputStream contents, final boolean overwrite) { if (!resource.exists() || overwrite || prompt.promptBoolean("[" + resource.getFullyQualifiedName() + "] File exists, overwrite?")) { resource.createNewFile(); resource.setContents(contents); return resource; } return null; }
public static Resource<?> createOrOverwrite(final ShellPrompt prompt, final FileResource<?> resource, final String contents, final boolean overwrite) { if (!resource.exists() || overwrite || prompt.promptBoolean("[" + resource.getFullyQualifiedName() + "] File exists, overwrite?")) { resource.createNewFile(); resource.setContents(contents); return resource; } return null; }
protected Node removeConflictingErrorPages(final ServletFacet servlet) { Node webXML = XMLParser.parse(servlet.getConfigFile().getResourceInputStream()); Node root = webXML.getRoot(); List<Node> errorPages = root.get("error-page"); for (String code : Arrays.asList("404", "500")) { for (Node errorPage : errorPages) { if (code.equals(errorPage.getSingle("error-code").getText()) && this.prompt.promptBoolean("Your web.xml already contains an error page for " + code + " status codes, replace it?")) { root.removeChild(errorPage); } } } return webXML; }
if (!project.hasFacet(CDIFacet.class)) if (prompt.promptBoolean("Do you also want to install CDI?", true)) int majorVersion = Integer.parseInt(servletVersion.split("[.]")[0]); if (majorVersion < 3 || prompt.promptBoolean("Do you also want to install the Faces servlet and mapping?", false))
&& prompt.promptBoolean("The JPA provider [" + jpap + "], also supplies extended APIs. Install these as well?", false))
if (prompt.promptBoolean("Your annotation has syntax errors, create anyway?", true))
if (prompt.promptBoolean( "Your class has syntax errors, create anyway?", true))
|| prompt.promptBoolean("Endpoint [" + resource.getQualifiedName() + "] already, exists. Overwrite?"))
if (prompt.promptBoolean("Your class has syntax errors, create anyway?", true))
if (prompt.promptBoolean("Your enum has syntax errors, create anyway?", true))
if (prompt.promptBoolean("Would you install " + providerType.getName() + " additional dependencies?", false)) { installDependencies(provider.getAdditionalDependencies());
shell.print("This Forge installation will be updated to "); shell.println(ShellColor.BOLD, forgeDistribution.getVersion()); if (prompt.promptBoolean("Is that ok ?", true))