Search in sources :

Example 1 with ResourceKindAndNameComparator

use of org.jboss.tools.openshift.internal.core.util.ResourceKindAndNameComparator in project jbosstools-openshift by jbosstools.

the class ResourceDetailsContentProvider method getElements.

@SuppressWarnings("unchecked")
@Override
public Object[] getElements(Object rootElements) {
    if (!(rootElements instanceof Collection)) {
        return new Object[] {};
    }
    List<IResource> resources = new ArrayList<>((Collection<IResource>) rootElements);
    Collections.sort(resources, new ResourceKindAndNameComparator());
    return resources.toArray();
}
Also used : ResourceKindAndNameComparator(org.jboss.tools.openshift.internal.core.util.ResourceKindAndNameComparator) ArrayList(java.util.ArrayList) Collection(java.util.Collection) IResource(com.openshift.restclient.model.IResource)

Aggregations

IResource (com.openshift.restclient.model.IResource)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 ResourceKindAndNameComparator (org.jboss.tools.openshift.internal.core.util.ResourceKindAndNameComparator)1