@@ -0,0 +1,2862 @@
+package org.buddha.forge.commands.ui;%0A%0Aimport org.jboss.forge.addon.dependencies.Coordinate;%0Aimport org.jboss.forge.addon.dependencies.DependencyQuery;%0Aimport org.jboss.forge.addon.dependencies.DependencyResolver;%0Aimport org.jboss.forge.addon.dependencies.builder.DependencyBuilder;%0Aimport org.jboss.forge.addon.dependencies.builder.DependencyQueryBuilder;%0Aimport org.jboss.forge.addon.dependencies.util.NonSnapshotDependencyFilter;%0Aimport org.jboss.forge.addon.projects.ProjectFactory;%0Aimport org.jboss.forge.addon.projects.dependencies.DependencyInstaller;%0Aimport org.jboss.forge.addon.projects.ui.AbstractProjectCommand;%0Aimport org.jboss.forge.addon.ui.context.UIBuilder;%0Aimport org.jboss.forge.addon.ui.context.UIContext;%0Aimport org.jboss.forge.addon.ui.context.UIExecutionContext;%0Aimport org.jboss.forge.addon.ui.input.UIInput;%0Aimport org.jboss.forge.addon.ui.input.UISelectOne;%0Aimport org.jboss.forge.addon.ui.metadata.UICommandMetadata;%0Aimport org.jboss.forge.addon.ui.metadata.WithAttributes;%0Aimport org.jboss.forge.addon.ui.util.Metadata;%0Aimport org.jboss.forge.addon.ui.util.Categories;%0Aimport org.jboss.forge.addon.ui.result.Result;%0Aimport org.jboss.forge.addon.ui.result.Results;%0A%0Aimport javax.inject.Inject;%0Aimport java.lang.Override;%0Aimport java.lang.Exception;%0Aimport java.util.List;%0A%0Apublic class AddJUnitDependencyCommand extends AbstractProjectCommand%0A%7B%0A   @Inject%0A   ProjectFactory projectFactory;%0A%0A   @Inject%0A   DependencyInstaller dependencyInstaller;%0A%0A   @Inject%0A   DependencyResolver dependencyResolver;%0A%0A   @Inject @WithAttributes(label = %22Version%22, required = true, description = %22Select the version of JUnit%22)%0A   private UISelectOne%3CCoordinate%3E version;%0A%0A   @Override%0A   public void initializeUI(UIBuilder builder) throws Exception %7B%0A%0A      DependencyQuery query = DependencyQueryBuilder%0A              .create(%22junit:junit%22)%0A              .setFilter(new NonSnapshotDependencyFilter());%0A%0A      List%3CCoordinate%3E coordinates = dependencyResolver.resolveVersions(query);%0A      version.setValueChoices(coordinates);%0A      builder.add(version);%0A   %7D%0A%0A   @Override%0A   public Result execute(UIExecutionContext context) throws Exception %7B%0A      DependencyBuilder builder = DependencyBuilder.create();%0A      builder.setCoordinate(version.getValue());%0A%0A      dependencyInstaller.install(getSelectedProject(context), builder);%0A%0A      return Results.success(%22Added Dependency to the selected project%22);%0A   %7D%0A%0A   @Override%0A   protected boolean isProjectRequired() %7B%0A      return true;%0A   %7D%0A%0A   @Override%0A   protected ProjectFactory getProjectFactory() %7B%0A      return projectFactory;%0A   %7D%0A%0A   @Override%0A   public UICommandMetadata getMetadata(UIContext context)%0A   %7B%0A      return Metadata.forCommand(AddJUnitDependencyCommand.class)%0A            .name(%22Add JUnit Dependency%22)%0A            .category(Categories.create(%22Play Ground%22, %22Project%22));%0A   %7D%0A%0A%0A%7D

Add Junit Dependency Command