Search in sources :

Example 1 with IReplicationControllerWrapper

use of org.jboss.tools.openshift.internal.ui.models.IReplicationControllerWrapper in project jbosstools-openshift by jbosstools.

the class OpenShiftExplorerContentProvider method getProjectChildren.

protected Object[] getProjectChildren(IProjectWrapper project) {
    switch(project.getState()) {
        case LOADED:
            removeStub(project);
            Collection<IResourceWrapper<?, ?>> services = project.getResourcesOfKind(ResourceKind.SERVICE);
            Collection<IReplicationControllerWrapper> dcs = project.getResourcesOfType(IReplicationControllerWrapper.class);
            services.addAll(dcs);
            Collection<IResourceWrapper<?, ?>> pods = project.getResourcesOfKind(ResourceKind.POD).stream().filter(wrapper -> ResourceUtils.isRuntimePod((IPod) wrapper.getWrapped()) && !((IPod) wrapper.getWrapped()).isAnnotatedWith(OpenShiftAPIAnnotations.DEPLOYMENT_NAME)).collect(Collectors.toList());
            services.addAll(pods);
            return services.toArray();
        case LOAD_STOPPED:
            LoadingStub stub = removeStub(project);
            if (stub != null) {
                return stub.getChildren();
            }
        default:
            project.load(e -> {
                handleLoadingException(project, e);
            });
            return new Object[] { makeStub(project) };
    }
}
Also used : IReplicationControllerWrapper(org.jboss.tools.openshift.internal.ui.models.IReplicationControllerWrapper) Arrays(java.util.Arrays) ResourceUtils(org.jboss.tools.openshift.internal.core.util.ResourceUtils) HashMap(java.util.HashMap) IConnectionWrapper(org.jboss.tools.openshift.internal.ui.models.IConnectionWrapper) StructuredViewer(org.eclipse.jface.viewers.StructuredViewer) ArrayList(java.util.ArrayList) IResourceWrapper(org.jboss.tools.openshift.internal.ui.models.IResourceWrapper) IPod(com.openshift.restclient.model.IPod) Map(java.util.Map) ITreeContentProvider(org.eclipse.jface.viewers.ITreeContentProvider) ConnectionsRegistry(org.jboss.tools.openshift.common.core.connection.ConnectionsRegistry) Viewer(org.eclipse.jface.viewers.Viewer) ResourceKind(com.openshift.restclient.ResourceKind) Collection(java.util.Collection) IBuild(com.openshift.restclient.model.IBuild) OpenshiftUIModel(org.jboss.tools.openshift.internal.ui.models.OpenshiftUIModel) IReplicationControllerWrapper(org.jboss.tools.openshift.internal.ui.models.IReplicationControllerWrapper) Collectors(java.util.stream.Collectors) LoadingStub(org.jboss.tools.openshift.internal.common.ui.explorer.BaseExplorerContentProvider.LoadingStub) IResourceContainer(org.jboss.tools.openshift.internal.ui.models.IResourceContainer) IServiceWrapper(org.jboss.tools.openshift.internal.ui.models.IServiceWrapper) Connection(org.jboss.tools.openshift.core.connection.Connection) List(java.util.List) OpenShiftAPIAnnotations(org.jboss.tools.openshift.core.OpenShiftAPIAnnotations) IRoute(com.openshift.restclient.model.route.IRoute) BaseExplorerContentProvider(org.jboss.tools.openshift.internal.common.ui.explorer.BaseExplorerContentProvider) IProjectWrapper(org.jboss.tools.openshift.internal.ui.models.IProjectWrapper) ConnectionsRegistrySingleton(org.jboss.tools.openshift.common.core.connection.ConnectionsRegistrySingleton) IElementListener(org.jboss.tools.openshift.internal.ui.models.IElementListener) IOpenshiftUIElement(org.jboss.tools.openshift.internal.ui.models.IOpenshiftUIElement) Control(org.eclipse.swt.widgets.Control) IResourceWrapper(org.jboss.tools.openshift.internal.ui.models.IResourceWrapper) LoadingStub(org.jboss.tools.openshift.internal.common.ui.explorer.BaseExplorerContentProvider.LoadingStub) IPod(com.openshift.restclient.model.IPod)

Aggregations

ResourceKind (com.openshift.restclient.ResourceKind)1 IBuild (com.openshift.restclient.model.IBuild)1 IPod (com.openshift.restclient.model.IPod)1 IRoute (com.openshift.restclient.model.route.IRoute)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Collectors (java.util.stream.Collectors)1 ITreeContentProvider (org.eclipse.jface.viewers.ITreeContentProvider)1 StructuredViewer (org.eclipse.jface.viewers.StructuredViewer)1 Viewer (org.eclipse.jface.viewers.Viewer)1 Control (org.eclipse.swt.widgets.Control)1 ConnectionsRegistry (org.jboss.tools.openshift.common.core.connection.ConnectionsRegistry)1 ConnectionsRegistrySingleton (org.jboss.tools.openshift.common.core.connection.ConnectionsRegistrySingleton)1 OpenShiftAPIAnnotations (org.jboss.tools.openshift.core.OpenShiftAPIAnnotations)1 Connection (org.jboss.tools.openshift.core.connection.Connection)1 BaseExplorerContentProvider (org.jboss.tools.openshift.internal.common.ui.explorer.BaseExplorerContentProvider)1