Package org.jboss.forge.addon.ui.progress

Examples of org.jboss.forge.addon.ui.progress.UIProgressMonitor


   @Override
   public Result execute() throws Exception
   {
      assertInitialized();
      assertValid();
      UIProgressMonitor progressMonitor = runtime.createProgressMonitor(context);
      UIPrompt prompt = runtime.createPrompt(context);
      UIExecutionContextImpl executionContext = new UIExecutionContextImpl(context, progressMonitor, prompt);
      Set<CommandExecutionListener> listeners = new LinkedHashSet<>();
      listeners.addAll(context.getListeners());
      for (CommandExecutionListener listener : addonRegistry
               .getServices(CommandExecutionListener.class))
      {
         listeners.add(listener);
      }
      List<Result> results = new LinkedList<>();
      try
      {
         firePreWizardExecuted(executionContext, listeners);
         for (WizardStepEntry entry : flow)
         {
            CommandController controller = entry.controller;
            if (progressMonitor.isCancelled())
            {
               break;
            }
            UICommand command = controller.getCommand();
            try
View Full Code Here


   @Override
   public Result execute() throws Exception
   {
      assertInitialized();
      assertValid();
      UIProgressMonitor progressMonitor = runtime.createProgressMonitor(context);
      UIPrompt prompt = runtime.createPrompt(context);
      UIExecutionContextImpl executionContext = new UIExecutionContextImpl(context, progressMonitor, prompt);
      if (progressMonitor.isCancelled())
      {
         return null;
      }

      Set<CommandExecutionListener> listeners = new LinkedHashSet<>();
View Full Code Here

   public Result execute(UIExecutionContext context) throws Exception
   {
      // TODO: Option to save sources?
      File tempDir = OperatingSystemUtils.createTempDir();
      DirectoryResource projectRoot = resourceFactory.create(DirectoryResource.class, tempDir);
      UIProgressMonitor progressMonitor = context.getProgressMonitor();
      UIOutput output = context.getUIContext().getProvider().getOutput();
      progressMonitor.beginTask("Installing Addon from Git", 4);

      progressMonitor.subTask("Cloning repository in " + tempDir);

      // Clone repository
      cloneTo(projectRoot);

      progressMonitor.worked(1);
      progressMonitor.subTask("Installing project into local repository");
      // Build project
      Project project = projectFactory.findProject(projectRoot);
      if (project == null)
      {
         return Results.fail("No project found in root " + projectRoot.getFullyQualifiedName());
      }
      Coordinate buildCoordinate = project.getFacet(MetadataFacet.class).getOutputDependency().getCoordinate();
      try
      {
         updateFurnaceVersion(project);
         project.getFacet(PackagingFacet.class).createBuilder().addArguments("clean", "install")
                  .runTests(false)
                  .build(output.out(), output.err());
      }
      catch (BuildException e)
      {
         return Results.fail("Unable to execute project build", e);
      }
      progressMonitor.worked(1);
      AddonId id = null;
      try
      {
         if (coordinate.hasValue())
         {
            try
            {
               id = AddonId.fromCoordinates(coordinate.getValue());
            }
            catch (IllegalArgumentException e)
            {
               id = AddonId.from(coordinate.getValue(), buildCoordinate.getVersion());
            }
         }
         else
         {
            id = AddonId.from(buildCoordinate.getGroupId() + ":" + buildCoordinate.getArtifactId(),
                     buildCoordinate.getVersion());
         }
         progressMonitor.subTask("Removing previous addon installation (" + id + ")");
         RemoveRequest removeRequest = addonManager.remove(id);
         removeRequest.perform();
         Addons.waitUntilStopped(registry.getAddon(id));
         progressMonitor.worked(1);

         progressMonitor.subTask("Installing addon (" + id + ")");
         InstallRequest installRequest = addonManager.install(id);
         installRequest.perform();
         progressMonitor.done();
         return Results.success("Addon " + id + " was installed successfully.");
      }
      catch (Throwable t)
      {
         return Results.fail("Addon " + id + " could not be installed: " + t.getMessage(), t);
View Full Code Here

   @Override
   public Result execute() throws Exception
   {
      assertInitialized();
      UIProgressMonitor progressMonitor = runtime.createProgressMonitor(context);
      UIPrompt prompt = runtime.createPrompt(context);
      UIExecutionContextImpl executionContext = new UIExecutionContextImpl(context, progressMonitor, prompt);
      Set<CommandExecutionListener> listeners = new LinkedHashSet<>();
      listeners.addAll(context.getListeners());
      for (CommandExecutionListener listener : addonRegistry
               .getServices(CommandExecutionListener.class))
      {
         listeners.add(listener);
      }
      assertValid();
      List<Result> results = new LinkedList<>();
      for (WizardStepEntry entry : flow)
      {
         CommandController controller = entry.controller;
         if (progressMonitor.isCancelled())
         {
            break;
         }
         UICommand command = controller.getCommand();
         try
View Full Code Here

   @Override
   public Result execute() throws Exception
   {
      assertInitialized();
      assertValid();
      UIProgressMonitor progressMonitor = runtime.createProgressMonitor(context);
      UIPrompt prompt = runtime.createPrompt(context);
      UIExecutionContextImpl executionContext = new UIExecutionContextImpl(context, progressMonitor, prompt);
      if (progressMonitor.isCancelled())
      {
         return null;
      }

      Set<CommandExecutionListener> listeners = new LinkedHashSet<>();
View Full Code Here

   @Override
   public Result execute() throws Exception
   {
      assertInitialized();
      assertValid();
      UIProgressMonitor progressMonitor = runtime.createProgressMonitor(context);
      UIPrompt prompt = runtime.createPrompt(context);
      UIExecutionContextImpl executionContext = new UIExecutionContextImpl(context, progressMonitor, prompt);
      if (progressMonitor.isCancelled())
      {
         return null;
      }

      Set<CommandExecutionListener> listeners = new LinkedHashSet<>();
View Full Code Here

   public Result execute(UIExecutionContext context) throws Exception
   {
      // TODO: Option to save sources?
      File tempDir = OperatingSystemUtils.createTempDir();
      DirectoryResource projectRoot = resourceFactory.create(DirectoryResource.class, tempDir);
      UIProgressMonitor progressMonitor = context.getProgressMonitor();
      UIOutput output = context.getUIContext().getProvider().getOutput();
      progressMonitor.beginTask("Installing Addon from Git", 4);

      progressMonitor.subTask("Cloning repository in " + tempDir);

      // Clone repository
      cloneTo(projectRoot);

      progressMonitor.worked(1);
      progressMonitor.subTask("Installing project into local repository");
      // Build project
      Project project = projectFactory.findProject(projectRoot);
      if (project == null)
      {
         return Results.fail("No project found in root " + projectRoot.getFullyQualifiedName());
      }
      Coordinate buildCoordinate = project.getFacet(MetadataFacet.class).getOutputDependency().getCoordinate();
      try
      {
         project.getFacet(PackagingFacet.class).createBuilder()
                  .addArguments("clean", "install", "-Dversion.furnace=" + furnace.getVersion())
                  .runTests(false)
                  .build(output.out(), output.err());
      }
      catch (BuildException e)
      {
         return Results.fail("Unable to execute project build", e);
      }
      progressMonitor.worked(1);
      AddonId id = null;
      try
      {
         if (coordinate.hasValue())
         {
            try
            {
               id = AddonId.fromCoordinates(coordinate.getValue());
            }
            catch (IllegalArgumentException e)
            {
               id = AddonId.from(coordinate.getValue(), buildCoordinate.getVersion());
            }
         }
         else
         {
            id = AddonId.from(buildCoordinate.getGroupId() + ":" + buildCoordinate.getArtifactId(),
                     buildCoordinate.getVersion());
         }
         progressMonitor.subTask("Removing previous addon installation (" + id + ")");
         RemoveRequest removeRequest = addonManager.remove(id);
         removeRequest.perform();
         Addons.waitUntilStopped(registry.getAddon(id));
         progressMonitor.worked(1);

         progressMonitor.subTask("Installing addon (" + id + ")");
         InstallRequest installRequest = addonManager.install(id);
         installRequest.perform();
         progressMonitor.done();
         return Results.success("Addon " + id + " was installed successfully.");
      }
      catch (Throwable t)
      {
         return Results.fail("Addon " + id + " could not be installed: " + t.getMessage(), t);
View Full Code Here

   public Result execute(UIExecutionContext context) throws Exception
   {
      // TODO: Option to save sources?
      File tempDir = OperatingSystemUtils.createTempDir();
      DirectoryResource projectRoot = resourceFactory.create(DirectoryResource.class, tempDir);
      UIProgressMonitor progressMonitor = context.getProgressMonitor();
      UIOutput output = context.getUIContext().getProvider().getOutput();
      progressMonitor.beginTask("Installing Addon from Git", 4);

      progressMonitor.subTask("Cloning repository in " + tempDir);

      // Clone repository
      cloneTo(projectRoot);

      progressMonitor.worked(1);
      progressMonitor.subTask("Installing project into local repository");
      // Build project
      Project project = projectFactory.findProject(projectRoot);
      if (project == null)
      {
         return Results.fail("No project found in root " + projectRoot.getFullyQualifiedName());
      }
      Coordinate buildCoordinate = project.getFacet(MetadataFacet.class).getOutputDependency().getCoordinate();
      try
      {
         project.getFacet(PackagingFacet.class).createBuilder().addArguments("clean", "install").runTests(false)
                  .build(output.out(), output.err());
      }
      catch (BuildException e)
      {
         return Results.fail("Unable to execute project build", e);
      }
      progressMonitor.worked(1);
      AddonId id = null;
      try
      {
         if (coordinate.hasValue())
         {
            try
            {
               id = AddonId.fromCoordinates(coordinate.getValue());
            }
            catch (IllegalArgumentException e)
            {
               id = AddonId.from(coordinate.getValue(), buildCoordinate.getVersion());
            }
         }
         else
         {
            id = AddonId.from(buildCoordinate.getGroupId() + ":" + buildCoordinate.getArtifactId(),
                     buildCoordinate.getVersion());
         }
         progressMonitor.subTask("Removing previous addon installation (" + id + ")");
         RemoveRequest removeRequest = addonManager.remove(id);
         removeRequest.perform();
         Addons.waitUntilStopped(registry.getAddon(id));
         progressMonitor.worked(1);

         progressMonitor.subTask("Installing addon (" + id + ")");
         InstallRequest installRequest = addonManager.install(id);
         installRequest.perform();
         progressMonitor.done();
         return Results.success("Addon " + id + " was installed successfully.");
      }
      catch (Throwable t)
      {
         return Results.fail("Addon " + id + " could not be installed: " + t.getMessage(), t);
View Full Code Here

   @Override
   public Result execute() throws Exception
   {
      assertInitialized();
      assertValid();
      UIProgressMonitor progressMonitor = runtime.createProgressMonitor(context);
      UIPrompt prompt = runtime.createPrompt(context);
      UIExecutionContextImpl executionContext = new UIExecutionContextImpl(context, progressMonitor, prompt);
      Set<CommandExecutionListener> listeners = new LinkedHashSet<>();
      listeners.addAll(context.getListeners());
      for (CommandExecutionListener listener : addonRegistry
               .getServices(CommandExecutionListener.class))
      {
         listeners.add(listener);
      }
      List<Result> results = new LinkedList<>();
      try
      {
         firePreWizardExecuted(executionContext, listeners);
         for (WizardStepEntry entry : flow)
         {
            CommandController controller = entry.controller;
            if (progressMonitor.isCancelled())
            {
               break;
            }
            UICommand command = controller.getCommand();
            try
View Full Code Here

   @Override
   public Result execute() throws Exception
   {
      assertInitialized();
      assertValid();
      UIProgressMonitor progressMonitor = runtime.createProgressMonitor(context);
      UIPrompt prompt = runtime.createPrompt(context);
      UIExecutionContextImpl executionContext = new UIExecutionContextImpl(context, progressMonitor, prompt);
      Set<CommandExecutionListener> listeners = new LinkedHashSet<>();
      listeners.addAll(context.getListeners());
      for (CommandExecutionListener listener : addonRegistry
               .getServices(CommandExecutionListener.class))
      {
         listeners.add(listener);
      }
      List<Result> results = new LinkedList<>();
      try
      {
         firePreWizardExecuted(executionContext, listeners);
         for (WizardStepEntry entry : flow)
         {
            CommandController controller = entry.controller;
            if (progressMonitor.isCancelled())
            {
               break;
            }
            UICommand command = controller.getCommand();
            try
View Full Code Here

TOP

Related Classes of org.jboss.forge.addon.ui.progress.UIProgressMonitor

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.