Search in sources :

Example 6 with IServiceWrapper

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

the class ScaleDeploymentHandler method getDeploymentConfig.

private IDeploymentConfig getDeploymentConfig(IResourceWrapper<?, ?> wrapper) {
    if (wrapper == null) {
        return null;
    }
    IDeploymentConfig dc = null;
    IResource wrapped = wrapper.getWrapped();
    if (wrapper instanceof IServiceWrapper) {
        // service selected
        dc = getDeploymentConfig((IServiceWrapper) wrapper);
    } else if (wrapped instanceof IPod) {
        // pod selected
        dc = getDeploymentConfig((IPod) wrapped, wrapper);
    } else if (wrapped instanceof IDeploymentConfig) {
        // deployment config selected
        // has to be tested before IReplicationController, IDeploymentConfig extends IReplicationController
        dc = (IDeploymentConfig) wrapped;
    } else if (wrapped instanceof IReplicationController) {
        // replication controller selected (deployment tab in properties)
        // has to be tested after IDeploymentConfig, IDeploymentConfig extends IReplicationController
        dc = getDeploymentConfig((IReplicationController) wrapped, wrapper);
    }
    return dc;
}
Also used : IServiceWrapper(org.jboss.tools.openshift.internal.ui.models.IServiceWrapper) IDeploymentConfig(com.openshift.restclient.model.IDeploymentConfig) IResource(com.openshift.restclient.model.IResource) IPod(com.openshift.restclient.model.IPod) IReplicationController(com.openshift.restclient.model.IReplicationController)

Aggregations

IServiceWrapper (org.jboss.tools.openshift.internal.ui.models.IServiceWrapper)6 IDeploymentConfig (com.openshift.restclient.model.IDeploymentConfig)4 ISelection (org.eclipse.jface.viewers.ISelection)3 ResourceKind (com.openshift.restclient.ResourceKind)2 IProject (com.openshift.restclient.model.IProject)2 IReplicationController (com.openshift.restclient.model.IReplicationController)2 IService (com.openshift.restclient.model.IService)2 IRoute (com.openshift.restclient.model.route.IRoute)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 AbstractHandler (org.eclipse.core.commands.AbstractHandler)2 ExecutionEvent (org.eclipse.core.commands.ExecutionEvent)2 ExecutionException (org.eclipse.core.commands.ExecutionException)2 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)2 IStatus (org.eclipse.core.runtime.IStatus)2 Status (org.eclipse.core.runtime.Status)2 Dialog (org.eclipse.jface.dialogs.Dialog)2 NLS (org.eclipse.osgi.util.NLS)2 Shell (org.eclipse.swt.widgets.Shell)2 HandlerUtil (org.eclipse.ui.handlers.HandlerUtil)2