Search in sources :

Example 11 with ApplicationExplorerUIModel

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

the class RefreshHandler method execute.

@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
    ISelection selection = HandlerUtil.getCurrentSelection(event);
    ApplicationExplorerUIModel cluster = UIUtils.getFirstElement(selection, ApplicationExplorerUIModel.class);
    if (cluster == null) {
        // $NON-NLS-1$
        return OpenShiftUIActivator.statusFactory().cancelStatus("No cluster selected");
    }
    Shell parent = HandlerUtil.getActiveShell(event);
    executeInJob("Refresh cluster", monitor -> execute(parent, cluster));
    return null;
}
Also used : Shell(org.eclipse.swt.widgets.Shell) ApplicationExplorerUIModel(org.jboss.tools.openshift.internal.ui.models.applicationexplorer.ApplicationExplorerUIModel) ISelection(org.eclipse.jface.viewers.ISelection)

Example 12 with ApplicationExplorerUIModel

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

the class NewProjectHandler method execute.

@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
    ISelection selection = HandlerUtil.getCurrentSelection(event);
    ApplicationExplorerUIModel cluster = UIUtils.getFirstElement(selection, ApplicationExplorerUIModel.class);
    if (cluster == null) {
        // $NON-NLS-1$
        return OpenShiftUIActivator.statusFactory().cancelStatus("No cluster selected");
    }
    Shell shell = HandlerUtil.getActiveShell(event);
    openDialog(cluster, shell);
    return null;
}
Also used : Shell(org.eclipse.swt.widgets.Shell) ApplicationExplorerUIModel(org.jboss.tools.openshift.internal.ui.models.applicationexplorer.ApplicationExplorerUIModel) ISelection(org.eclipse.jface.viewers.ISelection)

Aggregations

ApplicationExplorerUIModel (org.jboss.tools.openshift.internal.ui.models.applicationexplorer.ApplicationExplorerUIModel)12 IOException (java.io.IOException)8 ISelection (org.eclipse.jface.viewers.ISelection)8 ExecutionException (org.eclipse.core.commands.ExecutionException)5 Odo (org.jboss.tools.openshift.core.odo.Odo)3 ArrayList (java.util.ArrayList)2 Shell (org.eclipse.swt.widgets.Shell)2 ApplicationElement (org.jboss.tools.openshift.internal.ui.models.applicationexplorer.ApplicationElement)2 ProjectElement (org.jboss.tools.openshift.internal.ui.models.applicationexplorer.ProjectElement)2 KubernetesClientException (io.fabric8.kubernetes.client.KubernetesClientException)1 IProject (org.eclipse.core.resources.IProject)1 IWizard (org.eclipse.jface.wizard.IWizard)1 BrowserUtility (org.jboss.tools.foundation.ui.util.BrowserUtility)1 OpenShiftApplicationExplorerContentProvider (org.jboss.tools.openshift.internal.ui.applicationexplorer.OpenShiftApplicationExplorerContentProvider)1 ClusterClient (org.jboss.tools.openshift.internal.ui.models.applicationexplorer.ApplicationExplorerUIModel.ClusterClient)1 ComponentElement (org.jboss.tools.openshift.internal.ui.models.applicationexplorer.ComponentElement)1 ServiceElement (org.jboss.tools.openshift.internal.ui.models.applicationexplorer.ServiceElement)1 StorageElement (org.jboss.tools.openshift.internal.ui.models.applicationexplorer.StorageElement)1 URLElement (org.jboss.tools.openshift.internal.ui.models.applicationexplorer.URLElement)1 OdoCliFactory (org.jboss.tools.openshift.internal.ui.odo.OdoCliFactory)1