Office: added message when word file is empty of fields
Signed-off-by: Dusan Kalanj <kalanj@chalmers.se>
diff --git a/org.eclipse.capra.ui.office/src/org/eclipse/capra/ui/office/views/OfficeView.java b/org.eclipse.capra.ui.office/src/org/eclipse/capra/ui/office/views/OfficeView.java
index 54d95a7..51d8af4 100644
--- a/org.eclipse.capra.ui.office/src/org/eclipse/capra/ui/office/views/OfficeView.java
+++ b/org.eclipse.capra.ui.office/src/org/eclipse/capra/ui/office/views/OfficeView.java
@@ -373,10 +373,10 @@
showErrorMessage(ERROR_TITLE, hyperlinkMessage, BUGZILLA_OFFICE_URL);
return;
}
-
+
// Clear the Office view and all static variables
clearSelection();
-
+
// Check if the sheet-to-display isn't empty and find a first non-empty
// sheet if that is the case, and fill isSheetEmpty HashMap with sheet
// names for keys and info about whether they are not empty for values
@@ -391,7 +391,7 @@
sheetToDisplay = s;
}
}
-
+
if (!nonEmptySheetFound) {
showErrorMessage(ERROR_TITLE, "There are no rows to display in any of the sheets.", null);
clearSelection();
@@ -455,6 +455,10 @@
if (!selection.isEmpty())
provider.setResource(selection.get(0));
+ else {
+ showErrorMessage(ERROR_TITLE, "There are no fields with the specified field name in this document.", null);
+ return;
+ }
viewer.refresh();
}