Search in sources :

Example 1 with CreateComponentModel

use of org.jboss.tools.openshift.internal.ui.wizard.applicationexplorer.CreateComponentModel 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));
    }
}
Also used : CreateComponentWizard(org.jboss.tools.openshift.internal.ui.wizard.applicationexplorer.CreateComponentWizard) ApplicationExplorerUIModel(org.jboss.tools.openshift.internal.ui.models.applicationexplorer.ApplicationExplorerUIModel) IWizard(org.eclipse.jface.wizard.IWizard) Odo(org.jboss.tools.openshift.core.odo.Odo) CreateComponentModel(org.jboss.tools.openshift.internal.ui.wizard.applicationexplorer.CreateComponentModel) IProject(org.eclipse.core.resources.IProject)

Aggregations

IProject (org.eclipse.core.resources.IProject)1 IWizard (org.eclipse.jface.wizard.IWizard)1 Odo (org.jboss.tools.openshift.core.odo.Odo)1 ApplicationExplorerUIModel (org.jboss.tools.openshift.internal.ui.models.applicationexplorer.ApplicationExplorerUIModel)1 CreateComponentModel (org.jboss.tools.openshift.internal.ui.wizard.applicationexplorer.CreateComponentModel)1 CreateComponentWizard (org.jboss.tools.openshift.internal.ui.wizard.applicationexplorer.CreateComponentWizard)1