Package org.jboss.forge.addon.projects

Examples of org.jboss.forge.addon.projects.Project


         targets.add(javaClass);
      }

      RestGenerationContext generationContext = createContextFor(uiContext);
      Set<JavaClassSource> endpoints = generateEndpoints(generationContext);
      Project project = generationContext.getProject();
      JavaSourceFacet javaSourceFacet = project.getFacet(JavaSourceFacet.class);
      List<JavaResource> selection = new ArrayList<>();

      for (JavaClassSource javaClass : endpoints)
      {
         selection.add(javaSourceFacet.saveJavaSource(javaClass));
View Full Code Here


   @Override
   @SuppressWarnings("unchecked")
   public boolean isSetup(ScaffoldSetupContext setupContext)
   {
      Project project = setupContext.getProject();
      String targetDir = setupContext.getTargetDirectory();
      targetDir = targetDir == null ? "" : targetDir;
      if (project.hasAllFacets(WebResourcesFacet.class, DependencyFacet.class, JPAFacet.class, EJBFacet.class,
               CDIFacet.class, RestFacet.class))
      {
         WebResourcesFacet web = project.getFacet(WebResourcesFacet.class);
         boolean areResourcesInstalled = web.getWebResource(targetDir + GLYPHICONS_SVG).exists()
                  && web.getWebResource(targetDir + GLYPHICONS_EOT).exists()
                  && web.getWebResource(targetDir + GLYPHICONS_SVG).exists()
                  && web.getWebResource(targetDir + GLYPHICONS_TTF).exists()
                  && web.getWebResource(targetDir + GLYPHICONS_WOFF).exists()
View Full Code Here

   }

   @Override
   public NavigationResult getSetupFlow(ScaffoldSetupContext setupContext)
   {
      Project project = setupContext.getProject();
      NavigationResultBuilder builder = NavigationResultBuilder.create();
      List<Class<? extends UICommand>> setupCommands = new ArrayList<>();
      if (!project.hasFacet(JPAFacet.class))
      {
         builder.add(JPASetupWizard.class);
      }
      if (!project.hasFacet(CDIFacet.class))
      {
         setupCommands.add(CDISetupCommand.class);
      }
      if (!project.hasFacet(EJBFacet.class))
      {
         setupCommands.add(EJBSetupWizard.class);
      }
      if (!project.hasFacet(ServletFacet.class))
      {
         // TODO: FORGE-1296. Ensure that this wizard only sets up Servlet 3.0+
         setupCommands.add(ServletSetupWizard.class);
      }
      if (!project.hasFacet(RestFacet.class))
      {
         setupCommands.add(RestSetupWizard.class);
      }

      if(setupCommands.size() >0)
View Full Code Here

      ResourceCollection resourceCollection = new ResourceCollection();
      if (targets.getValue() != null)
      {
         for (JavaClassSource klass : targets.getValue())
         {
            Project project = getSelectedProject(uiContext);
            JavaSourceFacet javaSource = project.getFacet(JavaSourceFacet.class);
            Resource<?> resource = javaSource.getJavaResource(klass);
            if (resource != null)
            {
               resourceCollection.addToCollection(resource);
            }
View Full Code Here

   @Override
   @SuppressWarnings({ "unchecked", "rawtypes" })
   public void initializeUI(final UIBuilder builder) throws Exception
   {
      UIContext uiContext = builder.getUIContext();
      Project project = getSelectedProject(uiContext);

      JPAFacet<PersistenceCommonDescriptor> persistenceFacet = project.getFacet(JPAFacet.class);
      targets.setValueChoices(persistenceFacet.getAllEntities());
      targets.setItemLabelConverter(new Converter<JavaClassSource, String>()
      {
         @Override
         public String convert(JavaClassSource source)
View Full Code Here

   public Result execute(UIExecutionContext context) throws Exception
   {
      for (JavaClassSource javaSource : targets.getValue())
      {
         UIContext uiContext = context.getUIContext();
         Project project = getSelectedProject(uiContext);
         JavaSourceFacet javaSourceFacet = project.getFacet(JavaSourceFacet.class);
         if (!javaSource.hasMethodSignature("hashCode"))
         {
            if (generateEqualsAndHashCode.getValue())
            {
               if (javaSource.getField("id") != null)
View Full Code Here

      if (template != null)
      {
         if (template.exists())
         {
            Map<Object, Object> attributeMap = context.getUIContext().getAttributeMap();
            Project project = (Project) attributeMap.get(Project.class);
            WebResourcesFacet web = project.getFacet(WebResourcesFacet.class);
            boolean isValidTemplate = false;
            for (DirectoryResource dir : web.getWebRootDirectories())
            {
               if (ResourceUtil.isChildOf(dir, template))
               {
View Full Code Here

   @Override
   public void initializeUI(UIBuilder builder) throws Exception
   {
      idStrategy.setDefaultValue(GenerationType.AUTO);
      Project project = getSelectedProject(builder.getUIContext());
      if (project == null)
      {
         UISelection<FileResource<?>> currentSelection = builder.getUIContext().getInitialSelection();
         if (!currentSelection.isEmpty())
         {
            FileResource<?> resource = currentSelection.get();
            if (resource instanceof DirectoryResource)
            {
               targetLocation.setDefaultValue((DirectoryResource) resource);
            }
            else
            {
               targetLocation.setDefaultValue(resource.getParent());
            }
         }
      }
      else if (project.hasFacet(JavaSourceFacet.class))
      {
         JavaSourceFacet facet = project.getFacet(JavaSourceFacet.class);
         targetLocation.setDefaultValue(facet.getSourceDirectory()).setEnabled(false);
         targetPackage.setValue(calculateModelPackage(project));
      }
      builder.add(targetLocation);
      builder.add(targetPackage).add(named).add(idStrategy).add(tableName);
View Full Code Here

      if (idStrategyChosen == null)
      {
         idStrategyChosen = GenerationType.AUTO;
      }
      DirectoryResource targetDir = targetLocation.getValue();
      Project project = getSelectedProject(context);
      JavaResource javaResource;
      if (project == null)
      {
         javaResource = persistenceOperations.newEntity(targetDir, entityName, entityPackage, idStrategyChosen,
                  tableName.getValue());
View Full Code Here

   @Override
   public NavigationResult getPrerequisiteCommands(UIContext context)
   {
      NavigationResultBuilder builder = NavigationResultBuilder.create();
      Project project = getSelectedProject(context);
      if (project != null)
      {
         if (!project.hasFacet(JPAFacet.class))
         {
            builder.add(JPASetupWizard.class);
         }
      }
      return builder.build();
View Full Code Here

TOP

Related Classes of org.jboss.forge.addon.projects.Project

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.