use of org.jboss.tools.openshift.internal.ui.models.applicationexplorer.ApplicationExplorerUIModel in project jbosstools-openshift by jbosstools.
the class CreateComponentHandler method openDialog.
private static void openDialog(DevfileRegistryComponentTypeElement componentType, ApplicationElement application, ProjectElement project, final Shell parent) throws IOException {
Odo odo = project != null ? project.getParent().getOdo() : componentType.getRoot().getOdo();
String projectName = project != null ? project.getWrapped() : odo.getNamespace();
IProject eclipseProject = getOpenedProject();
final CreateComponentModel model = new CreateComponentModel(odo, odo.getComponentTypes(), projectName, application == null ? null : application.getWrapped().getName(), eclipseProject);
if (componentType != null) {
model.setSelectedComponentType(componentType.getWrapped());
}
final IWizard createComponentWizard = new CreateComponentWizard(model);
if (WizardUtils.openWizardDialog(createComponentWizard, parent) == Window.OK) {
AbstractOpenshiftUIElement<?, ?, ApplicationExplorerUIModel> element = componentType != null ? componentType.getRoot() : application == null ? project : application;
executeInJob("Creating component", monitor -> execute(parent, model, element));
}
}
use of org.jboss.tools.openshift.internal.ui.models.applicationexplorer.ApplicationExplorerUIModel in project jbosstools-openshift by jbosstools.
the class ListComponentsHandler 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");
}
try {
cluster.getOdo().listComponents();
} catch (IOException e) {
throw new ExecutionException(e.getLocalizedMessage(), e);
}
return null;
}
use of org.jboss.tools.openshift.internal.ui.models.applicationexplorer.ApplicationExplorerUIModel in project jbosstools-openshift by jbosstools.
the class OpenConsoleHandler 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");
}
try {
String url = cluster.getOdo().consoleURL();
new BrowserUtility().checkedCreateInternalBrowser(url, url, OpenShiftUIActivator.PLUGIN_ID, OpenShiftUIActivator.getDefault().getLog());
} catch (IOException e) {
throw new ExecutionException(e.getLocalizedMessage(), e);
}
return null;
}
use of org.jboss.tools.openshift.internal.ui.models.applicationexplorer.ApplicationExplorerUIModel in project jbosstools-openshift by jbosstools.
the class ListServicesHandler 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");
}
try {
cluster.getOdo().listServices();
} catch (IOException e) {
throw new ExecutionException(e.getLocalizedMessage(), e);
}
return null;
}
use of org.jboss.tools.openshift.internal.ui.models.applicationexplorer.ApplicationExplorerUIModel in project jbosstools-openshift by jbosstools.
the class AboutHandler 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");
}
try {
cluster.getOdo().about();
} catch (IOException e) {
throw new ExecutionException(e.getLocalizedMessage(), e);
}
return null;
}
Aggregations