tmf: Bug492895: Avoid unnecessary refreshes during import operation
[deliverable/tracecompass.git] / tmf / org.eclipse.tracecompass.tmf.remote.ui / src / org / eclipse / tracecompass / internal / tmf / remote / ui / wizards / fetch / model / RemoteImportTracesOperation.java
index 1790030b55e5ac7333fe1e2e4145b03afd93adbd..053c4586635935d83aee43c4f9e424135a087891 100644 (file)
@@ -92,6 +92,7 @@ public class RemoteImportTracesOperation extends TmfWorkspaceModifyOperation {
     private final TmfTraceFolder fDestination;
     private final Object[] fTraceElements;
     private final ImportConflictHandler fConflictHandler;
+    private final List<IResource> fImportedResources = new ArrayList<>();
 
     // ------------------------------------------------------------------------
     // Constructor(s)
@@ -249,6 +250,7 @@ public class RemoteImportTracesOperation extends TmfWorkspaceModifyOperation {
 
                     if (traceTypeHelper != null) {
                         TmfTraceTypeUIUtils.setTraceType(traceRes, traceTypeHelper);
+                        fImportedResources.add(traceRes);
                     }
 
                     // Set source location
@@ -379,7 +381,7 @@ public class RemoteImportTracesOperation extends TmfWorkspaceModifyOperation {
                 // super fast on the same drive
                 Files.move(intermediateFile.toPath(), destination.toFile().toPath(), StandardCopyOption.REPLACE_EXISTING);
             }
-        } catch (CoreException e) {
+        } catch (CoreException | InvocationTargetException | InterruptedException e) {
             Activator.getDefault().logError(e.getMessage(), e);
         } finally {
             if (intermediateFile != null && intermediateFile.exists()) {
@@ -433,4 +435,18 @@ public class RemoteImportTracesOperation extends TmfWorkspaceModifyOperation {
     public IStatus getStatus() {
         return fStatus;
     }
+
+    /**
+     * Get the list of resources that were imported by this operation. An
+     * example use case would be to use this to open traces that were imported
+     * by this operation.
+     *
+     * Note this includes only valid traces and doesn'tinclude unrecognized
+     * files.
+     *
+     * @return the trace resources that were imported
+     */
+    public List<IResource> getImportedResources() {
+        return fImportedResources;
+    }
 }
This page took 0.03603 seconds and 5 git commands to generate.