assure("could not get Recovery Dialog at start of office", (oDialog != null), CONTINUE);
XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, oDialog);
log.println("got the following dialog: '" +oDialog.getTitle() + "'");
UITools oUITools = new UITools(xMSF, xWindow);
String listBoxName = "Status of recovered documents";
String[] documents = oUITools.getListBoxItems(listBoxName);
log.println("there are " + documents.length + " documents to recover");
log.println("The following files will be recovered:");
for (int i=0;i<documents.length;i++){
log.println(documents[i]);
}
String msg ="The amount of documents to recover is different form the expected amount:\n";
msg += "\texpected:\t" + expectedDocumentCount + "\n";
msg += "\tto recover:\t" + documents.length;
assure(msg, expectedDocumentCount ==documents.length);
if (recover){
log.println("clicking 'Start Recovery' button...");
oUITools.clickButton("Start Recovery >");
rt.pause();
//XAccessibleContext oButton = oUITools.getButton("Start Recovery >");
int counter = 0;
int maximum = param.getInt(PropertyName.THREAD_TIME_OUT) / param.getInt(PropertyName.SHORT_WAIT);
//boolean enabeld = oButton.getAccessibleStateSet().contains(com.sun.star.accessibility.AccessibleStateType.ENABLED);
XAccessibleContext oButton = null;
while ((oButton == null) && (counter < maximum)){
log.println("recovering...");
try{
oButton = oUITools.getButton("Next >");
} catch (java.lang.NullPointerException e){
// no fault: The title "Start Recovery" switches to "Next"
// while all documents are recoverd
}
rt.pause();
counter++;
}
if (cancel) {
log.println("clicking 'Cancel' button...");
try{
rt.clickThreadButton(xMSF, xWindow, "Cancel");
} catch (com.sun.star.accessibility.IllegalAccessibleComponentStateException e){
failed("Could not click 'Cancel' at recovery-dialog.");
}
}
else {
log.println("clicking 'Next' button...");
oUITools.clickButton("Next >");
}
rt.pause();
} else {