use of org.jboss.tools.openshift.internal.common.ui.explorer.BaseExplorerContentProvider.LoadingStub in project jbosstools-openshift by jbosstools.
the class OpenShiftExplorerContentProvider method getConnectionChildren.
protected Object[] getConnectionChildren(IConnectionWrapper connection) {
switch(connection.getState()) {
case LOADED:
removeStub(connection);
Object[] result = connection.getResources().toArray();
if (result == null || result.length == 0) {
result = new Object[] { new NewProjectLinkNode((Connection) connection.getWrapped()) };
}
return result;
case LOAD_STOPPED:
LoadingStub stub = removeStub(connection);
if (stub != null) {
return stub.getChildren();
}
default:
connection.load(e -> handleLoadingException(connection, e));
return new Object[] { makeStub(connection) };
}
}
use of org.jboss.tools.openshift.internal.common.ui.explorer.BaseExplorerContentProvider.LoadingStub in project jbosstools-openshift by jbosstools.
the class OpenShiftExplorerContentProvider method handleLoadingException.
private void handleLoadingException(Object parentElement, Throwable e) {
LoadingStub stub = makeStub(parentElement);
stub.add(e);
asyncExec(() -> refreshViewer(parentElement));
}
use of org.jboss.tools.openshift.internal.common.ui.explorer.BaseExplorerContentProvider.LoadingStub 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) };
}
}
use of org.jboss.tools.openshift.internal.common.ui.explorer.BaseExplorerContentProvider.LoadingStub in project jbosstools-openshift by jbosstools.
the class OpenShiftExplorerContentProvider method makeStub.
private LoadingStub makeStub(Object parentElement) {
synchronized (stubs) {
LoadingStub stub = stubs.get(parentElement);
if (stub == null) {
stub = new LoadingStub();
stubs.put(parentElement, stub);
}
return stub;
}
}
Aggregations