diff --git a/bndtools.core/src/bndtools/wizards/newworkspace/NewWorkspaceWizard.java b/bndtools.core/src/bndtools/wizards/newworkspace/NewWorkspaceWizard.java index ed0a5bdb61..c53e310a80 100644 --- a/bndtools.core/src/bndtools/wizards/newworkspace/NewWorkspaceWizard.java +++ b/bndtools.core/src/bndtools/wizards/newworkspace/NewWorkspaceWizard.java @@ -9,7 +9,10 @@ import java.util.stream.Stream; import org.bndtools.core.ui.icons.Icons; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.jface.dialogs.ErrorDialog; import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.CheckboxTableViewer; import org.eclipse.jface.viewers.ColumnLabelProvider; @@ -49,6 +52,7 @@ import aQute.bnd.wstemplates.FragmentTemplateEngine; import aQute.bnd.wstemplates.FragmentTemplateEngine.TemplateInfo; import aQute.bnd.wstemplates.FragmentTemplateEngine.TemplateUpdater; +import bndtools.Plugin; import bndtools.central.Central; import bndtools.util.ui.UI; @@ -86,6 +90,19 @@ public NewWorkspaceWizard() throws Exception { ui.write(() -> model.templates = templates.getAvailableTemplates()); } catch (Exception e) { log.error("failed to read default index {}", e, e); + + Display.getDefault() + .asyncExec(() -> { + + IStatus status = new Status(IStatus.ERROR, Plugin.PLUGIN_ID, "failed to read default index", + e); + ErrorDialog.openError(getShell(), "Error", "An error occurred", status); + }); + + Plugin.getDefault() + .getLog() + .log(new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, + "failed to read default index " + DEFAULT_INDEX, e)); } }); job.schedule(); diff --git a/bndtools.core/src/org/bndtools/core/ui/wizards/shared/TemplateSelectionWizardPage.java b/bndtools.core/src/org/bndtools/core/ui/wizards/shared/TemplateSelectionWizardPage.java index 02a58bde57..2f50782883 100644 --- a/bndtools.core/src/org/bndtools/core/ui/wizards/shared/TemplateSelectionWizardPage.java +++ b/bndtools.core/src/org/bndtools/core/ui/wizards/shared/TemplateSelectionWizardPage.java @@ -62,8 +62,8 @@ import org.osgi.service.component.ComponentConstants; import org.osgi.util.promise.Promise; -import aQute.bnd.osgi.Processor; import aQute.bnd.exceptions.Exceptions; +import aQute.bnd.osgi.Processor; import aQute.lib.io.IO; import aQute.libg.tuple.Pair; import bndtools.Plugin; @@ -294,11 +294,20 @@ public void run(IProgressMonitor progress) throws InvocationTargetException { try { Throwable failure = namedPromise.getSecond() .getFailure(); - if (failure != null) + if (failure != null) { + + shell.getDisplay() + .asyncExec(() -> { + IStatus status = new Status(IStatus.ERROR, Plugin.PLUGIN_ID, + "Error loading templates", failure); + ErrorDialog.openError(shell, "Error", "An error occurred", status); + }); + Plugin.getDefault() .getLog() .log(new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, "Failed to load from template loader: " + name, failure)); + } else { Collection