use of org.eclipse.core.runtime.Status in project sling by apache.
the class ProjectUtil method loadFilter.
/**
* Loads a filter for the specified project
*
* @param project the project to find a filter for
* @return the found filter or null
* @throws CoreException
*/
public static Filter loadFilter(final IProject project) throws CoreException {
FilterLocator filterLocator = Activator.getDefault().getFilterLocator();
IPath filterPath = findFilterPath(project);
if (filterPath == null) {
return null;
}
IFile filterFile = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(filterPath);
Filter filter = null;
if (filterFile != null && filterFile.exists()) {
try (InputStream contents = filterFile.getContents()) {
filter = filterLocator.loadFilter(contents);
} catch (IOException e) {
throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Failed loading filter file for project " + project.getName() + " from location " + filterFile, e));
}
}
return filter;
}
use of org.eclipse.core.runtime.Status in project sling by apache.
the class AbstractNewSlingApplicationWizard method reportError.
public void reportError(Throwable t) {
if (t instanceof CoreException) {
reportError((CoreException) t);
return;
}
IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, t.getMessage(), t);
reportError(new CoreException(status));
}
use of org.eclipse.core.runtime.Status in project bndtools by bndtools.
the class Plugin method report.
public static void report(boolean warnings, @SuppressWarnings("unused") boolean acknowledge, Processor reporter, final String title, final String extra) {
if (reporter.getErrors().size() > 0 || (warnings && reporter.getWarnings().size() > 0)) {
final StringBuffer sb = new StringBuffer();
sb.append("\n");
if (reporter.getErrors().size() > 0) {
sb.append("[Errors]\n");
for (String msg : reporter.getErrors()) {
sb.append(msg);
sb.append("\n");
}
}
sb.append("\n");
if (reporter.getWarnings().size() > 0) {
sb.append("[Warnings]\n");
for (String msg : reporter.getWarnings()) {
sb.append(msg);
sb.append("\n");
}
}
final Status s = new Status(Status.ERROR, PLUGIN_ID, 0, sb.toString(), null);
reporter.clear();
async(new Runnable() {
@Override
public void run() {
ErrorDialog.openError(null, title, title + "\n" + extra, s);
}
});
} else {
message(title + " : ok");
}
}
use of org.eclipse.core.runtime.Status in project bndtools by bndtools.
the class Plugin method warning.
public static void warning(List<String> errors) {
final StringBuffer sb = new StringBuffer();
for (String msg : errors) {
sb.append(msg);
sb.append("\n");
}
async(new Runnable() {
@Override
public void run() {
Status s = new Status(Status.WARNING, PLUGIN_ID, 0, "", null);
ErrorDialog.openError(null, "Warnings during bundle generation", sb.toString(), s);
}
});
}
use of org.eclipse.core.runtime.Status in project bndtools by bndtools.
the class Plugin method error.
public void error(final String msg, final Throwable t) {
Status s = new Status(Status.ERROR, PLUGIN_ID, 0, msg, t);
getLog().log(s);
async(new Runnable() {
@Override
public void run() {
if (!busy.compareAndSet(false, true)) {
Status s = new Status(Status.ERROR, PLUGIN_ID, 0, "", null);
ErrorDialog.openError(null, "Errors during bundle generation", msg + " " + t.getMessage(), s);
busy.set(false);
}
}
});
}
Aggregations