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());
});
}
}
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);
});
}
}
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");
});
}
}
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());
});
}
}
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());
});
}
}
Aggregations