use of org.eclipse.core.runtime.MultiStatus in project eclipse-integration-commons by spring-projects.
the class InstallableItem method install.
public IStatus install(File base, IProgressMonitor monitor) {
File targetLocation = getTargetLocation(base);
targetLocation.mkdirs();
MultiStatus result = new MultiStatus(Activator.PLUGIN_ID, 0, NLS.bind("Installation of {0} failed", getName()), null);
List<AbstractInstallOperation> operations = getInstallOperations();
SubMonitor progress = SubMonitor.convert(monitor, NLS.bind("Installing {0}", getName()), operations.size());
for (AbstractInstallOperation operation : operations) {
try {
operation.setSourceBase(getSourceLocation());
} catch (CoreException e) {
return e.getStatus();
}
operation.setTargetBase(targetLocation);
IStatus status = operation.install(progress.newChild(1));
result.add(status);
}
return result;
}
use of org.eclipse.core.runtime.MultiStatus in project webtools.sourceediting by eclipse.
the class AdvancedOptionsDialog method createStatus.
// TODO... This was copied from WindowUtility. Is there an easier way to
// create a status object?
// If not, we should open an eclipse bug or add a similar utility to
// baseExtensionsUI.
//
private static IStatus createStatus(String reason, String msg) {
String pluginId = XMLUIPlugin.getDefault().getBundle().getSymbolicName();
MultiStatus multiStatus = new MultiStatus(pluginId, 0, reason, null);
Status status = new Status(IStatus.ERROR, pluginId, 0, msg, null);
multiStatus.add(status);
return multiStatus;
}
use of org.eclipse.core.runtime.MultiStatus in project bndtools by bndtools.
the class Central method toStatus.
/**
* Convert a processor to a status object
*/
public static IStatus toStatus(Processor processor, String message) {
int severity = IStatus.INFO;
List<IStatus> statuses = new ArrayList<IStatus>();
for (String error : processor.getErrors()) {
Status status = new Status(IStatus.ERROR, BndtoolsConstants.CORE_PLUGIN_ID, error);
statuses.add(status);
severity = IStatus.ERROR;
}
for (String warning : processor.getWarnings()) {
Status status = new Status(IStatus.WARNING, BndtoolsConstants.CORE_PLUGIN_ID, warning);
statuses.add(status);
severity = IStatus.WARNING;
}
IStatus[] array = statuses.toArray(new IStatus[0]);
return new //
MultiStatus(//
BndtoolsConstants.CORE_PLUGIN_ID, //
severity, array, message, null);
}
use of org.eclipse.core.runtime.MultiStatus in project bndtools by bndtools.
the class OSGiFrameworkContentProvider method refreshProviders.
private IStatus refreshProviders() {
List<IStatus> statuses = new ArrayList<>();
IConfigurationElement[] configElements = Platform.getExtensionRegistry().getConfigurationElementsFor(Plugin.PLUGIN_ID, "osgiFrameworks");
for (IConfigurationElement element : configElements) {
String frameworkName = element.getAttribute("name");
String bsn = element.getAttribute("bsn");
URL iconUrl = null;
String iconPath = element.getAttribute("icon");
if (iconPath != null) {
Bundle contributorBundle = BundleUtils.findBundle(Plugin.getDefault().getBundleContext(), element.getContributor().getName(), null);
if (contributorBundle != null)
iconUrl = contributorBundle.getEntry(iconPath);
}
List<RepositoryPlugin> repositories;
try {
repositories = (workspace != null) ? workspace.getRepositories() : Collections.<RepositoryPlugin>emptyList();
} catch (Exception e) {
return new Status(IStatus.ERROR, Plugin.PLUGIN_ID, e.getMessage(), e);
}
for (RepositoryPlugin repo : repositories) {
try {
SortedSet<Version> versions = repo.versions(bsn);
if (versions != null)
for (Version version : versions) {
try {
File framework = repo.get(bsn, version, null);
if (framework != null)
frameworks.add(new OSGiFramework(frameworkName, bsn, version, iconUrl));
} catch (Exception e) {
String msg = String.format("Error finding repository entry for OSGi framework %s, version %s.", bsn, version.toString());
logger.logError(msg, e);
statuses.add(new Status(IStatus.ERROR, Plugin.PLUGIN_ID, msg, e));
}
}
} catch (Exception e) {
String msg = String.format("Error searching repository for OSGi framework %s.", bsn);
logger.logError(msg, e);
statuses.add(new Status(IStatus.ERROR, Plugin.PLUGIN_ID, msg, e));
}
}
}
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
structuredViewer.refresh(true);
}
});
if (statuses.size() > 0) {
return new MultiStatus(Plugin.PLUGIN_ID, IStatus.ERROR, statuses.toArray(new IStatus[0]), "Errors while refreshing OSGi framework providers.", null);
}
return Status.OK_STATUS;
}
use of org.eclipse.core.runtime.MultiStatus in project bndtools by bndtools.
the class ImportBndWorkspaceWizard method createMultiStatus.
/*
* TODO probably something to move to Plugin creates a MultiStatus including StackTrace
*/
private static MultiStatus createMultiStatus(Throwable t) {
List<Status> childStatuses = new ArrayList<>();
StackTraceElement[] stackTraces = Thread.currentThread().getStackTrace();
for (StackTraceElement stackTrace : stackTraces) {
Status status = new Status(IStatus.ERROR, Plugin.PLUGIN_ID, stackTrace.toString());
childStatuses.add(status);
}
MultiStatus ms = new MultiStatus(Plugin.PLUGIN_ID, IStatus.ERROR, childStatuses.toArray(new Status[] {}), t.toString(), t);
return ms;
}
Aggregations