tmf: Bug492895: Avoid unnecessary refreshes during import operation
authorBernd Hufmann <Bernd.Hufmann@ericsson.com>
Tue, 3 May 2016 13:55:30 +0000 (09:55 -0400)
committerBernd Hufmann <bernd.hufmann@ericsson.com>
Wed, 4 May 2016 23:36:35 +0000 (19:36 -0400)
This is achieved by using the TmfWorkspaceModifyOperation which
defers the refresh to the end of the operation. Also, setting a trace
type won't refresh the project explorer anymore. The refresh will
be handled at the end of the operation.

Change-Id: I302d54d18b8640b833fc964d5fe74eca06057c15
Signed-off-by: Bernd Hufmann <Bernd.Hufmann@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/71908
Reviewed-by: Hudson CI
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com>
Tested-by: Patrick Tasse <patrick.tasse@gmail.com>
tmf/org.eclipse.tracecompass.tmf.remote.ui/src/org/eclipse/tracecompass/internal/tmf/remote/ui/wizards/fetch/model/RemoteImportTracesOperation.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/wizards/importtrace/TraceValidateAndImportOperation.java

index a02c0019ac227eb7cecb3da82b82184632dbdcf3..053c4586635935d83aee43c4f9e424135a087891 100644 (file)
@@ -381,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()) {
index 22e476cb1c11709c39335cfc0394f79a8f203cd3..93b1ee9d67cd97558b07342cdf010648c30535f9 100644 (file)
@@ -38,10 +38,10 @@ import org.eclipse.core.runtime.Path;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.core.runtime.SubMonitor;
 import org.eclipse.core.runtime.URIUtil;
-import org.eclipse.jface.operation.IRunnableWithProgress;
 import org.eclipse.jface.operation.ModalContext;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.tracecompass.internal.tmf.ui.Activator;
+import org.eclipse.tracecompass.internal.tmf.ui.project.operations.TmfWorkspaceModifyOperation;
 import org.eclipse.tracecompass.tmf.core.TmfCommonConstants;
 import org.eclipse.tracecompass.tmf.core.project.model.TmfTraceImportException;
 import org.eclipse.tracecompass.tmf.core.project.model.TmfTraceType;
@@ -62,7 +62,7 @@ import org.eclipse.ui.wizards.datatransfer.ImportOperation;
  * control
  *
  */
-public class TraceValidateAndImportOperation implements IRunnableWithProgress {
+public class TraceValidateAndImportOperation extends TmfWorkspaceModifyOperation {
 
     private static final String TRACE_IMPORT_TEMP_FOLDER = ".traceImport"; //$NON-NLS-1$
 
@@ -134,7 +134,7 @@ public class TraceValidateAndImportOperation implements IRunnableWithProgress {
     }
 
     @Override
-    public void run(IProgressMonitor progressMonitor) {
+    protected void execute(IProgressMonitor progressMonitor) throws CoreException, InvocationTargetException, InterruptedException {
         try {
             final int ARCHIVE_OR_DIRECTORY_PROGRESS = 45;
             final int EXTRA_IMPORT_OPERATION_PROGRESS = 45;
@@ -534,7 +534,7 @@ public class TraceValidateAndImportOperation implements IRunnableWithProgress {
         // Finally import trace
         IResource importedResource = importResource(fileSystemElement, monitor);
         if (importedResource != null) {
-            TmfTraceTypeUIUtils.setTraceType(importedResource, traceTypeHelper);
+            TmfTraceTypeUIUtils.setTraceType(importedResource, traceTypeHelper, false);
             fImportedResources.add(importedResource);
         }
 
This page took 0.028387 seconds and 5 git commands to generate.