setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
long tResult =0;
long tCompiled=0;
ResourceSet result = null;
try {
final XQueryService service= (XQueryService) collection.getService("XQueryService", "1.0");
service.setProperty(OutputKeys.INDENT, properties.getProperty(OutputKeys.INDENT, "yes"));
final long t0 = System.currentTimeMillis();
if (resource != null) {
service.setModuleLoadPath(XmldbURI.EMBEDDED_SERVER_URI_PREFIX + resource.getParentCollection().getName());
}
final CompiledExpression compiled = service.compile(xpath);
final long t1 = System.currentTimeMillis();
// Check could also be collection instanceof LocalCollection
if(compiled instanceof CompiledXQuery)
{context = ((CompiledXQuery)compiled).getContext();}
tCompiled = t1 - t0;
// In this way we can see the parsed structure meanwhile the query is
StringWriter writer = new StringWriter();
service.dump(compiled, writer);
exprDisplay.setText(writer.toString());
result = service.execute(compiled);
context = null;
tResult = System.currentTimeMillis() - t1;
// jmfg: Is this still needed? I don't think so
writer = new StringWriter();
service.dump(compiled, writer);
exprDisplay.setText(writer.toString());
statusMessage.setText(Messages.getString("QueryDialog.retrievingmessage"));
XMLResource resource;
final int howmany= count.getNumber().intValue();