From a8b27f06bbe671292f20582ae1167e9e701f94b8 Mon Sep 17 00:00:00 2001 From: Nitin Dahyabhai Date: Tue, 25 Feb 2014 18:28:50 -0500 Subject: [PATCH] [429102] Allow derived resources to be excluded from archive export --- .../wizards/datatransfer/ArchiveFileExportOperation.java | 16 ++++++++++++++-- .../wizards/datatransfer/DataTransferMessages.java | 3 ++- .../WizardArchiveFileResourceExportPage1.java | 10 +++++++++- .../ui/internal/wizards/datatransfer/messages.properties | 3 ++- 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/wizards/datatransfer/ArchiveFileExportOperation.java b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/wizards/datatransfer/ArchiveFileExportOperation.java index d4df8b3..5548c70 100644 --- a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/wizards/datatransfer/ArchiveFileExportOperation.java +++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/wizards/datatransfer/ArchiveFileExportOperation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2013 IBM Corporation and others. + * Copyright (c) 2000, 2014 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -51,6 +51,8 @@ public class ArchiveFileExportOperation implements IRunnableWithProgress { private boolean useCompression = true; + private boolean includeDerived = true; + private boolean useTarFormat = false; private boolean createLeadupStructure = true; @@ -186,7 +188,7 @@ public class ArchiveFileExportOperation implements IRunnableWithProgress { */ protected void exportResource(IResource exportResource, int leadupDepth) throws InterruptedException { - if (!exportResource.isAccessible()) { + if (!exportResource.isAccessible() || (!includeDerived && exportResource.isDerived())) { return; } @@ -353,6 +355,16 @@ public class ArchiveFileExportOperation implements IRunnableWithProgress { } /** + * Set boolean indicating whether derived resources should + * be exported + * + * @param value boolean + */ + public void setIncludeDerived(boolean value) { + includeDerived = value; + } + + /** * Set this boolean indicating whether exported resources should * be compressed (as opposed to simply being stored) * diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/wizards/datatransfer/DataTransferMessages.java b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/wizards/datatransfer/DataTransferMessages.java index 2d9fdfb..d5f6d2c 100644 --- a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/wizards/datatransfer/DataTransferMessages.java +++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/wizards/datatransfer/DataTransferMessages.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2013 IBM Corporation and others. + * Copyright (c) 2005, 2014 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -128,6 +128,7 @@ public class DataTransferMessages extends NLS { public static String FileExport_damageWarning; public static String ZipExport_compressContents; + public static String ZipExport_includeDerived; public static String ZipExport_destinationLabel; public static String ZipExport_mustBeFile; public static String ZipExport_alreadyExists; diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/wizards/datatransfer/WizardArchiveFileResourceExportPage1.java b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/wizards/datatransfer/WizardArchiveFileResourceExportPage1.java index a73dfe7..cfeb881 100644 --- a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/wizards/datatransfer/WizardArchiveFileResourceExportPage1.java +++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/wizards/datatransfer/WizardArchiveFileResourceExportPage1.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2014 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -38,6 +38,7 @@ public class WizardArchiveFileResourceExportPage1 extends // widgets protected Button compressContentsCheckbox; + protected Button includeDerivedCheckbox; private Button zipFormatButton; private Button targzFormatButton; @@ -104,10 +105,16 @@ public class WizardArchiveFileResourceExportPage1 extends createDirectoryStructureOptions(right, font); + // derived... checkbox + includeDerivedCheckbox = new Button(right, SWT.CHECK | SWT.LEFT); + includeDerivedCheckbox.setText(DataTransferMessages.ZipExport_includeDerived); + includeDerivedCheckbox.setFont(font); + // initial setup createDirectoryStructureButton.setSelection(true); createSelectionOnlyButton.setSelection(false); compressContentsCheckbox.setSelection(true); + includeDerivedCheckbox.setSelection(true); } /** @@ -197,6 +204,7 @@ public class WizardArchiveFileResourceExportPage1 extends op.setCreateLeadupStructure(createDirectoryStructureButton .getSelection()); op.setUseCompression(compressContentsCheckbox.getSelection()); + op.setIncludeDerived(includeDerivedCheckbox.getSelection()); op.setUseTarFormat(targzFormatButton.getSelection()); try { diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/wizards/datatransfer/messages.properties b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/wizards/datatransfer/messages.properties index 5e84f30..e5c289a 100644 --- a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/wizards/datatransfer/messages.properties +++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/wizards/datatransfer/messages.properties @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2000, 2013 IBM Corporation and others. +# Copyright (c) 2000, 2014 IBM Corporation and others. # All rights reserved. This program and the accompanying materials # are made available under the terms of the Eclipse Public License v1.0 # which accompanies this distribution, and is available at @@ -131,6 +131,7 @@ FileExport_toDirectory = To director&y: FileExport_damageWarning=The project {0} may be damaged after this operation ZipExport_compressContents = Co&mpress the contents of the file +ZipExport_includeDerived = Include derived resources ZipExport_destinationLabel = To &zip file: ZipExport_mustBeFile = Export destination must be a file, not a directory. ZipExport_alreadyExists = Target file already exists. Would you like to overwrite it? -- 1.8.3.4 (Apple Git-47)