use of aQute.service.reporter.Reporter.SetLocation in project bnd by bndtools.
the class PropertiesParser method error.
private void error(String msg, Object... args) {
if (reporter != null) {
int line = this.line;
String context = context();
SetLocation loc = reporter.error("%s: <<%s>>", Strings.format(msg, args), context);
loc.line(line);
loc.context(context);
if (file != null)
loc.file(file);
loc.length(context.length());
}
}
use of aQute.service.reporter.Reporter.SetLocation in project bnd by bndtools.
the class Macro method _warning.
public String _warning(String[] args) throws Exception {
for (int i = 1; i < args.length; i++) {
SetLocation warning = domain.warning("%s", process(args[i]));
FileLine header = domain.getHeader(Pattern.compile(".*"), Pattern.compile("\\$\\{warning;"));
if (header != null)
header.set(warning);
}
return "";
}
use of aQute.service.reporter.Reporter.SetLocation in project bnd by bndtools.
the class Macro method _error.
public String _error(String[] args) throws Exception {
for (int i = 1; i < args.length; i++) {
SetLocation error = domain.error("%s", process(args[i]));
FileLine header = domain.getHeader(Pattern.compile(".*"), Pattern.compile("\\$\\{error;"));
if (header != null)
header.set(error);
}
return "";
}
use of aQute.service.reporter.Reporter.SetLocation in project bndtools by bndtools.
the class MarkerSupport method report.
private void report(Processor reporter, IStatus status) {
if (status == null || status.isOK())
return;
if (status.isMultiStatus()) {
for (IStatus s : status.getChildren()) report(reporter, s);
} else {
SetLocation location;
Throwable exception = status.getException();
if (exception != null)
if (status.getSeverity() == IStatus.ERROR)
location = reporter.exception(exception, status.getMessage());
else
location = reporter.warning(status.getMessage() + ": " + exception);
else {
if (status.getSeverity() == IStatus.ERROR) {
location = reporter.error(status.getMessage());
} else {
location = reporter.warning(status.getMessage());
}
}
location.file(reporter.getPropertiesFile().getAbsolutePath());
}
}
use of aQute.service.reporter.Reporter.SetLocation in project bndtools by bndtools.
the class WorkingSetTracker method doWorkingSets.
static void doWorkingSets(final Project model, final IProject targetProject) {
IWorkbench workbench = PlatformUI.getWorkbench();
final IWorkingSetManager workingSetManager = workbench.getWorkingSetManager();
String mergeProperties = model.mergeProperties("-workingset");
if (mergeProperties == null)
return;
Parameters memberShips = new Parameters(mergeProperties);
IWorkingSet[] allWorkingSets = workingSetManager.getAllWorkingSets();
for (IWorkingSet currentWorkingSet : allWorkingSets) {
Attrs attrs = memberShips.remove(currentWorkingSet.getName());
boolean shouldBeMember = attrs != null && Processor.isTrue(attrs.get("member", "true"));
IAdaptable[] elements = currentWorkingSet.getElements();
List<IAdaptable> members = new ExtList<>(elements);
boolean foundProjectInCurrentWorkingSet = false;
for (Iterator<IAdaptable> it = members.iterator(); it.hasNext(); ) {
IAdaptable member = it.next();
if (member.getAdapter(IProject.class) == targetProject) {
foundProjectInCurrentWorkingSet = true;
if (!shouldBeMember) {
it.remove();
}
}
}
if (!foundProjectInCurrentWorkingSet && shouldBeMember) {
members.add(targetProject);
}
if (elements.length != members.size()) {
updateWorkingSet(currentWorkingSet, members);
}
}
for (final Entry<String, Attrs> e : memberShips.entrySet()) {
String name = e.getKey();
boolean isMember = Processor.isTrue(e.getValue().get("member", "true"));
if (!isMember)
continue;
if (!JAVAID_P.matcher(name).matches()) {
SetLocation error = model.warning("Invalid working set name '%s'. Must use pattern of Java identifier", name);
error.file(model.getPropertiesFile().getAbsolutePath());
error.header("-workingset");
continue;
}
IAdaptable[] members = new IAdaptable[1];
members[0] = targetProject;
IWorkingSet newWorkingSet = workingSetManager.createWorkingSet(name, members);
newWorkingSet.setId("org.eclipse.jdt.ui.JavaWorkingSetPage");
newWorkingSet.setLabel(null);
workingSetManager.addWorkingSet(newWorkingSet);
}
}
Aggregations