lttng: Add snapshot support - LTTng Tools v2.3
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng2.ui / src / org / eclipse / linuxtools / internal / lttng2 / ui / views / control / dialogs / ImportDialog.java
index 941dbf29f42f738df879807eaf0181d2aa5f184f..03eae31441cedd79f1a656fbacbb27acd75c76b6 100644 (file)
@@ -240,7 +240,9 @@ public class ImportDialog extends Dialog implements IImportDialog {
                     traceName.append(trace.getName());
                     traceName.insert(0, '-');
 
-                    while (!parent.getAbsolutePath().equals(fSession.getSessionPath())) {
+                    String path = fSession.isSnapshotSession() ? fSession.getSnapshotInfo().getSnapshotPath() : fSession.getSessionPath();
+
+                    while (!parent.getAbsolutePath().equals(path)) {
                         traceName.insert(0, parent.getName());
                         traceName.insert(0, '-');
                         parent = parent.getParentRemoteFile();
@@ -342,7 +344,10 @@ public class ImportDialog extends Dialog implements IImportDialog {
 
         IFileServiceSubSystem fsss = proxy.getFileServiceSubSystem();
 
-        final IRemoteFile remoteFolder = fsss.getRemoteFileObject(fSession.getSessionPath(), new NullProgressMonitor());
+        final String path = fSession.isSnapshotSession() ? fSession.getSnapshotInfo().getSnapshotPath() : fSession.getSessionPath();
+        final IRemoteFile remoteFolder = fsss.getRemoteFileObject(path, new NullProgressMonitor());
+        // make sure that remote directory is read and not cached
+        remoteFolder.markStale(true, true);
 
         fFolderViewer = new CheckboxTreeViewer(contextGroup, SWT.BORDER);
         GridData data = new GridData(GridData.FILL_BOTH);
@@ -375,10 +380,14 @@ public class ImportDialog extends Dialog implements IImportDialog {
         });
         fFolderViewer.setInput(remoteFolder);
 
-        // Select all traces by default
         Object[] children = remoteFolder.getContents(RemoteChildrenContentsType.getInstance());
-        for (int i = 0; i < children.length; i++) {
-            fFolderViewer.setSubtreeChecked(children[i], true);
+        // children can be null if there the path doesn't exist. This happens when a trace
+        // session hadn't been started and no output was created.
+        if (children != null) {
+            // Select all traces by default
+            for (int i = 0; i < children.length; i++) {
+                fFolderViewer.setSubtreeChecked(children[i], true);
+            }
         }
 
         Group projectGroup = new Group(fDialogComposite, SWT.SHADOW_NONE);
This page took 0.024136 seconds and 5 git commands to generate.