use of org.jboss.tools.openshift.internal.ui.models.IOpenshiftUIElement in project jbosstools-openshift by jbosstools.
the class ScaleDeploymentContributionItem method isRelevant.
private boolean isRelevant() {
ISelectionService service = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService();
ISelection selection = service != null ? service.getSelection() : null;
if (selection == null || selection.isEmpty()) {
return false;
}
IRunningPodHolder podHolder = UIUtils.getFirstElement(selection, IRunningPodHolder.class);
if (podHolder == null) {
return false;
}
IOpenshiftUIElement<?, IOpenshiftUIElement<?, ?>> podUIElement = podHolder.getPodUIElement();
if (!(podUIElement instanceof IResourceWrapper)) {
return false;
}
IResourceWrapper<?, ?> podWrapper = (IResourceWrapper<?, ?>) podUIElement;
if (ResourceWrapperUtils.getServiceWrapperFor(podWrapper, serviceWrapper -> ResourceUtils.areRelated((IPod) podWrapper.getWrapped(), (IService) serviceWrapper.getWrapped())) == null) {
return false;
}
return true;
}
Aggregations