Search in sources :

Example 1 with LabelNotification

use of org.jboss.tools.common.ui.notification.LabelNotification in project jbosstools-openshift by jbosstools.

the class CreateComponentHandler method execute.

/**
 * @param shell
 * @param model
 * @return
 */
private static void execute(Shell shell, CreateComponentModel model, AbstractOpenshiftUIElement<?, ?, ApplicationExplorerUIModel> element) {
    LabelNotification notification = LabelNotification.openNotification(shell, "Creating component " + model.getComponentName());
    try {
        model.getOdo().createComponentLocal(model.getProjectName(), model.getApplicationName(), model.getSelectedComponentType().getName(), null, model.getSelectedComponentType().getKind() == ComponentKind.DEVFILE ? ((DevfileComponentType) model.getSelectedComponentType()).getDevfileRegistry().getName() : null, model.getComponentName(), model.getEclipseProject().getLocation().toOSString(), model.isEclipseProjectHasDevfile() ? CreateComponentModel.DEVFILE_NAME : null, model.getSelectedComponentStarter() == null ? null : model.getSelectedComponentStarter().getName(), model.isPushAfterCreate());
        LabelNotification.openNotification(notification, shell, "Component " + model.getComponentName() + " created");
        element.getRoot().addContext(model.getEclipseProject());
        element.refresh();
    } catch (IOException e) {
        shell.getDisplay().asyncExec(() -> {
            notification.close();
            MessageDialog.openError(shell, "Create component", "Error creating component " + model.getComponentName());
        });
    }
}
Also used : LabelNotification(org.jboss.tools.common.ui.notification.LabelNotification) IOException(java.io.IOException)

Example 2 with LabelNotification

use of org.jboss.tools.common.ui.notification.LabelNotification in project jbosstools-openshift by jbosstools.

the class NewProjectHandler method execute.

/**
 * @param cluster
 * @param value
 * @return
 */
private static void execute(Shell shell, ApplicationExplorerUIModel cluster, String project) {
    LabelNotification notification = LabelNotification.openNotification(shell, "Creating project " + project);
    try {
        cluster.getOdo().createProject(project);
        cluster.refresh();
        LabelNotification.openNotification(notification, shell, "Project " + project + " created");
    } catch (IOException e) {
        shell.getDisplay().asyncExec(() -> {
            notification.close();
            MessageDialog.openError(shell, "Create project", "Error creating project " + project);
        });
    }
}
Also used : LabelNotification(org.jboss.tools.common.ui.notification.LabelNotification) IOException(java.io.IOException)

Example 3 with LabelNotification

use of org.jboss.tools.common.ui.notification.LabelNotification in project jbosstools-openshift by jbosstools.

the class RefreshHandler method execute.

/**
 * @param cluster
 * @param value
 * @return
 */
private void execute(Shell shell, ApplicationExplorerUIModel cluster) {
    LabelNotification notification = LabelNotification.openNotification(shell, "Refresh cluster");
    try {
        cluster.refresh();
        LabelNotification.openNotification(notification, shell, "Cluster refreshed");
    } catch (Exception e) {
        shell.getDisplay().asyncExec(() -> {
            notification.close();
            MessageDialog.openError(shell, "Error during refresh", "Cannot refresh cluster");
        });
    }
}
Also used : LabelNotification(org.jboss.tools.common.ui.notification.LabelNotification) ExecutionException(org.eclipse.core.commands.ExecutionException)

Example 4 with LabelNotification

use of org.jboss.tools.common.ui.notification.LabelNotification in project jbosstools-openshift by jbosstools.

the class LinkComponentHandler method execute.

private void execute(Shell shell, LinkModel<Component> model, ComponentElement component) {
    LabelNotification notification = LabelNotification.openNotification(shell, "Linking component " + model.getComponentName() + " to " + model.getTarget().getName());
    try {
        model.getOdo().link(model.getProjectName(), model.getApplicationName(), component.getWrapped().getName(), component.getWrapped().getPath(), model.getTarget().getName());
        LabelNotification.openNotification(notification, shell, "Component " + model.getComponentName() + " linked to " + model.getTarget().getName());
    } catch (IOException e) {
        shell.getDisplay().asyncExec(() -> {
            notification.close();
            MessageDialog.openError(shell, "Link component", "Can't link component error message:" + e.getLocalizedMessage());
        });
    }
}
Also used : LabelNotification(org.jboss.tools.common.ui.notification.LabelNotification) IOException(java.io.IOException)

Example 5 with LabelNotification

use of org.jboss.tools.common.ui.notification.LabelNotification in project jbosstools-openshift by jbosstools.

the class LinkServiceHandler method execute.

private void execute(Shell shell, LinkModel<Service> model, ComponentElement component) {
    LabelNotification notification = LabelNotification.openNotification(shell, "Linking component " + model.getComponentName() + " to service " + model.getTarget().getName());
    try {
        model.getOdo().link(model.getProjectName(), model.getApplicationName(), component.getWrapped().getName(), component.getWrapped().getPath(), model.getTarget().getKind() + '/' + model.getTarget().getName());
        LabelNotification.openNotification(notification, shell, "Component " + model.getComponentName() + " linked to service " + model.getTarget().getName());
    } catch (IOException e) {
        shell.getDisplay().asyncExec(() -> {
            notification.close();
            MessageDialog.openError(Display.getDefault().getActiveShell(), "Link service", "Can't link service error message:" + e.getLocalizedMessage());
        });
    }
}
Also used : LabelNotification(org.jboss.tools.common.ui.notification.LabelNotification) IOException(java.io.IOException)

Aggregations

LabelNotification (org.jboss.tools.common.ui.notification.LabelNotification)5 IOException (java.io.IOException)4 ExecutionException (org.eclipse.core.commands.ExecutionException)1