518300 - [Fix] Show all spreadsheet files from Google Drive on the Capra Drive view
Show all Excell files from Google Drive
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=518300
diff --git a/org.eclipse.capra.ui.drive/src/org/eclipse/capra/ui/drive/CapraGoogleDriveView.java b/org.eclipse.capra.ui.drive/src/org/eclipse/capra/ui/drive/CapraGoogleDriveView.java
index d50eea4..29e92cc 100644
--- a/org.eclipse.capra.ui.drive/src/org/eclipse/capra/ui/drive/CapraGoogleDriveView.java
+++ b/org.eclipse.capra.ui.drive/src/org/eclipse/capra/ui/drive/CapraGoogleDriveView.java
@@ -55,7 +55,7 @@
/**
* Provides a Capra perspective view for displaying the contents of Google
* sheets from Google Drive.
- *
+ *
* @author Dusan Kalanj
*
*/
@@ -109,7 +109,7 @@
/**
* Creates an authorized Credential object.
- *
+ *
* @return an authorized Credential object.
* @throws IOException
*/
@@ -129,7 +129,7 @@
/**
* Build and return an authorized Drive client service.
- *
+ *
* @return an authorized Drive client service
* @throws IOException
*/
@@ -140,19 +140,18 @@
/**
* Fills the Capra Drive view with Google sheet files from the Drive
- *
+ *
* @param driveService
* authorized Drive client service
*/
private void fillSelection() {
try {
driveService = getAuthorizedDriveService();
- List<File> files = driveService.files().list().setFields("nextPageToken, files(id, name, mimeType)")
- .execute().getFiles();
+ List<File> files = driveService.files().list().setQ("mimeType='application/vnd.google-apps.spreadsheet'")
+ .setSpaces("drive").setFields("nextPageToken, files(id, name)").execute().getFiles();
if (files != null && files.size() > 0)
for (File file : files)
- if (file.getMimeType().equals("application/vnd.google-apps.spreadsheet"))
- selection.add(file);
+ selection.add(file);
viewer.refresh();
} catch (IOException e) {
e.printStackTrace();
@@ -244,7 +243,7 @@
/**
* Getter for the authorized drive service object.
- *
+ *
* @return authorized drive service
*/
public static Drive getDriveService() {
@@ -253,7 +252,7 @@
/**
* Displays the sheet with the provided ID in the Capra Office view.
- *
+ *
* @param spreadSheetId
* the ID of the sheet
*/
@@ -274,6 +273,7 @@
MenuManager menuMgr = new MenuManager("#PopupMenu");
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(new IMenuListener() {
+ @Override
public void menuAboutToShow(IMenuManager manager) {
}
});