Skip to content

Commit

Permalink
Displaying addons to install and remove in alphabetical order
Browse files Browse the repository at this point in the history
  • Loading branch information
gastaldi committed Jun 24, 2013
1 parent 02ad1a8 commit 5b080b1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package org.jboss.forge.addon.manager.impl.commands;

import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import java.util.TreeSet;

import javax.inject.Inject;

Expand Down Expand Up @@ -53,7 +53,7 @@ public Metadata getMetadata()
@Override
public void initializeUI(UIBuilder builder) throws Exception
{
Set<AddonId> choices = new HashSet<AddonId>();
Set<AddonId> choices = new TreeSet<AddonId>();
for (AddonRepository repository : forge.getRepositories())
{
// Avoid immutable repositories
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
package org.jboss.forge.addon.addons;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;

import javax.inject.Inject;

Expand Down Expand Up @@ -40,10 +40,10 @@

/**
* Called when the Next button is pressed and the {@link ForgeAddonProjectType} is selected in NewProjectWizard
*
*
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
* @author <a href="mailto:ggastald@redhat.com">George Gastaldi</a>
*
*
*/
public class ForgeAddonSetupStep implements UIWizardStep
{
Expand Down Expand Up @@ -99,7 +99,7 @@ private void configureSplitProjects()

private void configureAddonDependencies()
{
Set<AddonId> choices = new HashSet<AddonId>();
Set<AddonId> choices = new TreeSet<AddonId>();
for (AddonRepository repository : forge.getRepositories())
{
for (AddonId id : repository.listEnabled())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.jboss.forge.furnace.versions.SingleVersion;
import org.jboss.forge.furnace.versions.Version;

public class AddonId
public class AddonId implements Comparable<AddonId>
{
private String name;
private Version apiVersion;
Expand Down Expand Up @@ -128,4 +128,13 @@ else if (!version.equals(other.getVersion()))
return true;
}

@Override
public int compareTo(AddonId o)
{
if (o == null)
{
return -1;
}
return toCoordinates().compareTo(o.toCoordinates());
}
}

0 comments on commit 5b080b1

Please sign in to comment.