From: Marc-Andre Laperle Date: Fri, 29 Jan 2016 23:08:59 +0000 (-0500) Subject: tmf: Fix TestImportExportPackageWizard on Eclipse 4.6M5 X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;h=f0dc41702f4b4ab10eb06b80226b66ff36f8d116;p=deliverable%2Ftracecompass.git tmf: Fix TestImportExportPackageWizard on Eclipse 4.6M5 ArchiveFileExportOperation doesn't include linked resources by default anymore, we have to call setIncludeLinkedResources(true). Because of that, the exported package did not contain the trace files. The method doesn't exist in Eclipse 4.5 so we have to use reflection for the time that we want to support both versions of Eclipse. Change-Id: Ie7216e81fd3004e362e4200946e6ce81f81aa676 Signed-off-by: Marc-Andre Laperle Reviewed-on: https://git.eclipse.org/r/65503 Reviewed-by: Hudson CI Reviewed-by: Bernd Hufmann Tested-by: Bernd Hufmann --- diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/wizards/tracepkg/importexport/TracePackageExportOperation.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/wizards/tracepkg/importexport/TracePackageExportOperation.java index 1456bdae92..65db332d88 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/wizards/tracepkg/importexport/TracePackageExportOperation.java +++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/wizards/tracepkg/importexport/TracePackageExportOperation.java @@ -15,6 +15,7 @@ package org.eclipse.tracecompass.internal.tmf.ui.project.wizards.tracepkg.import import java.io.ByteArrayInputStream; import java.io.StringWriter; import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; import java.util.ArrayList; import java.util.HashSet; import java.util.Set; @@ -293,6 +294,13 @@ public class TracePackageExportOperation extends AbstractTracePackageOperation { private IStatus exportToArchive(IProgressMonitor monitor, int totalWork) throws InvocationTargetException, InterruptedException { ArchiveFileExportOperation op = new ArchiveFileExportOperation(new ArrayList<>(fResources), getFileName()); op.setCreateLeadupStructure(false); + //FIXME: Remove use of reflection when support for Eclipse 4.5 is dropped + try { + Method method = op.getClass().getMethod("setIncludeLinkedResources", boolean.class); //$NON-NLS-1$ + method.invoke(op, true); + } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException e) { + // Ignored, setIncludeLinkedResources doesn't exist in Eclipse < 4.6 + } op.setUseCompression(fUseCompression); op.setUseTarFormat(fUseTar); op.run(SubMonitor.convert(monitor).newChild(totalWork / 2));