Package org.jboss.forge.addon.scaffold.spi

Examples of org.jboss.forge.addon.scaffold.spi.ScaffoldProvider


   @Override
   public Result execute(UIExecutionContext context) throws Exception
   {
      Map<Object, Object> attributeMap = context.getUIContext().getAttributeMap();
      ScaffoldProvider selectedProvider = (ScaffoldProvider) attributeMap.get(ScaffoldProvider.class);
      ResourceCollection resourceCollection = (ResourceCollection) attributeMap.get(ResourceCollection.class);
      selectedProvider.generateFrom(getSelectedProject(context),
               populateGenerationContext(context.getUIContext(), resourceCollection.getResources()));
      return Results.success("Scaffold was generated successfully.");
   }
View Full Code Here


   @Override
   public Result execute(UIExecutionContext context) throws Exception
   {
      Map<Object, Object> attributeMap = context.getUIContext().getAttributeMap();

      ScaffoldProvider selectedProvider = (ScaffoldProvider) attributeMap.get(ScaffoldProvider.class);
      ScaffoldSetupContext setupContext = (ScaffoldSetupContext) attributeMap.get(ScaffoldSetupContext.class);
      selectedProvider.setup(getSelectedProject(context), setupContext);
      // No-op. Scaffold setup is done in a separate step.
      return Results.success("Scaffold was setup successfully.");
   }
View Full Code Here

   public NavigationResult next(UINavigationContext context) throws Exception
   {
      UIContext uiContext = context.getUIContext();
      Map<Object, Object> attributeMap = uiContext.getAttributeMap();

      ScaffoldProvider selectedProvider = provider.getValue();
      ScaffoldSetupContext setupContext = createSetupContext(uiContext);
      attributeMap.put(ScaffoldProvider.class, selectedProvider);
      attributeMap.put(ScaffoldSetupContext.class, setupContext);

      // Get the navigation result entries from the selected scaffold provider
      NavigationResult setupFlow = selectedProvider.getSetupFlow(setupContext);

      // Add the execution logic step in the end so that the scaffold setup step is executed last after all other steps
      NavigationResultBuilder builder = NavigationResultBuilder.create(setupFlow);
      NavigationResult navigationResult = builder.add(ScaffoldExecuteSetupStep.class).build();
View Full Code Here

   @Override
   public Result execute(UIExecutionContext context) throws Exception
   {
      Map<Object, Object> attributeMap = context.getUIContext().getAttributeMap();
      ScaffoldProvider selectedProvider = (ScaffoldProvider) attributeMap.get(ScaffoldProvider.class);
      Object requiresScaffoldSetup = attributeMap.get(ScaffoldGenerateCommandImpl.REQUIRES_SCAFFOLD_SETUP);
      if(requiresScaffoldSetup != null && (boolean) requiresScaffoldSetup == true)
      {
          ScaffoldSetupContext setupContext = (ScaffoldSetupContext) attributeMap.get(ScaffoldSetupContext.class);
          selectedProvider.setup(setupContext);
      }
      ResourceCollection resourceCollection = (ResourceCollection) attributeMap.get(ResourceCollection.class);
      // Ensure that the resource collection is instantiated. Prevents a null check in the scaffold provider.
      Collection<Resource<?>> resources = resourceCollection != null ? resourceCollection.getResources()
               : Collections.EMPTY_SET;
      selectedProvider.generateFrom(populateGenerationContext(context.getUIContext(), resources));
      return Results.success("Scaffold was generated successfully.");
   }
View Full Code Here

   }

   @Override
   public NavigationResult next(UINavigationContext context) throws Exception
   {
      ScaffoldProvider selectedProvider = provider.getValue();
      UIContext uiContext = context.getUIContext();
      Map<Object, Object> attributeMap = uiContext.getAttributeMap();

      attributeMap.put(ScaffoldProvider.class, selectedProvider);
      ScaffoldGenerationContext generationContext = populateGenerationContext(uiContext);
      attributeMap.put(ScaffoldGenerationContext.class, generationContext);

      NavigationResult setupFlow = null;
      Project project = getSelectedProject(uiContext);

      // Verify if the selected provider is installed
      // If not, add the setup flow and inform the generation step to setup the scaffold.
      ScaffoldSetupContext setupContext = populateSetupContext(uiContext);
      if (!selectedProvider.isSetup(setupContext))
      {
         setupFlow = selectedProvider.getSetupFlow(setupContext);
         attributeMap.put(REQUIRES_SCAFFOLD_SETUP, true);
         attributeMap.put(ScaffoldSetupContext.class, setupContext);
      }

      // Get the step sequence from the selected scaffold provider
      NavigationResult generationFlow = selectedProvider.getGenerationFlow(generationContext);

      // Add the execution logic step in the end so that the scaffold generation step is executed last after all other
      // steps
      NavigationResultBuilder builder = NavigationResultBuilder.create(setupFlow);
      NavigationResult navigationResult = builder.add(generationFlow).add(ScaffoldExecuteGenerationStep.class).build();
View Full Code Here

   @Override
   public Result execute(UIExecutionContext context) throws Exception
   {
      Map<Object, Object> attributeMap = context.getUIContext().getAttributeMap();

      ScaffoldProvider selectedProvider = (ScaffoldProvider) attributeMap.get(ScaffoldProvider.class);
      ScaffoldSetupContext setupContext = (ScaffoldSetupContext) attributeMap.get(ScaffoldSetupContext.class);
      Project project = getSelectedProject(context);
      // FIXME: FORGE-1979: Happens because Facets are not refreshed inside a Project instance
      setupContext = new ScaffoldSetupContext(setupContext.getTargetDirectory(), project);
      selectedProvider.setup(setupContext);
      // No-op. Scaffold setup is done in a separate step.
      return Results.success("Scaffold was setup successfully.");
   }
View Full Code Here

   }

   @Override
   public Result execute(UIExecutionContext context) throws Exception
   {
      ScaffoldProvider selectedProvider = (ScaffoldProvider) context.getUIContext().getAttribute(ScaffoldProvider.class);
      ResourceCollection resourceCollection = (ResourceCollection) context.getUIContext().getAttribute(ResourceCollection.class);
      selectedProvider.generateFrom(getSelectedProject(context), populateGenerationContext(context.getUIContext(), resourceCollection.getResources()));
      return Results.success("Scaffold was generated successfully.");
   }
