Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2000, 2010 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html Contributors: IBM Corporation - initial API and implementation /
 
 package org.eclipse.equinox.internal.p2.updatesite;
 
 import java.net.URL;
 import java.util.*;

A category in an update site. Based on org.eclipse.update.core.model.CategoryModel.
 
 public class SiteCategory {
 
 	private static Comparator<SiteCategorycomp;
 	private String description;
 	private String label;
 	private String name;
 	private Map<LocaleMap<StringString>> localizations;

Returns a comparator for category models.

Returns:
comparator
Since:
2.0
 
 	public static Comparator<SiteCategorygetComparator() {
 		if ( == null) {
 			 = new Comparator<SiteCategory>() {
 				/*
 				 * @see Comparator#compare(Object,Object)
 				 * Returns 0 if versions are equal.
 				 * Returns -1 if object1 is after than object2.
 				 * Returns +1 if object1 is before than object2.
 				 */
 				public int compare(SiteCategory cat1SiteCategory cat2) {
 
 					if (cat1.equals(cat2))
 						return 0;
 					return cat1.getName().compareTo(cat2.getName());
 				}
 			};
 		}
 		return ;
 	}

Creates an uninitialized model object.

Since:
2.0
 
 	public SiteCategory() {
 		super();
 	}

Compare two category models for equality.

 
 	public boolean equals(Object obj) {
 		boolean result = false;
 		if (obj instanceof SiteCategory) {
 			SiteCategory otherCategory = (SiteCategoryobj;
 			result = getName().equalsIgnoreCase(otherCategory.getName());
 		}
 		return result;
 	}

Retrieve the detailed category description

Returns:
category description, or null.
Since:
2.0
 
 	public String getDescription() {
 		return ;
 	}

Retrieve the non-localized displayable label for the category.

Returns:
non-localized displayable label, or null.
Since:
2.0
 
 	public String getLabel() {
 		return ;
 	}

Gets the localizations for the site as a map from locale to the set of translated properties for that locale.

Returns:
a map from locale to property set
Since:
3.4
		return this.;
	}

Retrieve the name of the category.

Returns:
category name, or null.
Since:
2.0
	public String getName() {
		return ;
	}

Compute hash code for category model.

Since:
2.0
See also:
java.lang.Object.hashCode()
	public int hashCode() {
		return getName().hashCode();
	}

Resolve the model object. Any URL strings in the model are resolved relative to the base URL argument. Any translatable strings in the model that are specified as translation keys are localized using the supplied resource bundle.

Parameters:
base URL
bundleURL resource bundle URL
Throws:
java.net.MalformedURLException
Since:
2.0
	public void resolve(URL baseURL bundleURLthrows MalformedURLException {
		// resolve local elements
		//		localizedLabel = resolveNLString(bundleURL, label);
		// delegate to references
		//		resolveReference(getDescriptionModel(), base, bundleURL);
	}

Sets the category description. Throws a runtime exception if this object is marked read-only.

Parameters:
description category description
Since:
2.0
	public void setDescription(String description) {
		this. = description;
	}

Sets the category displayable label. Throws a runtime exception if this object is marked read-only.

Parameters:
label displayable label, or resource key
Since:
2.0
	public void setLabel(String label) {
		this. = label;
	}

Sets the localizations for the site as a map from locale to the set of translated properties for that locale.

Parameters:
localizations as a map from locale to property set
Since:
3.4
	public void setLocalizations(Map<LocaleMap<StringString>> localizations) {
		this. = localizations;
	}

Sets the category name. Throws a runtime exception if this object is marked read-only.

Parameters:
name category name
Since:
2.0
	public void setName(String name) {
		this. = name;
	}
New to GrepCode? Check out our FAQ X