Skip to content
Permalink
Browse files
[JENKINS-31162] Category configuration reviewed
  • Loading branch information
recena committed Mar 14, 2016
1 parent 21472ba commit 0b0b21d4d6f2e2e1c41680b7e0f6b9d84f9c86dc
Showing 3 changed files with 15 additions and 15 deletions.
@@ -17,14 +17,14 @@ public abstract class ItemCategory implements ModelObject, ExtensionPoint {
public static int MIN_TOSHOW = 1;

/**
* Identifier, e.g. "category-id-default", etc.
* Identifier, e.g. "category-id-basicprojects", etc.
*
* @return the identifier
*/
public abstract String getId();

/**
* The icon class specification e.g. 'category-icon-folder', 'category-icon-default', etc.
* The icon class specification e.g. 'category-icon-folder', 'category-icon-basicprojects', etc.
*
* @return the icon class specification
*/
@@ -55,26 +55,26 @@ public abstract class ItemCategory implements ModelObject, ExtensionPoint {
* The default {@link ItemCategory}, if an item doesn't belong anywhere else, this is where it goes by default.
*/
@Extension
public static final class Default extends ItemCategory {
public static final class BasicProjects extends ItemCategory {

@Override
public String getId() {
return "category-id-default";
return "category-id-basicprojects";
}

@Override
public String getIconClassName() {
return "category-icon-default";
return "category-icon-basicprojects";
}

@Override
public String getDescription() {
return Messages.ItemCategory_Default_Description();
return Messages.ItemCategory_BasicProjects_Description();
}

@Override
public String getDisplayName() {
return Messages.ItemCategory_Default_DisplayName();
return Messages.ItemCategory_BasicProjects_DisplayName();
}

@Override
@@ -28,7 +28,7 @@ public abstract class ItemCategoryConfigurator implements ExtensionPoint {

/**
* Finds the category specified by the first configurator.
* If none can be found {@link ItemCategory.Default} is returned.
* If none can be found {@link ItemCategory.BasicProjects} is returned.
*
* @param descriptor the item to categorize.
*
@@ -42,7 +42,7 @@ public static ItemCategory getCategory(@Nonnull TopLevelItemDescriptor descripto
return category;
}
}
throw new IllegalStateException("At least, must exist the category: " + ItemCategory.Default.class);
throw new IllegalStateException("At least, must exist the category: " + ItemCategory.BasicProjects.class);
}

/**
@@ -71,7 +71,7 @@ public static Integer getWeight(@Nonnull TopLevelItemDescriptor descriptor) {
return weight;
}
}
throw new IllegalStateException("At least, a default value must exist");
throw new IllegalStateException("At least, a default value must exist for weight field");
}

/**
@@ -100,23 +100,23 @@ public static String getDescription(@Nonnull TopLevelItemDescriptor descriptor)
return description;
}
}
throw new IllegalStateException("At least, a default value must exist");
throw new IllegalStateException("At least, a default value must exist for description field");
}

public static Collection<ItemCategoryConfigurator> all() {
return ExtensionList.lookup(ItemCategoryConfigurator.class);
}

/**
* Default configurator with the lowest ordinal that simply returns {@link ItemCategory.Default}.
* Default configurator with the lowest ordinal that simply returns {@link ItemCategory.BasicProjects}.
*/
@Extension(ordinal = Integer.MIN_VALUE)
public static final class DefaultConfigurator extends ItemCategoryConfigurator {

@Nonnull
@Override
public ItemCategory getCategoryFor(@Nonnull TopLevelItemDescriptor descriptor) {
return ExtensionList.lookup(ItemCategory.Default.class).iterator().next();
return ExtensionList.lookup(ItemCategory.BasicProjects.class).iterator().next();
}

@Nonnull
@@ -72,5 +72,5 @@ BlockedBecauseOfBuildInProgress.shortDescription=Build #{0} is already in progre
BlockedBecauseOfBuildInProgress.ETA=\ (ETA:{0})
BuildDiscarderProperty.displayName=Discard Old Builds

ItemCategory.Default.DisplayName=Default/Unsorted
ItemCategory.Default.Description=Description
ItemCategory.BasicProjects.DisplayName=Basic Projects
ItemCategory.BasicProjects.Description=Create projects with a unique configuration and history. These projects can be standalone or grouped within Nested Projects.

0 comments on commit 0b0b21d

Please sign in to comment.