View Full Code Here

   }

   @Override
   public Result execute(UIExecutionContext context) throws Exception
   {
      ScaffoldProvider selectedProvider = (ScaffoldProvider) context.getUIContext()
               .getAttribute(ScaffoldProvider.class);
      ScaffoldSetupContext setupContext = (ScaffoldSetupContext) context.getUIContext().getAttribute(
               ScaffoldSetupContext.class);
      selectedProvider.setup(getSelectedProject(context), setupContext);
      // No-op. Scaffold setup is done in a separate step.
      return Results.success("Scaffold was setup successfully.");
   }
View Full Code Here

      overwrite.setEnabled(new Callable<Boolean>()
      {
         @Override
         public Boolean call() throws Exception
         {
            ScaffoldProvider selectedProvider = provider.getValue();
            return selectedProvider != null;
         }
      });
     
      provider.setDefaultValue(scaffoldProviders.get());
View Full Code Here

   }

   @Override
   public NavigationResult next(UINavigationContext context) throws Exception
   {
      ScaffoldProvider selectedProvider = provider.getValue();
      Project project = getSelectedProject(context);
      ((AbstractFacet) selectedProvider).setFaceted(project);
      UIContext uiContext = context.getUIContext();
      uiContext.setAttribute(ScaffoldProvider.class, selectedProvider);
      uiContext.setAttribute(ScaffoldSetupContext.class, createSetupContext());
     
      // Get the step sequence from the selected scaffold provider
      List<Class<? extends UICommand>> setupFlow = selectedProvider.getSetupFlow();
     
      // Add the execution logic step in the end so that the scaffold setup step is executed last after all other
      // steps
      setupFlow.add(ExecuteSetupStep.class);
View Full Code Here

TOP

Related Classes of org.jboss.forge.addon.scaffold.spi.ScaffoldProvider

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.